diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 0175dccefb9ca35116f5fc5d87c891054d299ce1..fd3f9a845e5984c5f1b1badc77e0525d6d57e491 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 b22b3ac6e3dad5894a9606dc184f7363e463301f..f459ea4e60ca16671273d2775dc960a8ca8eeec2 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 7880a2b6331bc9d8acd631d279dbf65ee21dde76..bf1daae83a2438208838da039cf1a912ad7f8974 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 d9e5bf8ea7901a98f4e4d766025a4cc47b019011..bc05d3180dc44ba11dd355bf0e78cd3e2847ce69 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 8dd2294907a623ef44d3468f1458d2c754e7c04f..24c6e078861303075c1bc96e96ed9a50d833c2a5 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); }