Skip to content
Snippets Groups Projects
Commit 289e1403 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

sync msvc tree

parent ee078149
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@
#include <sys/stat.h>
#include <signal.h>
#include <time.h>
#include <math.h>
#if !defined(WIN32) || defined(__CYGWIN__)
#include <unistd.h>
......@@ -164,3 +165,17 @@ int SystemCall(const char *command)
return system(command);
#endif
}
//HACK: allow the use of mixed debug/non-debug code with MSVC
#if (defined (_MSC_VER) && defined (_DEBUG))
extern "C" {
_CRTIMP void __cdecl _invalid_parameter_noinfo(void) { }
}
#endif
//HACK: fix undefined hypot with MSVC
#if defined (_MSC_VER)
extern "C" {
double hypot(double x, double y){ return _hypot(x, y); }
}
#endif
......@@ -136,7 +136,9 @@ class VertexArray{
int getNumVerticesPerElement() { return _numVerticesPerElement; }
// return the number of element pointers
int getNumElementPointers() { return _elements.size(); }
// return a pointer to the raw vertex array
// return a pointer to the raw vertex array (warning: 1) we don't
// range check 2) calling this if _vertices.size() == 0 will cause
// some compilers to throw an exception)
float *getVertexArray(int i=0){ return &_vertices[i]; }
// return a pointer to the raw normal array
char *getNormalArray(int i=0){ return &_normals[i]; }
......
......@@ -48,6 +48,7 @@ void GEdge::getNumMeshElements(unsigned *const c) const
MElement *const *GEdge::getStartElementType(int type) const
{
if(lines.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&lines[0]);
}
......
......@@ -75,8 +75,10 @@ MElement *const *GFace::getStartElementType(int type) const
{
switch(type) {
case 0:
if(triangles.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&triangles[0]);
case 1:
if(quadrangles.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&quadrangles[0]);
}
return 0;
......
......@@ -56,12 +56,16 @@ MElement *const *GRegion::getStartElementType(int type) const
{
switch(type) {
case 0:
if(tetrahedra.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&tetrahedra[0]);
case 1:
if(hexahedra.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&hexahedra[0]);
case 2:
if(prisms.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&prisms[0]);
case 3:
if(pyramids.empty()) return 0; // msvc would throw an exception
return reinterpret_cast<MElement *const *>(&pyramids[0]);
}
return 0;
......
......@@ -545,8 +545,9 @@ struct MakeGraphFromEntity
int nType = entity->getNumElementTypes();
for(int iType = 0; iType != nType; ++iType) {
// Loop over all elements in a type
MElement *const *element = entity->getStartElementType(iType);
const int nElem = numElem[iType];
if(!nElem) continue;
MElement *const *element = entity->getStartElementType(iType);
for(int iElem = 0; iElem != nElem; ++iElem) {
const int nFace = DimTr<DIM>::getNumFace(element[iElem]);
// Insert this element into the map of graph vertices
......@@ -619,8 +620,9 @@ struct MatchBoElemToGrVertex
int nType = entity->getNumElementTypes();
for(int iType = 0; iType != nType; ++iType) {
// Loop over all elements in a type
MElement *const *element = entity->getStartElementType(iType);
const int nElem = numElem[iType];
if(!nElem) continue;
MElement *const *element = entity->getStartElementType(iType);
for(int iElem = 0; iElem != nElem; ++iElem) {
FaceT face = DimTr<DIM>::getFace(element[iElem], 0);
const typename FaceMap::const_iterator faceMapIt = faceMap.find(face);
......
......@@ -13,34 +13,20 @@
#if defined(HAVE_GSL)
#include <gsl/gsl_version.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_linalg.h>
void new_handler(const char *reason, const char *file, int line,
int gsl_errno)
void my_gsl_msg(const char *reason, const char *file, int line,
int gsl_errno)
{
Msg::Error("GSL: %s (%s, line %d)", reason, file, line);
}
int check_gsl()
{
// check version
int major, minor;
if(!sscanf(gsl_version, "%d.%d", &major, &minor)){
Msg::Fatal("Cannot retreive GSL version");
return 0;
}
if(major < 1 || (major == 1 && minor < 2)) {
Msg::Error("Your GSL version (%d.%d.X) has a bug in the singular value",
major, minor);
Msg::Error("decomposition code. Please upgrade to version 1.2 or above.");
Msg::Fatal("You can download the GSL from http://sources.redhat.com/gsl/");
return 0;
}
// set new error handler
gsl_set_error_handler(&new_handler);
gsl_set_error_handler(&my_gsl_msg);
// initilize robust geometric predicates
gmsh::exactinit() ;
......@@ -52,6 +38,7 @@ int check_gsl()
#define NRANSI
#include "nrutil.h"
void dsvdcmp(double **a, int m, int n, double w[], double **v);
int check_gsl()
{
// initilize robust geometric predicates
......
......@@ -76,10 +76,10 @@ cpobj: ${OBJ}
cp -f ${OBJ} ../../lib/
.c${OBJEXT}:
${CC} ${CFLAGS} ${DASH}c $< ${DASH}o ${<:.c=${OBJEXT}}
${CC} ${CFLAGS} ${DASH}c $<
clean:
rm -f *.o *.obj
${RM} *.o *.obj
depend:
(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
......
......@@ -8,7 +8,7 @@
* Started 8/27/94
* George
*
* $Id: metis.h,v 1.1 2005-09-21 17:29:38 geuzaine Exp $
* $Id: metis.h,v 1.2 2008-09-22 13:23:50 geuzaine Exp $
*/
......@@ -18,7 +18,7 @@
#else
#include <malloc.h>
#endif
#include <strings.h>
//#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
......
......@@ -12,13 +12,18 @@
MAKE=C:\src\gmsh\utils\misc\gmake.exe
# Change the following to select which version to build:
ENABLE_GSL=1
ENABLE_GUI=0
ENABLE_PARSER=1
ENABLE_POSTPRO=1
ENABLE_TETGEN=1
ENABLE_NETGEN=0
ENABLE_METIS=1
ENABLE_OCC=0
# If you selected ENABLE_GSL, specify where the GSL is installed
GSL_PREFIX=C:\src\gsl-1.8
# If you selected ENABLE_GUI, specify where FLTK is installed
FLTK_PREFIX=C:\src\fltk-1.1.9
......@@ -32,8 +37,8 @@ UNAME=WIN32MSVC
HOSTNAME=localhost
# The names of the C and C++ compilers
CC=cl
CXX=cl /EHsc /nologo /GR /MT
CC=cl /nologo /MTd
CXX=cl /EHsc /nologo /GR /MTd
# Debug/Release Single/Multi-threaded Lib/Dll flags:
# Rel-Sin-Lib: /ML
......@@ -57,7 +62,6 @@ LINKER=cl /F16777216
# All compiler flags except optimization flags
FLAGS=/DWIN32 /D_USE_MATH_DEFINES /DHAVE_NO_DLL /DHAVE_NO_SOCKLEN_T
FLAGS+=/DHAVE_ANN /DHAVE_MATH_EVAL
FLAGS+=/D_CRT_SECURE_NO_DEPRECATE
# Additional system includes ($INCLUDE is automatically defined by MSVC when
......@@ -71,6 +75,10 @@ OPTIM=/O2
GMSH_DIRS=Common Geo Mesh Numeric contrib/ANN contrib/MathEval contrib/NR
# Optional stuff
ifeq (${ENABLE_GSL},1)
FLAGS+=/DHAVE_GSL /I${GSL_PREFIX}
GMSH_LIBS+=${GSL_PREFIX}/lib/gsl.lib ${GSL_PREFIX}/lib/gslcblas.lib
endif
ifeq (${ENABLE_PARSER},1)
GMSH_DIRS+=Parser
else
......@@ -89,22 +97,26 @@ ifeq (${ENABLE_TETGEN},1)
FLAGS+=/DHAVE_TETGEN
GMSH_DIRS+=contrib/Tetgen
endif
ifeq (${ENABLE_METIS},1)
FLAGS+=/DHAVE_METIS
GMSH_DIRS+=contrib/Metis
endif
ifeq (${ENABLE_OCC},1)
FLAGS+=/DHAVE_OCC /DHAVE_NO_OCC_CONFIG_H /DWNT /I"${OCC_PREFIX}/inc"
GMSH_LIBS+=${OCC_PREFIX}/lib/*.lib
GMSH_LIBS+=${OCC_PREFIX}/win32/bin/*.lib
endif
ifeq (${ENABLE_GUI},1)
LINKER+=/SUBSYSTEM:WINDOWS
GMSH_DIRS+=Graphics Fltk
FLAGS+=/DHAVE_FLTK /I"${FLTK_PREFIX}"
GMSH_LIBS+=Fltk/Main.obj lib/*.lib lib/*.lib ${FLTK_PREFIX}\lib\fltk*.lib
GMSH_DIRS+=Graphics Fltk contrib/NativeFileChooser
FLAGS+=/DHAVE_FLTK /DHAVE_NATIVE_FILE_CHOOSER /I"${FLTK_PREFIX}"
GMSH_LIBS+=Fltk/Main.obj lib/*.lib ${FLTK_PREFIX}\lib\fltk*.lib
GMSH_LIBS+=glu32.lib opengl32.lib advapi32.lib gdi32.lib user32.lib
GMSH_LIBS+=shell32.lib ole32.lib uuid.lib comctl32.lib
GMSH_LIBS+=shell32.lib ole32.lib uuid.lib comctl32.lib comdlg32.lib
GMSH_LIBS+=wsock32.lib winspool.lib ws2_32.lib Fltk/Win32Icon.res
GMSH_LIBS+=/link /NODEFAULTLIB:libcmt.lib
GMSH_LIBS+=/link /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib
# GMSH_LIBS+=/SUBSYSTEM:WINDOWS
else
GMSH_LIBS=Common/Main.obj lib/*.lib
GMSH_LIBS+=Common/Main.obj lib/*.lib
endif
# How you create a static library on this machine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment