Skip to content
Snippets Groups Projects
Commit 27605b39 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

couple of missing clear() + const

parent b9ee8c67
Branches
Tags
No related merge requests found
...@@ -228,6 +228,7 @@ int gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag, ...@@ -228,6 +228,7 @@ int gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag,
std::vector<int> &tags) std::vector<int> &tags)
{ {
if(!isInitialized()) return -1; if(!isInitialized()) return -1;
tags.clear();
std::map<int, std::vector<GEntity*> > groups; std::map<int, std::vector<GEntity*> > groups;
GModel::current()->getPhysicalGroups(dim, groups); GModel::current()->getPhysicalGroups(dim, groups);
std::map<int, std::vector<GEntity*> >::iterator it = groups.find(tag); std::map<int, std::vector<GEntity*> >::iterator it = groups.find(tag);
...@@ -330,6 +331,8 @@ int gmshModelGetMeshVertices(const int dim, const int tag, ...@@ -330,6 +331,8 @@ int gmshModelGetMeshVertices(const int dim, const int tag,
std::vector<double> &coords) std::vector<double> &coords)
{ {
if(!isInitialized()) return -1; if(!isInitialized()) return -1;
vertexTags.clear();
coords.clear();
GEntity *ge = GModel::current()->getEntityByTag(dim, tag); GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
if(!ge) return 1; if(!ge) return 1;
for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){ for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){
...@@ -343,7 +346,7 @@ int gmshModelGetMeshVertices(const int dim, const int tag, ...@@ -343,7 +346,7 @@ int gmshModelGetMeshVertices(const int dim, const int tag,
} }
template<class T> template<class T>
static void addElementInfo(std::vector<T*> &ele, static void addElementInfo(const std::vector<T*> &ele,
std::vector<int> &elementType, std::vector<int> &elementType,
std::vector<std::vector<int> > &elementTags, std::vector<std::vector<int> > &elementTags,
std::vector<std::vector<int> > &vertexTags) std::vector<std::vector<int> > &vertexTags)
...@@ -365,6 +368,9 @@ int gmshModelGetMeshElements(const int dim, const int tag, std::vector<int> &typ ...@@ -365,6 +368,9 @@ int gmshModelGetMeshElements(const int dim, const int tag, std::vector<int> &typ
std::vector<std::vector<int> > &vertexTags) std::vector<std::vector<int> > &vertexTags)
{ {
if(!isInitialized()) return -1; if(!isInitialized()) return -1;
types.clear();
elementTags.clear();
vertexTags.clear();
GEntity *ge = GModel::current()->getEntityByTag(dim, tag); GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
if(!ge) return 1; if(!ge) return 1;
switch(dim){ switch(dim){
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
%template() std::pair<int, int>; %template() std::pair<int, int>;
%template(IntVector) std::vector<int>; %template(IntVector) std::vector<int>;
%template(IntVectorVector) std::vector<std::vector<int> >;
%template(DoubleVector) std::vector<double>; %template(DoubleVector) std::vector<double>;
%template(StringVector) std::vector<std::string>; %template(StringVector) std::vector<std::string>;
%template(PairVector) std::vector<std::pair<int, int> >; %template(PairVector) std::vector<std::pair<int, int> >;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment