From f90b1a84057d5c25b5de39832db91dbc41a97f25 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 13 Jun 2011 21:01:59 +0000 Subject: [PATCH] fix ticket #129 (MSVC compile) --- Geo/GEdge.cpp | 2 +- Mesh/meshGFaceDelaunayInsertion.cpp | 4 ++-- Mesh/meshGFaceLloyd.cpp | 4 ++-- Mesh/meshGRegionDelaunayInsertion.cpp | 4 ++-- Mesh/meshGRegionDelaunayInsertion.h | 2 +- Plugin/Distance.cpp | 2 +- contrib/mmg3d/build/sources/analarcutting.c | 3 ++- contrib/mmg3d/build/sources/delaunay.c | 2 ++ contrib/mmg3d/build/sources/mesh.h | 5 ++++- contrib/mmg3d/build/sources/quality.c | 4 ++-- contrib/mmg3d/build/sources/simu44.c | 2 +- 11 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 4c4606cafc..a495a70277 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -279,7 +279,7 @@ double GEdge::length(const double &u0, const double &u1, const int nbQuadPoints) */ -const double GOLDEN = (1. + sqrt(5)) / 2.; +const double GOLDEN = (1. + sqrt(5.)) / 2.; const double GOLDEN2 = 2 - GOLDEN; // x1 and x3 are the current bounds; the minimum is between them. diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp index 18b4b799db..4824297c27 100644 --- a/Mesh/meshGFaceDelaunayInsertion.cpp +++ b/Mesh/meshGFaceDelaunayInsertion.cpp @@ -1138,7 +1138,7 @@ void optimalPointFrontalQuad (GFace *gf, const double rhoM = Extend1dMeshIn2dSurfaces() ? std::min(rhoM1, rhoM2) : rhoM2; const double rhoM_hat = std::min(std::max(rhoM, p), (p * p + q * q) / (2 * q)); - const double factor = (rhoM_hat + sqrt (rhoM_hat * rhoM_hat - p * p)) /(sqrt(3)*p); + const double factor = (rhoM_hat + sqrt (rhoM_hat * rhoM_hat - p * p)) /(sqrt(3.)*p); double npx,npy; if (xp*yp > 0){ @@ -1197,7 +1197,7 @@ void bowyerWatsonFrontalLayers(GFace *gf, bool quad) } if (quad){ - LIMIT_ = sqrt(2)*.99; + LIMIT_ = sqrt(2.) * .99; MTri3::radiusNorm =-1; } diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index b06f3a2b1e..8b7de441c2 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -283,7 +283,7 @@ void smoothing::optimize_face(GFace* gf){ double epsf; double epsx; lpcvt obj; - double initial_conditions[2*triangulator.numPoints]; + std::vector<double> initial_conditions(2*triangulator.numPoints); alglib::ae_int_t maxits; alglib::minlbfgsstate state; alglib::minlbfgsreport rep; @@ -313,7 +313,7 @@ void smoothing::optimize_face(GFace* gf){ } } - x.setcontent(2*num_interior,initial_conditions); + x.setcontent(2*num_interior, &initial_conditions[0]); octree = backgroundMesh::current()->get_octree(); diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp index 9eb2efa6bd..8d52c8cb5f 100644 --- a/Mesh/meshGRegionDelaunayInsertion.cpp +++ b/Mesh/meshGRegionDelaunayInsertion.cpp @@ -190,7 +190,7 @@ bool insertVertex(MVertex *v, ++ittet; } - MTet4** newTets = new MTet4*[shell.size()];; + MTet4** newTets = new MTet4*[shell.size()]; int k = 0; std::list<faceXtet>::iterator it = shell.begin(); @@ -966,7 +966,7 @@ void bowyerWatsonFrontalLayers(GRegion *gr, bool hex) } if (hex){ - LIMIT_ = sqrt(2)*.99; + LIMIT_ = sqrt(2.) * .99; MTet4::radiusNorm =-1; } diff --git a/Mesh/meshGRegionDelaunayInsertion.h b/Mesh/meshGRegionDelaunayInsertion.h index cdd9b581a3..96201ffc66 100644 --- a/Mesh/meshGRegionDelaunayInsertion.h +++ b/Mesh/meshGRegionDelaunayInsertion.h @@ -176,7 +176,7 @@ void bowyerWatsonFrontalLayers(GRegion *gr, bool hex); class compareTet4Ptr { public: - inline bool operator () (const MTet4 *a, const MTet4 *b) + inline bool operator () (const MTet4 *a, const MTet4 *b) const { if (a->getRadius() > b->getRadius()) return true; if (a->getRadius() < b->getRadius()) return false; diff --git a/Plugin/Distance.cpp b/Plugin/Distance.cpp index 345e74b4a9..5a2922bafc 100644 --- a/Plugin/Distance.cpp +++ b/Plugin/Distance.cpp @@ -261,7 +261,7 @@ PView *GMSH_DistancePlugin::execute(PView *v) if((e->getNumVertices() == 2 && order==1) || (e->getNumVertices() == 3 && order==2)){ signedDistancesPointsLine(iDistances, iClosePts, pts, p1,p2); } - else if((e->getNumVertices() == 3 and order==1) or (e->getNumVertices() == 6 and order==2)){ + else if((e->getNumVertices() == 3 && order == 1) || (e->getNumVertices() == 6 && order==2)){ MVertex *v3 = e->getVertex(2); SPoint3 p3 (v3->x(),v3->y(),v3->z()); signedDistancesPointsTriangle(iDistances, iClosePts, pts, p1, p2, p3); diff --git a/contrib/mmg3d/build/sources/analarcutting.c b/contrib/mmg3d/build/sources/analarcutting.c index e36ca14134..a2f6bef29e 100644 --- a/contrib/mmg3d/build/sources/analarcutting.c +++ b/contrib/mmg3d/build/sources/analarcutting.c @@ -307,8 +307,9 @@ int MMG_analarcutting(pMesh mesh,pSol sol,pHedge hash,int *alert,double* lmoy,do printf("6 cut : %8d\n",n6); printf("---------------------------\n"); */ if ( !na ) return(na); +#if !defined(_MSC_VER) #warning check memory allocation - +#endif //printf("%d cut init --- nb tet %d\n",na,mesh->ne); return(na); } diff --git a/contrib/mmg3d/build/sources/delaunay.c b/contrib/mmg3d/build/sources/delaunay.c index e53a0e6a0c..581df424ad 100644 --- a/contrib/mmg3d/build/sources/delaunay.c +++ b/contrib/mmg3d/build/sources/delaunay.c @@ -728,7 +728,9 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,int iel,int ip,pList list,int lon) { if ( ppt->tag & M_UNUSED ) return(0); tref = mesh->tetra[list->tetra[1]/6].ref; +#if !defined(_MSC_VER) #warning remove this test +#endif for (k=1; k<=lon; k++) if(tref!=mesh->tetra[list->tetra[k]/6].ref) printf("pbs coquil %d %d tet %d\n",tref,mesh->tetra[list->tetra[k]/6].ref,list->tetra[k]/6); diff --git a/contrib/mmg3d/build/sources/mesh.h b/contrib/mmg3d/build/sources/mesh.h index efa8ae9ccf..9324545c23 100644 --- a/contrib/mmg3d/build/sources/mesh.h +++ b/contrib/mmg3d/build/sources/mesh.h @@ -111,7 +111,10 @@ along with MMG3D. If not, see <http://www.gnu.org/licenses/>. #undef INT_MAX #undef SHORT_MAX #endif -*/#define INT_MAX 0x7fffffff +*/ +#ifndef INT_MAX +#define INT_MAX 0x7fffffff +#endif #define SHORT_MAX 0x7fff diff --git a/contrib/mmg3d/build/sources/quality.c b/contrib/mmg3d/build/sources/quality.c index 7a78991ac0..c8f93d7b09 100644 --- a/contrib/mmg3d/build/sources/quality.c +++ b/contrib/mmg3d/build/sources/quality.c @@ -479,7 +479,7 @@ double MMG_calte1_ani(pMesh mesh,pSol sol,int iel) { double h1,h2,h3,h4,h5,h6,rapmax,vol,det,v1,v2,v3; double air,dd,num; double *a,*b,*c,*d; - double *ma,*mb,*mc,*md,mm[6];; + double *ma,*mb,*mc,*md,mm[6]; int j,ia,ib,ic,id,iadr; pt = &mesh->tetra[iel]; @@ -1479,7 +1479,7 @@ double MMG_calte3_ani(pMesh mesh,pSol sol,int iel) { double cal,ab[3],ac[3],ad[3],bc[3],bd[3],cd[3]; double vol,det,v1,v2,v3,air,dd; double *a,*b,*c,*d; - double *ma,*mb,*mc,*md,mm[6];; + double *ma,*mb,*mc,*md,mm[6]; int j,ia,ib,ic,id,iadr; static double id3[6] ={1.0,0.,0.,1.,0.,1.}; diff --git a/contrib/mmg3d/build/sources/simu44.c b/contrib/mmg3d/build/sources/simu44.c index c8a20c9e49..fd459a25c5 100644 --- a/contrib/mmg3d/build/sources/simu44.c +++ b/contrib/mmg3d/build/sources/simu44.c @@ -47,7 +47,7 @@ along with MMG3D. If not, see <http://www.gnu.org/licenses/>. /* return 41-42 for config */ int MMG_simu44(pMesh mesh,pSol sol,pList list,double crit) { - pTetra pt,pt1;; + pTetra pt,pt1; double caltab[2]; int ia,ib,s1,s2,s3,s4,iadr,*adja,k,adj,iel,iar; short voy; -- GitLab