From 3ed1ab6e7f6f74cda01ef80ee648054fa1f7f8f4 Mon Sep 17 00:00:00 2001 From: Emilie Marchandise <emilie.marchandise@uclouvain.be> Date: Fri, 15 Apr 2011 15:37:22 +0000 Subject: [PATCH] Multiphase + other stuff --- Geo/GEdge.h | 2 ++ Geo/GModel.cpp | 15 +++++++++++++-- Geo/GModel.h | 1 + Geo/discreteEdge.cpp | 9 +++++---- Geo/gmshEdge.cpp | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 0175dccefb..fd3f9a845e 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -159,6 +159,8 @@ class GEdge : public GEntity { // get bounds of parametric coordinate virtual Range<double> parBounds(int i) const = 0; + inline double getLowerBound() const{ return parBounds(0).low();}; + inline double getUpperBound() const{ return parBounds(0).high();}; // return the point on the face closest to the given point virtual GPoint closestPoint(const SPoint3 &queryPoint, double ¶m) const; diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index b22b3ac6e3..f459ea4e60 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -245,8 +245,6 @@ GEdge *GModel::getEdgeByTag(int n) const return 0; } - - GVertex *GModel::getVertexByTag(int n) const { GEntity tmp((GModel*)this, n); @@ -257,6 +255,19 @@ GVertex *GModel::getVertexByTag(int n) const return 0; } +std::vector<int> GModel::getEdgesByStringTag(const std::string tag) +{ + std::vector<int> nums; + std::map<int, std::vector<GEntity*> > physicalGroups[4]; + getPhysicalGroups(physicalGroups); + std::vector<GEntity*> allEdges = physicalGroups[1][this->getPhysicalNumber(1,tag)]; + for ( std::vector<GEntity*>::iterator it = allEdges.begin(); it != allEdges.end(); it++){ + GEntity *ge = *it; + nums.push_back(ge->tag()); + } + + printf("edges size = %d \n", nums.size()); +} void GModel::remove(GRegion *r) { diff --git a/Geo/GModel.h b/Geo/GModel.h index 7880a2b633..bf1daae83a 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -204,6 +204,7 @@ class GModel GFace *getFaceByTag(int n) const; GEdge *getEdgeByTag(int n) const; GVertex *getVertexByTag(int n) const; + std::vector<int> getEdgesByStringTag(const std::string tag); // for python, temporary solution while iterator are not binded std::vector<GRegion*> bindingsGetRegions(); diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp index d9e5bf8ea7..bc05d3180d 100644 --- a/Geo/discreteEdge.cpp +++ b/Geo/discreteEdge.cpp @@ -268,10 +268,11 @@ void discreteEdge::parametrize(std::map<GFace*, std::map<MVertex*, MVertex*, std::map<GRegion*, std::map<MVertex*, MVertex*, std::less<MVertex*> > > ®ion2Vert) { - for (unsigned int i = 0; i < lines.size() + 1; i++){ - _pars.push_back(i); + if (_pars.empty()){ + for (unsigned int i = 0; i < lines.size() + 1; i++){ + _pars.push_back(i); + } } - //Replace MVertex by MedgeVertex std::map<MVertex*, MVertex*, std::less<MVertex*> > old2new; old2new.clear(); @@ -397,7 +398,7 @@ void discreteEdge::computeNormals () const bool discreteEdge::getLocalParameter(const double &t, int &iLine, double &tLoc) const { - if(_pars.empty()) return false; + for (iLine = 0; iLine < (int)lines.size(); iLine++){ double tmin = _pars[iLine]; double tmax = _pars[iLine+1]; diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp index 8dd2294907..24c6e07886 100644 --- a/Geo/gmshEdge.cpp +++ b/Geo/gmshEdge.cpp @@ -36,6 +36,7 @@ Range<double> gmshEdge::parBounds(int i) const GPoint gmshEdge::point(double par) const { + Vertex a = InterpolateCurve(c, par, 0); return GPoint(a.Pos.X, a.Pos.Y, a.Pos.Z, this, par); } @@ -48,7 +49,7 @@ SVector3 gmshEdge::firstDer(double par) const SVector3 gmshEdge::secondDer(double par) const { - // printf("coucou mon chou\n"); + Vertex a = InterpolateCurve(c, par, 2); return SVector3(a.Pos.X, a.Pos.Y, a.Pos.Z); } -- GitLab