From 81bfdf67afb5060bb3e3f0c897333a51d4a5d25c Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Thu, 22 Aug 2013 08:49:41 +0000 Subject: [PATCH] move python-only functions to gmshGeo.i --- Geo/GModel.cpp | 20 -------------------- Geo/GModel.h | 7 ------- Mesh/CenterlineField.cpp | 4 ++-- wrappers/gmshpy/gmshGeo.i | 22 ++++++++++++++++++++++ 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index afaab071ee..6f9d178ae1 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -243,26 +243,6 @@ bool GModel::empty() const return vertices.empty() && edges.empty() && faces.empty() && regions.empty(); } -std::vector<GRegion*> GModel::bindingsGetRegions() -{ - return std::vector<GRegion*> (regions.begin(), regions.end()); -} - -std::vector<GFace*> GModel::bindingsGetFaces() -{ - return std::vector<GFace*> (faces.begin(), faces.end()); -} - -std::vector<GEdge*> GModel::bindingsGetEdges() -{ - return std::vector<GEdge*> (edges.begin(), edges.end()); -} - -std::vector<GVertex*> GModel::bindingsGetVertices() -{ - return std::vector<GVertex*> (vertices.begin(), vertices.end()); -} - GRegion *GModel::getRegionByTag(int n) const { GEntity tmp((GModel*)this, n); diff --git a/Geo/GModel.h b/Geo/GModel.h index 001a5913f7..51a83c6411 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -273,13 +273,6 @@ class GModel 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(); - std::vector<GFace*> bindingsGetFaces(); - std::vector<GEdge*> bindingsGetEdges(); - std::vector<GVertex*> bindingsGetVertices(); - - // add/remove an entity in the model void add(GRegion *r) { regions.insert(r); } void add(GFace *f) { faces.insert(f); } diff --git a/Mesh/CenterlineField.cpp b/Mesh/CenterlineField.cpp index 152e5db5e8..259bc3f153 100644 --- a/Mesh/CenterlineField.cpp +++ b/Mesh/CenterlineField.cpp @@ -369,7 +369,7 @@ Centerline::~Centerline() void Centerline::importFile(std::string fileName) { current = GModel::current(); - std::vector<GFace*> currentFaces = current->bindingsGetFaces(); + std::vector<GFace*> currentFaces(current->firstFace(), current->lastFace()); for (unsigned int i = 0; i < currentFaces.size(); i++){ GFace *gf = currentFaces[i]; if (gf->geomType() == GEntity::DiscreteSurface){ @@ -395,7 +395,7 @@ void Centerline::importFile(std::string fileName) current->setVisibility(1); int maxN = 0.0; - std::vector<GEdge*> modEdges = mod->bindingsGetEdges(); + std::vector<GEdge*> modEdges(mod->firstEdge(), mod->lastEdge()); MVertex *vin = modEdges[0]->lines[0]->getVertex(0); ptin = SPoint3(vin->x(), vin->y(), vin->z()); for (unsigned int i = 0; i < modEdges.size(); i++){ diff --git a/wrappers/gmshpy/gmshGeo.i b/wrappers/gmshpy/gmshGeo.i index eaf5b4c910..a44493370a 100644 --- a/wrappers/gmshpy/gmshGeo.i +++ b/wrappers/gmshpy/gmshGeo.i @@ -114,4 +114,26 @@ namespace std { } return elements; } + + std::vector<GRegion*> bindingsGetRegions() + { + return std::vector<GRegion*> ($self->firstRegion(), $self->lastRegion()); + } + + std::vector<GFace*> bindingsGetFaces() + { + return std::vector<GFace*> ($self->firstFace(), $self->lastFace()); + } + + std::vector<GEdge*> bindingsGetEdges() + { + return std::vector<GEdge*> ($self->firstEdge(), $self->lastEdge()); + } + + std::vector<GVertex*> bindingsGetVertices() + { + return std::vector<GVertex*> ($self->firstVertex(), $self->lastVertex()); + } + } + -- GitLab