move MEFISTO to inline c file instead of fortran...

This commit is contained in:
jriegel 2014-08-18 22:32:10 +02:00
parent ee64f54765
commit b253a14818
6 changed files with 11349 additions and 247 deletions

View File

@ -22,6 +22,7 @@ include_directories(
src/DriverDAT src/DriverDAT
src/DriverSTL src/DriverSTL
src/StdMeshers src/StdMeshers
src/MEFISTO2/f2clib
inc inc
) )
link_directories(${OCC_LIBRARY_DIR}) link_directories(${OCC_LIBRARY_DIR})
@ -127,7 +128,7 @@ ELSE(UNIX)
######### Windows ########### ######### Windows ###########
#MESSAGE("-- Windows system detected") #MESSAGE("-- Windows system detected")
IF(MSVC) IF(MSVC)
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275) ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT /wd4290 /wd4251 /wd4018 /wd4800 /wd4996 /wd4244 /wd4806 /wd4275)
ELSE(MSVC) ELSE(MSVC)
ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB) ADD_DEFINITIONS(-DWNT -DWIN32 -D_WINDOWS -DCSFDB)
ENDIF(MSVC) ENDIF(MSVC)
@ -269,22 +270,42 @@ endif(WIN32)
# MEFISTO2 # # MEFISTO2 #
############## ##############
if (MSVC) if (MSVC)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8) #IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# Mefisto2f.lib was built using f2c which created # # Mefisto2f.lib was built using f2c which created
# all function names with an '_' at the end. # # all function names with an '_' at the end.
FILE(GLOB MEFISTO2_source_files # FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp # src/MEFISTO2/*.cpp
# inc/Rn.h
# inc/aptrte.h
# )
#ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
# FILE(GLOB MEFISTO2_source_files
# src/MEFISTO2/*.cpp
# src/MEFISTO2/MEFISTO2F.def
# inc/Rn.h
# inc/aptrte.h
# )
#ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MEFISTO2_SMESH_source_files
src/MEFISTO2/aptrte.cpp
src/MEFISTO2/trte.c
src/MEFISTO2/f2clib_part.c
inc/Rn.h inc/Rn.h
inc/aptrte.h inc/aptrte.h
) )
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) FILE(GLOB MEFISTO2_f2clib_source_files
FILE(GLOB MEFISTO2_source_files #src/MEFISTO2/f2clib/*.c
src/MEFISTO2/*.cpp #src/MEFISTO2/f2clib/*.h
src/MEFISTO2/MEFISTO2F.def
inc/Rn.h
inc/aptrte.h
) )
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) set(MEFISTO2_source_files
${MEFISTO2_SMESH_source_files}
${MEFISTO2_f2clib_source_files}
)
SOURCE_GROUP("f2cLib" FILES ${MEFISTO2_f2clib_source_files})
else(MSVC) else(MSVC)
FILE(GLOB MEFISTO2_source_files FILE(GLOB MEFISTO2_source_files
src/MEFISTO2/*.cpp src/MEFISTO2/*.cpp

View File

@ -135,7 +135,22 @@ MEFISTO2D_EXPORT
#elif defined(WIN32) && defined (__WATCOM__) #elif defined(WIN32) && defined (__WATCOM__)
#define MEFISTO2D_STDCALL #define MEFISTO2D_STDCALL
#define insoar insoar_
#define azeroi azeroi_
#define fasoar fasoar_
#define teajte teajte_
#define tehote tehote_
#define tetrte tetrte_
#define aisoar aisoar_
#define tedela tedela_
#define terefr terefr_
#define tesuex tesuex_
#define teamqt teamqt_
#define nusotr nusotr_
#define qutr2d qutr2d_
#define surtd2 surtd2_
#define qualitetrte qualitetrte_
#define areteideale areteideale_
#else //Lin and MacOSX use f77 #else //Lin and MacOSX use f77
#define MEFISTO2D_STDCALL #define MEFISTO2D_STDCALL

View File

@ -1,15 +0,0 @@
EXPORTS
insoar
azeroi
fasoar
teajte
tehote
tetrte
aisoar
tedela
terefr
tesuex
teamqt
qutr2d
surtd2
nusotr

View File

@ -24,10 +24,12 @@
// Author : Alain PERRONNET // Author : Alain PERRONNET
// Date : 13 novembre 2006 // Date : 13 novembre 2006
#include "Rn.h" #include "Rn.h"
#include "aptrte.h" #include "aptrte.h"
#include "utilities.h" #include "utilities.h"
using namespace std; using namespace std;
extern "C" extern "C"
@ -839,6 +841,6 @@ void MEFISTO2D_STDCALL qualitetrte( R3 *mnpxyd,
if( nbtrianeg>0 ) if( nbtrianeg>0 )
MESSAGE( "ATTENTION: "<< nbtrianeg << " TRIANGLES d'AIRE NEGATIVE" ); MESSAGE( "ATTENTION: "<< nbtrianeg << " TRIANGLES d'AIRE NEGATIVE" );
MESSAGE(" "); MESSAGE("_");
return; return;
} }

View File

@ -1,217 +0,0 @@
diff --git a/MEFISTO2F.def b/MEFISTO2F.def
new file mode 100644
index 0000000..d4a0728
--- /dev/null
+++ b/MEFISTO2F.def
@@ -0,0 +1,15 @@
+EXPORTS
+ insoar_
+ azeroi_
+ fasoar_
+ teajte_
+ tehote_
+ tetrte_
+ aisoar_
+ tedela_
+ terefr_
+ tesuex_
+ teamqt_
+ qutr2d_
+ surtd2_
+ nusotr_
diff --git a/Mefisto2.def b/Mefisto2.def
new file mode 100644
index 0000000..844f04f
--- /dev/null
+++ b/Mefisto2.def
@@ -0,0 +1,5 @@
+LIBRARY MEFISTO2.dll
+EXPORTS
+ areteideale_
+ qualitetrte_
+
diff --git a/Mefisto2d.def b/Mefisto2d.def
new file mode 100644
index 0000000..dff1325
--- /dev/null
+++ b/Mefisto2d.def
@@ -0,0 +1,5 @@
+LIBRARY MEFISTO2d.dll
+EXPORTS
+ areteideale_
+ qualitetrte_
+
diff --git a/arithchk.c b/arithchk.c
index 6a3c2a5..40f1f47 100644
--- a/arithchk.c
+++ b/arithchk.c
@@ -29,6 +29,7 @@ THIS SOFTWARE.
#include <math.h>
#include <errno.h>
#include <sys/types.h> /* another possible place for ssize_t */
+#include <stddef.h>
#ifdef NO_FPINIT
#define fpinit_ASL()
@@ -42,6 +43,8 @@ extern
#endif /*KR_headers*/
#endif /*NO_FPINIT*/
+ typedef int ssize_t;
+
static int dalign;
typedef struct
Akind {
diff --git a/derf_.c b/derf_.c
index d935d31..e757916 100644
--- a/derf_.c
+++ b/derf_.c
@@ -13,6 +13,38 @@ double derf_(doublereal *x)
{
return( erf(*x) );
}
+
+/* http://stackoverflow.com/questions/6281020/error-function-erfx-not-found-in-math-h-for-visual-studio-2005 */
+double erf(double x)
+{
+ /* constants */
+ double a1 = 0.254829592;
+ double a2 = -0.284496736;
+ double a3 = 1.421413741;
+ double a4 = -1.453152027;
+ double a5 = 1.061405429;
+ double p = 0.3275911;
+ double t;
+ double y;
+
+ /* Save the sign of x */
+ int sign = 1;
+ if (x < 0)
+ sign = -1;
+ x = fabs(x);
+
+ /* A&S formula 7.1.26 */
+ t = 1.0/(1.0 + p*x);
+ y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
+
+ return sign*y;
+}
+/* http://www.boost.org/doc/libs/1_39_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_erf/error_function.html*/
+/* erfc(z) = 1-erf(z) */
+double erfc(double x)
+{
+ return 1.0 - erf(x);
+}
#ifdef __cplusplus
}
#endif
diff --git a/libf2c.lbc b/libf2c.lbc
index c51c0aa..b77ae3c 100644
--- a/libf2c.lbc
+++ b/libf2c.lbc
@@ -1,3 +1,4 @@
+trte.obj
abort_.obj
backspac.obj
c_abs.obj
diff --git a/main.c b/main.c
index d95fdc9..22d1011 100644
--- a/main.c
+++ b/main.c
@@ -135,7 +135,7 @@ f_init();
#ifndef NO_ONEXIT
ONEXIT(f_exit);
#endif
-MAIN__();
+/*MAIN__();*/
#ifdef NO_ONEXIT
f_exit();
#endif
diff --git a/makefile.vc b/makefile.vc
index b3dd90c..3e9c82f 100644
--- a/makefile.vc
+++ b/makefile.vc
@@ -6,12 +6,13 @@
# to the objects in the "w =" list below.
CC = cl
-CFLAGS = -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -Ot1 -DNO_My_ctype -DNO_ISATTY
+CFLAGS = -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -Ot1 -DNO_My_ctype -DNO_ISATTY -MD
.c.obj:
$(CC) -c $(CFLAGS) $*.c
w = \
+ trte.obj \
abort_.obj \
backspac.obj \
c_abs.obj \
@@ -166,7 +167,7 @@ w = \
z_sin.obj \
z_sqrt.obj
-all: f2c.h math.h signal1.h sysdep1.h vcf2c.lib
+all: f2c.h math.h signal1.h sysdep1.h MEFISTO2F.lib MEFISTO2Fd.lib
f2c.h: f2c.h0
copy f2c.h0 f2c.h
@@ -180,8 +181,17 @@ signal1.h: signal1.h0
sysdep1.h: sysdep1.h0
copy sysdep1.h0 sysdep1.h
-vcf2c.lib: $w
- lib -out:vcf2c.lib @libf2c.lbc
+MEFISTO2F.lib: $w
+ lib /DEF:Mefisto2.def /OUT:mef.lib
+ link -out:MEFISTO2F.dll @libf2c.lbc -DLL -IMPLIB:MEFISTO2F.lib -DEF:MEFISTO2F.def mef.lib
+ del mef.lib
+ del mef.exp
+
+MEFISTO2Fd.lib: $w
+ lib /DEF:Mefisto2d.def /OUT:mefd.lib
+ link -out:MEFISTO2Fd.dll @libf2c.lbc -DLL -IMPLIB:MEFISTO2Fd.lib -DEF:MEFISTO2F.def mefd.lib
+ del mefd.lib
+ del mefd.exp
open.obj: open.c
$(CC) -c $(CFLAGS) -DMSDOS open.c
@@ -189,7 +199,7 @@ open.obj: open.c
signbit.obj uninit.obj: arith.h
arith.h: arithchk.c
- comptry.bat $(CC) $(CFLAGS) -DNO_FPINIT arithchk.c
+ $(CC) -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -Ot1 -DNO_My_ctype -DNO_ISATTY -DNO_FPINIT arithchk.c
arithchk >arith.h
del arithchk.exe
del arithchk.obj
diff --git a/open.c b/open.c
index a06428d..d1f3da7 100644
--- a/open.c
+++ b/open.c
@@ -5,7 +5,7 @@
#ifdef MSDOS
#include "io.h"
#else
-#include "unistd.h" /* for access */
+#include "unistd.h" /* for _access */
#endif
#endif
@@ -204,7 +204,7 @@ integer f_open(olist *a)
opnerr(a->oerr,errno,"open")
fclose(tf);
#else
- if (access(buf,0))
+ if (_access(buf,0))
opnerr(a->oerr,errno,"open")
#endif
break;
@@ -234,7 +234,7 @@ integer f_open(olist *a)
opnerr(a->oerr,128,"open")
}
#else
- if (!access(buf,0))
+ if (!_access(buf,0))
opnerr(a->oerr,128,"open")
#endif
/* no break */

File diff suppressed because it is too large Load Diff