diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 2cf1873b1d3b26d3b84d9ce83e85d3008fc2e007..dffdfb78049e48dc6fa71a4c1770b58b99c794f5 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -35,11 +35,11 @@ #include "MVertexPositionSet.h" #include "OpenFile.h" #include "CreateFile.h" -#include "meshGFaceOptimize.h" #if defined(HAVE_MESH) #include "Field.h" #include "Generator.h" +#include "meshGFaceOptimize.h" #endif std::vector<GModel*> GModel::list; @@ -1994,9 +1994,6 @@ void GModel::insertRegion(GRegion *r) regions.insert(r); } -// given a set of mesh edges, build GFaces that separate those -// edges. - GEdge *getNewModelEdge(GFace *gf1, GFace *gf2, std::map<std::pair<int, int>, GEdge*> &newEdges) { @@ -2020,6 +2017,8 @@ GEdge *getNewModelEdge(GFace *gf1, GFace *gf2, return it->second; } +#if defined(HAVE_MESH) + void recurClassifyEdges(MTri3 *t, std::map<MTriangle*, GFace*> &reverse, std::map<MLine*, GEdge*, compareMLinePtr> &lines, std::set<MLine*> &touched, std::set<MTri3*> &trisTouched, @@ -2071,8 +2070,11 @@ void recurClassify(MTri3 *t, GFace *gf, } } +#endif + void GModel::detectEdges(double _tresholdAngle) { +#if defined(HAVE_MESH) e2t_cont adj; std::vector<MTriangle*> elements; std::vector<edge_angle> edges_detected, edges_lonly; @@ -2101,10 +2103,12 @@ void GModel::detectEdges(double _tresholdAngle) classifyFaces(_temp); remove(selected); // delete selected; +#endif } void GModel::classifyFaces(std::set<GFace*> &_faces) { +#if defined(HAVE_MESH) std::map<MLine*, GEdge*, compareMLinePtr> lines; for(GModel::eiter it = GModel::current()->firstEdge(); @@ -2314,6 +2318,7 @@ void GModel::classifyFaces(std::set<GFace*> &_faces) else remove(*fit); } +#endif } diff --git a/Geo/MQuadrangle.cpp b/Geo/MQuadrangle.cpp index 733d765819254c213dd8436c9856927339ca7089..13eb65e2cc4487ec3d87ed35b64dbcf6689beb1c 100644 --- a/Geo/MQuadrangle.cpp +++ b/Geo/MQuadrangle.cpp @@ -215,17 +215,12 @@ void MQuadrangle::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) *pts = getGQQPts(pOrder); } -double angle3Points(MVertex *p1, MVertex *p2, MVertex *p3); - -double MQuadrangle::etaShapeMeasure(){ - double a1 = 180 * angle3Points(_v[0], _v[1], _v[2]) / M_PI; - double a2 = 180 * angle3Points(_v[1], _v[2], _v[3]) / M_PI; - double a3 = 180 * angle3Points(_v[2], _v[3], _v[0]) / M_PI; - double a4 = 180 * angle3Points(_v[3], _v[0], _v[1]) / M_PI; - -// if (fabs(a1+a2+a3+a4 - 360) > 1) { -// return -1.0; -// } +double MQuadrangle::etaShapeMeasure() +{ + double a1 = 180 * angle3Vertices(_v[0], _v[1], _v[2]) / M_PI; + double a2 = 180 * angle3Vertices(_v[1], _v[2], _v[3]) / M_PI; + double a3 = 180 * angle3Vertices(_v[2], _v[3], _v[0]) / M_PI; + double a4 = 180 * angle3Vertices(_v[3], _v[0], _v[1]) / M_PI; a1 = std::min(180.,a1); a2 = std::min(180.,a2); @@ -237,10 +232,8 @@ double MQuadrangle::etaShapeMeasure(){ angle = std::max(fabs(90. - a4),angle); return 1.-angle/90; - } - double MQuadrangle::distoShapeMeasure() { #if defined(HAVE_MESH) diff --git a/Geo/MTriangle.cpp b/Geo/MTriangle.cpp index faa771b077489e80612b92cc90fcd4e16907c089..721fa4de2268d4eae79e250f639abf4311cddfd1 100644 --- a/Geo/MTriangle.cpp +++ b/Geo/MTriangle.cpp @@ -56,13 +56,11 @@ double MTriangle::angleShapeMeasure() #endif } -double angle3Points(MVertex *p1, MVertex *p2, MVertex *p3); - double MTriangle::etaShapeMeasure() { - double a1 = 180 * angle3Points(_v[0], _v[1], _v[2]) / M_PI; - double a2 = 180 * angle3Points(_v[1], _v[2], _v[0]) / M_PI; - double a3 = 180 * angle3Points(_v[2], _v[0], _v[1]) / M_PI; + double a1 = 180 * angle3Vertices(_v[0], _v[1], _v[2]) / M_PI; + double a2 = 180 * angle3Vertices(_v[1], _v[2], _v[0]) / M_PI; + double a3 = 180 * angle3Vertices(_v[2], _v[0], _v[1]) / M_PI; double angle = fabs(60. - a1); angle = std::max(fabs(60. - a2),angle); angle = std::max(fabs(60. - a3),angle); diff --git a/Geo/MVertex.cpp b/Geo/MVertex.cpp index 09bdbecd0f95d671d4650a1ac2014ca4516f2393..880d7b8b3f41f7288834335cd2e34b65ec0e7195 100644 --- a/Geo/MVertex.cpp +++ b/Geo/MVertex.cpp @@ -26,6 +26,16 @@ bool MVertexLessThanLexicographic::operator()(const MVertex *v1, const MVertex * return false; } +double angle3Vertices(MVertex *p1, MVertex *p2, MVertex *p3) +{ + SVector3 a(p1->x() - p2->x(), p1->y() - p2->y(), p1->z() - p2->z()); + SVector3 b(p3->x() - p2->x(), p3->y() - p2->y(), p3->z() - p2->z()); + SVector3 c = crossprod(a, b); + double sinA = c.norm(); + double cosA = dot(a, b); + return atan2 (sinA, cosA); +} + MVertex::MVertex(double x, double y, double z, GEntity *ge, int num) : _visible(1), _order(1), _x(x), _y(y), _z(z), _ge(ge) { diff --git a/Geo/MVertex.h b/Geo/MVertex.h index 0921285f941410dadf0d89a521acc99dd6c70d03..9816a4cab0f50889b1662a69b2d6758c883ff8ea 100644 --- a/Geo/MVertex.h +++ b/Geo/MVertex.h @@ -158,4 +158,6 @@ bool reparamMeshVertexOnFace(const MVertex *v, const GFace *gf, SPoint2 ¶m, bool onSurface=true); bool reparamMeshVertexOnEdge(const MVertex *v, const GEdge *ge, double ¶m); +double angle3Vertices(MVertex *p1, MVertex *p2, MVertex *p3); + #endif diff --git a/Mesh/highOrderSmoother.cpp b/Mesh/highOrderSmoother.cpp index b978be5f548f4be9951fdc205e6af7dff02389d4..b673d447fbb1bf0ec31084506dd93f62397a9180 100644 --- a/Mesh/highOrderSmoother.cpp +++ b/Mesh/highOrderSmoother.cpp @@ -40,8 +40,6 @@ static int swapHighOrderTriangles(GFace *gf, edgeContainer&, faceContainer&, static int findOptimalLocationsP2(GFace *gf, highOrderSmoother *s); static int findOptimalLocationsPN(GFace *gf, highOrderSmoother *s); -extern double angle3Points(MVertex *p1, MVertex *p2, MVertex *p3); - static double shapeMeasure(MElement *e) { //const double d1 = e->distoShapeMeasure(); diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index 686a4d1ff961e780a9398ee2d27af058d2c88ae8..b6f5180171a764da358acbff1918193afbc6cc7f 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -30,17 +30,6 @@ extern "C" int perfect_match double *totalzeit) ; #endif -double angle3Points(MVertex *p1, MVertex *p2, MVertex *p3) -{ - SVector3 a(p1->x() - p2->x(), p1->y() - p2->y(), p1->z() - p2->z()); - SVector3 b(p3->x() - p2->x(), p3->y() - p2->y(), p3->z() - p2->z()); - SVector3 c = crossprod(a, b); - double sinA = c.norm(); - double cosA = dot(a, b); - // printf("%d %d %d -> %g %g\n",p1->iD,p2->iD,p3->iD,cosA,sinA); - return atan2 (sinA, cosA); -} - edge_angle::edge_angle(MVertex *_v1, MVertex *_v2, MElement *t1, MElement *t2) : v1(_v1), v2(_v2) { @@ -645,8 +634,8 @@ static int _quadWithOneVertexOnBoundary (GFace *gf, } // do not collapse if it's a corner if (line.size() == 2){ - if (fabs(angle3Points(line[0],v1,line[1]) - M_PI) > 3*M_PI/8.){ - // printf("coucou %g\n",angle3Points(line[0],v1,line[1])*180./M_PI); + if (fabs(angle3Vertices(line[0],v1,line[1]) - M_PI) > 3*M_PI/8.){ + // printf("coucou %g\n",angle3Vertices(line[0],v1,line[1])*180./M_PI); return 0; } } @@ -1277,10 +1266,10 @@ struct RecombineTriangle else if(t2->getVertex(1) != n1 && t2->getVertex(1) != n2) n4 = t2->getVertex(1); else if(t2->getVertex(2) != n1 && t2->getVertex(2) != n2) n4 = t2->getVertex(2); - double a1 = 180 * angle3Points(n1, n4, n2) / M_PI; - double a2 = 180 * angle3Points(n4, n2, n3) / M_PI; - double a3 = 180 * angle3Points(n2, n3, n1) / M_PI; - double a4 = 180 * angle3Points(n3, n1, n4) / M_PI; + double a1 = 180 * angle3Vertices(n1, n4, n2) / M_PI; + double a2 = 180 * angle3Vertices(n4, n2, n3) / M_PI; + double a3 = 180 * angle3Vertices(n2, n3, n1) / M_PI; + double a4 = 180 * angle3Vertices(n3, n1, n4) / M_PI; angle = fabs(90. - a1); angle = std::max(fabs(90. - a2),angle); angle = std::max(fabs(90. - a3),angle); diff --git a/Mesh/meshGFaceQuadrilateralize.cpp b/Mesh/meshGFaceQuadrilateralize.cpp index 5ddd9fae26d0890d43c01a601bce6169444a92da..27865202e794771fc42a66bc1411294789efcb53 100644 --- a/Mesh/meshGFaceQuadrilateralize.cpp +++ b/Mesh/meshGFaceQuadrilateralize.cpp @@ -225,7 +225,7 @@ void edgeFront::initiate() } } -double angle3Points(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3) +static double angle3Points(BDS_Point *p1, BDS_Point *p2, BDS_Point *p3) { SVector3 a(p1->X - p2->X, p1->Y - p2->Y, p1->Z - p2->Z); SVector3 b(p3->X - p2->X, p3->Y - p2->Y, p3->Z - p2->Z);