From 27605b397736abb79954db739cfdbbe8868d4f5c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 15 Nov 2017 21:36:47 +0100 Subject: [PATCH] couple of missing clear() + const --- Common/gmsh.cpp | 12 +++++++++--- Common/gmsh.i | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp index 1496b4b638..d7c7b5c317 100644 --- a/Common/gmsh.cpp +++ b/Common/gmsh.cpp @@ -228,6 +228,7 @@ int gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag, std::vector<int> &tags) { if(!isInitialized()) return -1; + tags.clear(); std::map<int, std::vector<GEntity*> > groups; GModel::current()->getPhysicalGroups(dim, groups); std::map<int, std::vector<GEntity*> >::iterator it = groups.find(tag); @@ -330,6 +331,8 @@ int gmshModelGetMeshVertices(const int dim, const int tag, std::vector<double> &coords) { if(!isInitialized()) return -1; + vertexTags.clear(); + coords.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) return 1; for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){ @@ -343,7 +346,7 @@ int gmshModelGetMeshVertices(const int dim, const int tag, } template<class T> -static void addElementInfo(std::vector<T*> &ele, +static void addElementInfo(const std::vector<T*> &ele, std::vector<int> &elementType, std::vector<std::vector<int> > &elementTags, std::vector<std::vector<int> > &vertexTags) @@ -365,6 +368,9 @@ int gmshModelGetMeshElements(const int dim, const int tag, std::vector<int> &typ std::vector<std::vector<int> > &vertexTags) { if(!isInitialized()) return -1; + types.clear(); + elementTags.clear(); + vertexTags.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) return 1; switch(dim){ @@ -1130,7 +1136,7 @@ int gmshModelOccBooleanUnion(const int tag, const vector_pair &objectDimTags, int gmshModelOccBooleanIntersection(const int tag, const vector_pair &objectDimTags, const vector_pair &toolDimTags, vector_pair &outDimTags, - std::vector<vector_pair > &outDimTagsMap, + std::vector<vector_pair> &outDimTagsMap, const bool removeObject, const bool removeTool) { if(!isInitialized()) return -1; @@ -1145,7 +1151,7 @@ int gmshModelOccBooleanIntersection(const int tag, const vector_pair &objectDimT int gmshModelOccBooleanDifference(const int tag, const vector_pair &objectDimTags, const vector_pair &toolDimTags, vector_pair &outDimTags, - std::vector<vector_pair > &outDimTagsMap, + std::vector<vector_pair> &outDimTagsMap, const bool removeObject, const bool removeTool) { if(!isInitialized()) return -1; diff --git a/Common/gmsh.i b/Common/gmsh.i index d6a320814f..eb6be8270f 100644 --- a/Common/gmsh.i +++ b/Common/gmsh.i @@ -19,6 +19,7 @@ %template() std::pair<int, int>; %template(IntVector) std::vector<int>; +%template(IntVectorVector) std::vector<std::vector<int> >; %template(DoubleVector) std::vector<double>; %template(StringVector) std::vector<std::string>; %template(PairVector) std::vector<std::pair<int, int> >; -- GitLab