From d8433e005b210b8f12a98ddf03fd9f2f354566b3 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 25 Feb 2017 17:30:19 +0000 Subject: [PATCH] don't use internal GEO data in the field --- Mesh/Field.cpp | 43 +++++++++++++++---------------------------- Plugin/FaultZone.cpp | 2 +- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp index 79ee1ef00f..915c42c50b 100644 --- a/Mesh/Field.cpp +++ b/Mesh/Field.cpp @@ -19,15 +19,16 @@ #include "GmshConfig.h" #include "Context.h" #include "Field.h" -#include "Geo.h" -#include "GeoInterpolation.h" #include "GModel.h" +#include "GModelIO_GEO.h" #include "GmshMessage.h" #include "Numeric.h" #include "mathEvaluator.h" #include "BackgroundMeshTools.h" #include "STensor3.h" #include "meshMetric.h" +#include "ExtrudeParams.h" + #if defined(HAVE_POST) #include "PView.h" #include "OctreePost.h" @@ -1858,6 +1859,8 @@ class AttractorAnisoCurveField : public Field { (lMinNormal, "Minimum mesh size in the direction normal to the closest curve."); options["lMaxNormal"] = new FieldOptionDouble (lMaxNormal, "Maximum mesh size in the direction normal to the closest curve."); + // make sure all internal GEO CAD data has been synced with GModel + GModel::current()->getGEOInternals()->synchronize(GModel::current()); } virtual bool isotropic () const {return false;} ~AttractorAnisoCurveField() @@ -1893,38 +1896,22 @@ class AttractorAnisoCurveField : public Field { int k = 0; for(std::list<int>::iterator it = edges_id.begin(); it != edges_id.end(); ++it) { - Curve *c = FindCurve(*it); - if(c) { + GEdge *e = GModel::current()->getEdgeByTag(*it); + if(e) { for(int i = 1; i < n_nodes_by_edge - 1; i++) { double u = (double)i / (n_nodes_by_edge - 1); - Vertex V = InterpolateCurve(c, u, 0); - zeronodes[k][0] = V.Pos.X; - zeronodes[k][1] = V.Pos.Y; - zeronodes[k][2] = V.Pos.Z; - Vertex V2 = InterpolateCurve(c, u, 1); - tg[k] = SVector3(V2.Pos.X, V2.Pos.Y, V2.Pos.Z); + Range<double> b = e->parBounds(0); + double t = b.low() + u * (b.high() - b.low()); + GPoint gp = e->point(t); + SVector3 d = e->firstDer(t); + zeronodes[k][0] = gp.x(); + zeronodes[k][1] = gp.y(); + zeronodes[k][2] = gp.z(); + tg[k] = d; tg[k].normalize(); k++; } } - else { - GEdge *e = GModel::current()->getEdgeByTag(*it); - if(e) { - for(int i = 1; i < n_nodes_by_edge - 1; i++) { - double u = (double)i / (n_nodes_by_edge - 1); - Range<double> b = e->parBounds(0); - double t = b.low() + u * (b.high() - b.low()); - GPoint gp = e->point(t); - SVector3 d = e->firstDer(t); - zeronodes[k][0] = gp.x(); - zeronodes[k][1] = gp.y(); - zeronodes[k][2] = gp.z(); - tg[k] = d; - tg[k].normalize(); - k++; - } - } - } } kdtree = new ANNkd_tree(zeronodes, totpoints, 3); update_needed = false; diff --git a/Plugin/FaultZone.cpp b/Plugin/FaultZone.cpp index d980a9af91..6d834f9e9f 100644 --- a/Plugin/FaultZone.cpp +++ b/Plugin/FaultZone.cpp @@ -104,7 +104,7 @@ PView *GMSH_FaultZonePlugin::execute(PView *view) return view; } - std::list< GEdge* > embeddedEdges = gFace->embeddedEdges(); + std::list<GEdge*> embeddedEdges = gFace->embeddedEdges(); std::list<GEdge*>::const_iterator itl; for(itl = embeddedEdges.begin();itl != embeddedEdges.end(); ++itl) if ((*itl)->length() != 0) break; -- GitLab