From 4fab79a339fd8ffdf7347546b54b697c66e3ad2f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 21 Aug 2013 05:43:45 +0000 Subject: [PATCH] fix warnings --- Geo/boundaryLayersData.cpp | 112 +++++++++++++++++++------------------ Mesh/Field.cpp | 14 ++--- Mesh/meshGRegion.cpp | 104 +++++++++++++++++----------------- 3 files changed, 119 insertions(+), 111 deletions(-) diff --git a/Geo/boundaryLayersData.cpp b/Geo/boundaryLayersData.cpp index 7c1a63370c..eb228cb239 100644 --- a/Geo/boundaryLayersData.cpp +++ b/Geo/boundaryLayersData.cpp @@ -33,6 +33,7 @@ const int FANSIZE__ = 4; + */ +/* static double solidAngle (SVector3 &ni, SVector3 &nj, SPoint3 &bi, SPoint3 &bj) { @@ -43,6 +44,7 @@ static double solidAngle (SVector3 &ni, SVector3 &nj, double sign = dot (nj, bibj); return sign > 0 ? fabs (a) : -fabs(a); } +*/ SVector3 interiorNormal (SPoint2 p1, SPoint2 p2, SPoint2 p3) { @@ -132,7 +134,7 @@ const BoundaryLayerData & BoundaryLayerColumns::getColumn(MVertex *v, MFace f) BoundaryLayerFanWedge3d w = getWedge(v); if (w.isLeft(gf))return getColumn(v, 0); if (w.isRight(gf))return getColumn(v, N-1); - Msg::Error("Strange behavior for a wedge"); + Msg::Error("Strange behavior for a wedge"); } if (isCorner (v)){ GFace *gf = _inverse_classification[f]; @@ -179,7 +181,7 @@ faceColumn BoundaryLayerColumns::getColumns(GFace *gf, MVertex *v1, MVertex *v2 break; } } - + return faceColumn(getColumn(v1,i1), getColumn(v2,i2), getColumn(v3,i3)); } @@ -278,10 +280,12 @@ edgeColumn BoundaryLayerColumns::getColumns(MVertex *v1, MVertex *v2 , int side) return error2; } -// FIXME -static bool pointInFace (GFace *gf, double u, double v) { +/* +static bool pointInFace (GFace *gf, double u, double v) +{ return true; } +*/ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2, double _treshold, BoundaryLayerColumns *_columns, @@ -299,7 +303,7 @@ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2 for (unsigned int SIDE = 0; SIDE < N1.size() ; SIDE++){ // IF THE ANGLE IS GREATER THAN THRESHOLD, ADD DIRECTIONS !! double angle = computeAngle (gf,e1,e2,N1[SIDE],N2[SIDE]); - // if (test) + // if (test) // printf("angle %12.5E\n", 180*angle/M_PI); if (angle < _treshold /*&& angle > - _treshold*/){ SVector3 x = N1[SIDE]*1.01+N2[SIDE]; @@ -307,7 +311,7 @@ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2 _dirs.push_back(x); } else if (angle >= _treshold){ - + if (USEFANS__){ int fanSize = FANSIZE__; //angle / _treshold; // if the angle is greater than PI, than reverse the sense @@ -340,7 +344,7 @@ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2 } else { _dirs.push_back(N1[SIDE]); - _dirs.push_back(N2[SIDE]); + _dirs.push_back(N2[SIDE]); } } } @@ -362,7 +366,7 @@ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2 // for (unsigned int SIDE = 0; SIDE < N1.size() ; SIDE++){ // // IF THE ANGLE IS GREATER THAN THRESHOLD, ADD DIRECTIONS !! // double angle = computeAngle (gf,e1,e2,N1[SIDE],N2[SIDE]); -// // if (test) +// // if (test) // // printf("angle %12.5E\n", 180*angle/M_PI); // if (angle < _treshold /*&& angle > - _treshold*/){ // SVector3 x = N1[SIDE]*1.01+N2[SIDE]; @@ -371,7 +375,7 @@ static void treat2Connections (GFace *gf, MVertex *_myVert, MEdge &e1, MEdge &e2 // } // else if (angle >= _treshold){ // _dirs.push_back(N1[SIDE]); -// _dirs.push_back(N2[SIDE]); +// _dirs.push_back(N2[SIDE]); // } // } // } @@ -436,8 +440,8 @@ BoundaryLayerField* getBLField (GModel *gm) { return dynamic_cast<BoundaryLayerField*> (bl_field); } -static bool isEdgeOfFaceBL (GFace *gf, - GEdge *ge, +static bool isEdgeOfFaceBL (GFace *gf, + GEdge *ge, BoundaryLayerField *blf){ if (blf->isEdgeBL (ge->tag()))return true; /* @@ -454,19 +458,19 @@ static bool isEdgeOfFaceBL (GFace *gf, return false; } -static void getEdgesData (GFace *gf, - BoundaryLayerField *blf, +static void getEdgesData (GFace *gf, + BoundaryLayerField *blf, BoundaryLayerColumns *_columns, std::set<MVertex*> &_vertices, std::set<MEdge,Less_Edge> &allEdges, std::multimap<MVertex*,MVertex*> &tangents) { - // get all model edges + // get all model edges std::list<GEdge*> edges = gf->edges(); std::list<GEdge*> embedded_edges = gf->embeddedEdges(); edges.insert(edges.begin(), embedded_edges.begin(),embedded_edges.end()); - // iterate on model edges + // iterate on model edges std::list<GEdge*>::iterator ite = edges.begin(); while(ite != edges.end()){ // check if this edge generates a boundary layer @@ -481,7 +485,7 @@ static void getEdgesData (GFace *gf, _vertices.insert(v2); } } - else { + else { MVertex *v1 = (*ite)->lines[0]->getVertex(0); MVertex *v2 = (*ite)->lines[0]->getVertex(1); MVertex *v3 = (*ite)->lines[(*ite)->lines.size() - 1]->getVertex(1); @@ -493,8 +497,8 @@ static void getEdgesData (GFace *gf, } } -static void getNormals (GFace *gf, - BoundaryLayerField *blf, +static void getNormals (GFace *gf, + BoundaryLayerField *blf, BoundaryLayerColumns *_columns, std::set<MEdge,Less_Edge> &allEdges) { @@ -508,13 +512,13 @@ static void getNormals (GFace *gf, MVertex *v2 = gf->triangles[i]->getVertex(2); reparamMeshEdgeOnFace(v0, v1, gf, p0, p1); reparamMeshEdgeOnFace(v0, v2, gf, p0, p2); - + MEdge me01(v0,v1); if (allEdges.find(me01) != allEdges.end()){ SVector3 v01 = interiorNormal (p0,p1,p2); _columns->_normals.insert(std::make_pair(me01,v01)); } - + MEdge me02(v0,v2); if (allEdges.find(me02) != allEdges.end()){ SVector3 v02 = interiorNormal (p0,p2,p1); @@ -536,7 +540,7 @@ void addColumnAtTheEndOfTheBL (GEdge *ge, { // printf("coucou %d\n",ge->tag()); if (!blf->isEdgeBL(ge->tag())) - { + { GVertex *g0 = ge->getBeginVertex(); GVertex *g1 = ge->getEndVertex(); // printf("coucou 2 %d %d vs %d\n",g0->tag(),g1->tag(),gv->tag()); @@ -556,7 +560,7 @@ void addColumnAtTheEndOfTheBL (GEdge *ge, } else if (g1 == gv){ _columns->addColumn(t*-1.0, v1,invert,_metrics); - } + } } } @@ -639,7 +643,7 @@ bool buildAdditionalPoints2D (GFace *gf) for (std::multimap<MVertex*,MVertex*>::iterator itm = tangents.lower_bound(*it); itm != tangents.upper_bound(*it); ++itm) Ts.push_back(itm->second); - // end of the BL --> let's add a column that correspond to the + // end of the BL --> let's add a column that correspond to the // model edge that lies after the end of teh BL if (Ts.size() == 1){ // printf("HERE WE ARE IN FACE %d %d\n",gf->tag(),Ts.size()); @@ -794,7 +798,7 @@ double angle_0_180 (SVector3 &n1, SVector3 &n2){ void createBLPointsInDir (GRegion *gr, MVertex *current, - BoundaryLayerField *blf, + BoundaryLayerField *blf, SVector3 & n, std::vector<MVertex*> &_column, std::vector<SMetric3> &_metrics) @@ -814,11 +818,11 @@ void createBLPointsInDir (GRegion *gr, } -static void createColumnsBetweenFaces (GRegion *gr, +static void createColumnsBetweenFaces (GRegion *gr, MVertex *myV, - BoundaryLayerField *blf, - BoundaryLayerColumns *_columns, - std::set<GFace*> _gfaces, + BoundaryLayerField *blf, + BoundaryLayerColumns *_columns, + std::set<GFace*> _gfaces, std::multimap<GFace*,MTriangle*> & _faces, std::map<MFace,SVector3,Less_Face> &_normals, double _treshold) @@ -827,15 +831,15 @@ static void createColumnsBetweenFaces (GRegion *gr, SPoint3 c[256]; int count = 0; GFace *gfs[256]; - + // generate datas per face; - + for( std::set<GFace*> ::iterator it = _gfaces.begin() ; it != _gfaces.end(); ++it){ for (std::multimap<GFace*,MTriangle*>::iterator itm = _faces.lower_bound(*it); itm != _faces.upper_bound(*it); ++itm){ - + n[count] += _normals[itm->second->getFace(0)]; c[count] = itm->second->getFace(0).barycenter(); } @@ -843,7 +847,7 @@ static void createColumnsBetweenFaces (GRegion *gr, n[count].normalize(); count ++; } - + // we throw a column per set of faces that have normals that are sufficiently close // printf("vertex %d %d faces\n",myV->getNum(),count); @@ -881,13 +885,14 @@ static void createColumnsBetweenFaces (GRegion *gr, } } -static bool createWedgeBetweenTwoFaces (bool testOnly, - MVertex *myV, - GFace *gf1, GFace *gf2, - std::multimap<GFace*,MTriangle*> & _faces, - std::map<MFace,SVector3,Less_Face> &_normals, - double _treshold, - std::vector<SVector3> &shoot) +/* +static bool createWedgeBetweenTwoFaces(bool testOnly, + MVertex *myV, + GFace *gf1, GFace *gf2, + std::multimap<GFace*,MTriangle*> & _faces, + std::map<MFace,SVector3,Less_Face> &_normals, + double _treshold, + std::vector<SVector3> &shoot) { SVector3 n1,n2; SPoint3 c1,c2; @@ -912,12 +917,12 @@ static bool createWedgeBetweenTwoFaces (bool testOnly, if(testOnly)return true; int fanSize = FANSIZE__; //angle / _treshold; for (int i=-1; i<=fanSize; i++){ - + double ti = (double)(i+1)/ (fanSize+1); double angle_t = ti * angle; double cosA = cos (angle_t); double cosAlpha = dot(n1,n2); - + const double A = (1.- 2.*cosA*cosA) + cosAlpha*cosAlpha - 2 * cosAlpha*(1.-cosA*cosA); const double B = -2*(1.-cosA*cosA)*(1-cosAlpha); const double C = 1.-cosA*cosA; @@ -933,16 +938,16 @@ static bool createWedgeBetweenTwoFaces (bool testOnly, } const double t1 = (-B+sqrt(DELTA))/(2.*A); const double t2 = (-B-sqrt(DELTA))/(2.*A); - + SVector3 x1 (n1*(1.-t1) + n2 * t2); SVector3 x2 (n1*(1.-t2) + n2 * t2); double a1 = angle_0_180 (n1,x1); double a2 = angle_0_180 (n1,x2); - if (fabs(a1 - angle_t) < fabs(a2 - angle_t))t = t1; + if (fabs(a1 - angle_t) < fabs(a2 - angle_t))t = t1; else t = t2; } SVector3 x (n1*(1.-t) + n2 * t); - x.normalize(); + x.normalize(); shoot.push_back(x); } return true; @@ -953,19 +958,19 @@ static bool createWedgeBetweenTwoFaces (bool testOnly, n.normalize(); shoot.push_back(n); return false; - } + } } +*/ - -BoundaryLayerColumns * buildAdditionalPoints3D (GRegion *gr) +BoundaryLayerColumns *buildAdditionalPoints3D(GRegion *gr) { #if !defined(HAVE_ANN) return 0; #else BoundaryLayerField *blf = getBLField (gr->model()); - + if (!blf)return 0; - + blf->setupFor3d(); double _treshold = blf->fan_angle * M_PI / 180 ; @@ -988,7 +993,8 @@ BoundaryLayerColumns * buildAdditionalPoints3D (GRegion *gr) _columns->_inverse_classification [(*itf)->triangles[i]->getFace(0)] = *itf; for(unsigned int j = 0; j< 3; j++){ if ((*itf)->triangles[i]->getVertex(j)->onWhat()->dim() != 3){ - _columns->_non_manifold_faces.insert(std::make_pair((*itf)->triangles[i]->getVertex(j),(*itf)->triangles[i])); + _columns->_non_manifold_faces.insert + (std::make_pair((*itf)->triangles[i]->getVertex(j),(*itf)->triangles[i])); _vertices.insert((*itf)->triangles[i]->getVertex(j)); _normals [(*itf)->triangles[i]->getFace(0)] = SVector3(0,0,0); } @@ -1050,14 +1056,14 @@ BoundaryLayerColumns * buildAdditionalPoints3D (GRegion *gr) _faces.insert(std::make_pair(gf,itm->second)); _allGFaces.insert(gf); } - + bool onSymmetryPlane = 0; if ((*it)->onWhat()->dim() != 2){ std::list<GFace*> faces = (*it)->onWhat()->faces(); if (faces.size() != _allGFaces.size()){ onSymmetryPlane = true; } - } + } if (onSymmetryPlane){ for ( std::list<GFace*>::iterator itf = faces.begin(); itf!= faces.end() ; ++itf){ @@ -1074,7 +1080,7 @@ BoundaryLayerColumns * buildAdditionalPoints3D (GRegion *gr) } } } - else + else createColumnsBetweenFaces (gr,*it,blf,_columns,_allGFaces,_faces,_normals,_treshold); } diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index dd11918269..3480d57d61 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -1670,7 +1670,7 @@ class AttractorField : public Field it != faces_id.end(); ++it) { GFace *f = GModel::current()->getFaceByTag(*it); if (f){ - + if (f->mesh_vertices.size()){ for (unsigned int i=0;i<f->mesh_vertices.size();i++){ MVertex *v = f->mesh_vertices[i]; @@ -1876,13 +1876,13 @@ void BoundaryLayerField::setupFor2d(int iF) int iE = (*it)->tag(); bool found = std::find ( edges_id_saved.begin(),edges_id_saved.end(),iE ) != edges_id_saved.end(); // printf("edges %d found %d\n",iE,found); - // this edge is a BL Edge + // this edge is a BL Edge if (found){ std::list<GFace*> fc = (*it)->faces(); - // one only face --> 2D --> BL + // one only face --> 2D --> BL if (fc.size() == 1) isIn = true; else { - // more than one face and + // more than one face and std::list<GFace*>::iterator itf = fc.begin(); bool found_this = std::find ( faces_id_saved.begin(),faces_id_saved.end(),iF ) != faces_id_saved.end(); if (!found_this)isIn = true; @@ -1892,7 +1892,7 @@ void BoundaryLayerField::setupFor2d(int iF) int iF2 = (*itf)->tag(); foundAll &= std::find ( faces_id_saved.begin(),faces_id_saved.end(),iF2 ) != faces_id_saved.end(); } - if (foundAll)isIn = true; + if (foundAll)isIn = true; } } } @@ -1902,8 +1902,8 @@ void BoundaryLayerField::setupFor2d(int iF) nodes_id.push_back ((*it)->getEndVertex()->tag()); } } - printf("face %d %d BL Edges\n",iF,edges_id.size()); - + printf("face %d %d BL Edges\n", iF, (int)edges_id.size()); + removeAttractors(); } } diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp index 00f641417d..3b8ba66dcd 100644 --- a/Mesh/meshGRegion.cpp +++ b/Mesh/meshGRegion.cpp @@ -473,7 +473,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out, else{ v1b = new MVertex(v[j]->x(), v[j]->y(), v[j]->z(), gf); } - + gf->mesh_vertices.push_back(v1b); numberedV[out.trifacelist[i * 3 + j] - 1] = v1b; delete v[j]; @@ -511,20 +511,20 @@ static void addOrRemove(const MFace &f, /* here, we have a list of elements that actually do not form a mesh --> a set boundary layer elements (prism, hexes, pyramids (and soon tets) - --> a set of tetrahedra that respect the external boundary of the BL mesh, + --> a set of tetrahedra that respect the external boundary of the BL mesh, yet possiblty containing elements that are on the other side of the boundary and therefore overlapping those elements. We have to extract the good ones ! - + */ -bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, +bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, std::vector<MTetrahedron*> &tets, std::vector<MHexahedron*> &hexes, std::vector<MPrism*> &prisms, - std::vector<MPyramid*> &pyramids) -{ + std::vector<MPyramid*> &pyramids) +{ std::set<MElement*> all; all.insert(hexes.begin(),hexes.end()); all.insert(prisms.begin(),prisms.end()); @@ -540,18 +540,18 @@ bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, // create the graph face 2 elements for the region std::map<MFace,std::pair<MElement*,MElement*> ,Less_Face> myGraph; - + for (std::set<MElement*>::iterator it = all.begin(); it != all.end(); ++it){ MElement *t = *it; const int nbf = t->getNumFaces(); for (int j=0;j<nbf;j++){ - MFace f = t->getFace(j); + MFace f = t->getFace(j); std::map<MFace,std::pair<MElement*,MElement*>,Less_Face>::iterator itf = myGraph.find(f); if (itf == myGraph.end())myGraph.insert (std::make_pair (f, std::make_pair (t,(MElement*)0))); else { // what to do ?????? - // two tets and one prism --> the prism should be - // geometrically on the other side of the + // two tets and one prism --> the prism should be + // geometrically on the other side of the if (itf->second.second) { MElement *prism=0, *t1=0, *t2=0; if (itf->second.second->getType () == TYPE_PRI || itf->second.second->getType () == TYPE_PYR) { @@ -579,19 +579,19 @@ bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, } SVector3 n = f.normal(); SPoint3 c = f.barycenter(); - MVertex *v_prism,*v_t1,*v_t2; + MVertex *v_prism = 0, *v_t1 = 0, *v_t2 = 0; for (int i=0;i<4;i++){ - if (t1->getVertex(i) != f.getVertex(0) && - t1->getVertex(i) != f.getVertex(1) && + if (t1->getVertex(i) != f.getVertex(0) && + t1->getVertex(i) != f.getVertex(1) && t1->getVertex(i) != f.getVertex(2))v_t1 = t1->getVertex(i); - if (t2->getVertex(i) != f.getVertex(0) && - t2->getVertex(i) != f.getVertex(1) && + if (t2->getVertex(i) != f.getVertex(0) && + t2->getVertex(i) != f.getVertex(1) && t2->getVertex(i) != f.getVertex(2))v_t2 = t2->getVertex(i); } for (int i=0;i<prism->getNumVertices();i++){ - if (prism->getVertex(i) != f.getVertex(0) && - prism->getVertex(i) != f.getVertex(1) && - prism->getVertex(i) != f.getVertex(2))v_prism = prism->getVertex(i); + if (prism->getVertex(i) != f.getVertex(0) && + prism->getVertex(i) != f.getVertex(1) && + prism->getVertex(i) != f.getVertex(2)) v_prism = prism->getVertex(i); } SVector3 vf1 (v_t1->x() - c.x(),v_t1->y() - c.y(),v_t1->z() - c.z()); SVector3 vf2 (v_t2->x() - c.x(),v_t2->y() - c.y(),v_t2->z() - c.z()); @@ -602,7 +602,7 @@ bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, // else if (dot (vf2,vfp) > 0){itf->second.first = prism;itf->second.second=t2;} else Msg::Fatal("Impossible Geom Config"); } - else itf->second.second = t; + else itf->second.second = t; } } } @@ -622,9 +622,9 @@ bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, f.getVertex(2), search); if (!gfound){ - std::map<MFace,std::pair<MElement*,MElement*>,Less_Face>::iterator + std::map<MFace,std::pair<MElement*,MElement*>,Less_Face>::iterator itf = myGraph.find(f); - MElement *t_neigh = itf->second.first == FIRST ? + MElement *t_neigh = itf->second.first == FIRST ? itf->second.second : itf->second.first; if (connected.find(t_neigh) == connected.end())myStack.push(t_neigh); } @@ -634,7 +634,7 @@ bool AssociateElementsToModelRegionWithBoundaryLayers (GRegion *gr, } } } - // printf ("found a set of %d elements that are connected with %d bounding faces\n",connected.size(),faces_bound.size()); + // printf ("found a set of %d elements that are connected with %d bounding faces\n",connected.size(),faces_bound.size()); GRegion *myGRegion = getRegionFromBoundingFaces(gr->model(), faces_bound); // printf("REGION %d %d\n",myGRegion->tag(),gr->tag()); if (myGRegion == gr){ @@ -680,8 +680,6 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) std::vector<MPyramid*> blPyrs; std::list<GFace*> faces = gr->faces(); - - std::list<GFace*> embedded_faces = gr->embeddedFaces(); faces.insert(faces.begin(), embedded_faces.begin(),embedded_faces.end()); FILE *ff2 = fopen ("tato3D.pos","w"); @@ -734,7 +732,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) ++itf; } - std::set<MEdge,Less_Edge> edges; + std::set<MEdge,Less_Edge> edges; { std::list<GEdge*> gedges = gr->edges(); for (std::list<GEdge*>::iterator it = gedges.begin(); it != gedges.end() ; ++it){ @@ -783,10 +781,10 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) // have to go from gf1 to gf2 to be aware of the sense!!! if (N1 == N2){ - for (unsigned int i=0;i<N1-1;i++){ + for (int i = 0; i < N1 - 1; i++){ unsigned int i11=i, i12=i+1, i21=i,i22=i+1; - + if (onWedge1){ // if (w1.isLeft(gfs1)){i11=i;i12=i+1;} // else if (w1.isRight(gfs1)){i11=N1-1-i;i12=N1-2-i;} @@ -814,10 +812,10 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) 3 4 5 6 --> 4-1 -> 2 (4-1) 6 7 8 0 - 1 --> 0 ==> - + 1 --> 0 ==> + */ - int K1=-1,K2=-1; + int K1 = -1, K2 = -1; for (unsigned int s=0;s < c1._gf.size();s++){ if (w2.isLeft(c1._gf[s]))K1 = s; if (w2.isRight(c1._gf[s]))K2 = s; @@ -828,7 +826,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) else if (K2+1 == K1){i11=K1*(N1-1)-i;i12=i11-1;} else if (K2 == 0 && K1 == c1._gf.size() - 1){i11=K1*(N1-1)+i;i12=i11+1;} else if (K1 == 0 && K2 == c1._gf.size() - 1){i11=(K2+1)*(N1-1)-i;i12=i11-1;} - else Msg::Error("KROUPOUK 1 %d %d !",K1,K2); + else Msg::Error("KROUPOUK 1 %d %d !", K1, K2); if (i12 == (c1._gf.size()) * (N1-1))i12=0; if (i11 == (c1._gf.size()) * (N1-1))i11=0; } @@ -837,7 +835,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) else if (w2.isRight(gfs1)){i21=N1-1-i;i22=N1-2-i;} } else { - int K1,K2; + int K1 = -1, K2 = -1; for (unsigned int s=0;s<c2._gf.size();s++){ if (w1.isLeft(c2._gf[s]))K1 = s; if (w1.isRight(c2._gf[s]))K2 = s; @@ -855,7 +853,9 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) BoundaryLayerData c12 = _columns->getColumn(v1,i12); BoundaryLayerData c21 = _columns->getColumn(v2,i21); BoundaryLayerData c22 = _columns->getColumn(v2,i22); - int N = std::min(c11._column.size(),std::min(c12._column.size(), std::min(c21._column.size(),c22._column.size()))); + int N = std::min(c11._column.size(), + std::min(c12._column.size(), + std::min(c21._column.size(), c22._column.size()))); for (int l=0;l < N ;++l){ MVertex *v11,*v12,*v13,*v14; MVertex *v21,*v22,*v23,*v24; @@ -884,7 +884,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) v24->x(),v24->y(),v24->z(), v23->x(),v23->y(),v23->z()); } - else { + else { blHexes.push_back(new MHexahedron(v11,v12,v13,v14,v21,v22,v23,v24)); fprintf(ff2,"SH (%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g){2,2,2,2,2,2,2,2};\n", v11->x(),v11->y(),v11->z(), @@ -896,13 +896,14 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) v23->x(),v23->y(),v23->z(), v24->x(),v24->y(),v24->z()); } - } + } } } else{ - Msg::Error("cannot create 3D BL FAN %d %d -- %d %d %d %d",N1,N2,onWedge1,onWedge1,onCorner1,onCorner2); + Msg::Error("cannot create 3D BL FAN %d %d -- %d %d %d %d", + N1,N2,onWedge1,onWedge1,onCorner1,onCorner2); } - } + } ++ite; } @@ -941,18 +942,18 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) else { // we have a quad face --> create a pyramid - + MElement *e = it->second; - // compute the center of the face; + // compute the center of the face; SPoint3 center (0.25*(it->first.getVertex(0)->x()+it->first.getVertex(1)->x()+it->first.getVertex(2)->x()+it->first.getVertex(3)->x()), 0.25*(it->first.getVertex(0)->y()+it->first.getVertex(1)->y()+it->first.getVertex(2)->y()+it->first.getVertex(3)->y()), 0.25*(it->first.getVertex(0)->z()+it->first.getVertex(1)->z()+it->first.getVertex(2)->z()+it->first.getVertex(3)->z())); - // compute the center of the opposite face; + // compute the center of the opposite face; SPoint3 opposite (0,0,0); int counter=0; for (int i=0;i<e->getNumVertices();i++){ - MVertex *vv = e->getVertex(i); + MVertex *vv = e->getVertex(i); bool found = false; for (int j=0;j<4;j++){ MVertex *ww = it->first.getVertex(j); @@ -972,26 +973,26 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) dir.normalize(); const double eps = D*1.e-2; MVertex *newv = new MVertex (center.x() + eps * dir.x(),center.y() + eps * dir.y(), center.z() + eps * dir.z(), gr); - + MPyramid *pyr = new MPyramid (it->first.getVertex(0),it->first.getVertex(1),it->first.getVertex(2),it->first.getVertex(3),newv); verts.insert(newv); - blPyrs.push_back(pyr); + blPyrs.push_back(pyr); nf->triangles.push_back(new MTriangle (it->first.getVertex(0),it->first.getVertex(1),newv)); nf->triangles.push_back(new MTriangle (it->first.getVertex(1),it->first.getVertex(2),newv)); nf->triangles.push_back(new MTriangle (it->first.getVertex(2),it->first.getVertex(3),newv)); nf->triangles.push_back(new MTriangle (it->first.getVertex(3),it->first.getVertex(0),newv)); - + fprintf(ff,"ST (%g,%g,%g,%g,%g,%g,%g,%g,%g){2,2,2};\n", it->first.getVertex(0)->x(),it->first.getVertex(0)->y(),it->first.getVertex(0)->z(), it->first.getVertex(1)->x(),it->first.getVertex(1)->y(),it->first.getVertex(1)->z(), newv->x(),newv->y(),newv->z()); - + fprintf(ff,"ST (%g,%g,%g,%g,%g,%g,%g,%g,%g){2,2,2};\n", it->first.getVertex(1)->x(),it->first.getVertex(1)->y(),it->first.getVertex(1)->z(), it->first.getVertex(2)->x(),it->first.getVertex(2)->y(),it->first.getVertex(2)->z(), newv->x(),newv->y(),newv->z()); - + fprintf(ff,"ST (%g,%g,%g,%g,%g,%g,%g,%g,%g){2,2,2};\n", it->first.getVertex(2)->x(),it->first.getVertex(2)->y(),it->first.getVertex(2)->z(), it->first.getVertex(3)->x(),it->first.getVertex(3)->y(),it->first.getVertex(3)->z(), @@ -1000,7 +1001,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) it->first.getVertex(3)->x(),it->first.getVertex(3)->y(),it->first.getVertex(3)->z(), it->first.getVertex(0)->x(),it->first.getVertex(0)->y(),it->first.getVertex(0)->z(), newv->x(),newv->y(),newv->z()); - + fprintf(ff,"SQ (%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g){3,3,3,3};\n", it->first.getVertex(0)->x(),it->first.getVertex(0)->y(),it->first.getVertex(0)->z(), it->first.getVertex(1)->x(),it->first.getVertex(1)->y(),it->first.getVertex(1)->z(), @@ -1011,7 +1012,8 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) fprintf(ff,"};\n"); fclose(ff); - printf("discrete face with %d %d elems\n",nf->triangles.size(),nf->quadrangles.size()); + printf("discrete face with %d %d elems\n", (int)nf->triangles.size(), + (int)nf->quadrangles.size()); hop.push_back(nf); for(unsigned int i = 0; i < gr->tetrahedra.size(); i++) delete gr->tetrahedra[i]; @@ -1019,7 +1021,7 @@ static bool modifyInitialMeshForTakingIntoAccountBoundaryLayers(GRegion *gr) gr->set(hop); CreateAnEmptyVolumeMesh(gr); - printf("%d tets\n",gr->tetrahedra.size()); + printf("%d tets\n", (int)gr->tetrahedra.size()); deMeshGFace _kill; _kill (nf); delete nf; @@ -1083,7 +1085,7 @@ bool CreateAnEmptyVolumeMesh(GRegion *gr){ return false; } printf("creating an empty volume mesh done\n"); - TransferTetgenMesh(gr, in, out, numberedV); + TransferTetgenMesh(gr, in, out, numberedV); return true; } @@ -1211,7 +1213,7 @@ void MeshDelaunayVolume(std::vector<GRegion*> ®ions) if(!Filler::get_nbr_new_vertices() && !LpSmoother::get_nbr_interior_vertices()){ insertVerticesInRegion(gr,2000000000,!_BL); } - + //emi test frame field // int NumSmooth = 10;//CTX::instance()->mesh.smoothCrossField // std::cout << "NumSmooth = " << NumSmooth << std::endl; -- GitLab