From 9a60bcb12905cef189b1c844f5a2e6051f951bbf Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 15 Oct 2010 13:33:09 +0000 Subject: [PATCH] fix compile w/out mesh module --- Geo/GModel.cpp | 13 +++++++++---- Geo/MQuadrangle.cpp | 19 ++++++------------- Geo/MTriangle.cpp | 8 +++----- Geo/MVertex.cpp | 10 ++++++++++ Geo/MVertex.h | 2 ++ Mesh/highOrderSmoother.cpp | 2 -- Mesh/meshGFaceOptimize.cpp | 23 ++++++----------------- Mesh/meshGFaceQuadrilateralize.cpp | 2 +- 8 files changed, 37 insertions(+), 42 deletions(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 2cf1873b1d..dffdfb7804 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 733d765819..13eb65e2cc 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 faa771b077..721fa4de22 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 09bdbecd0f..880d7b8b3f 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 0921285f94..9816a4cab0 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 b978be5f54..b673d447fb 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 686a4d1ff9..b6f5180171 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 5ddd9fae26..27865202e7 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); -- GitLab