diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp index b76aaba8c4bc6deb73fef2f79398937c89240686..2b751cddce6c98d9b668a771d7cf38d27746b4b3 100644 --- a/Common/gmsh.cpp +++ b/Common/gmsh.cpp @@ -2466,7 +2466,7 @@ GMSH_API void gmsh::model::mesh::embed(const int dim, GMSH_API void gmsh::model::mesh::reorderElements(const int elementType, const int tag, - const std::vector<int> &ordering) + const std::vector<std::size_t> &ordering) { if(!_isInitialized()) { throw -1; diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 3981b3a01f12c3542120b3e683fb3c7e561205a6..cab74ff675d1330f8cb371a58a2c5ba0f6462171 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -769,16 +769,16 @@ void GEdge::mesh(bool verbose) #endif } -bool GEdge::reorder(const int elementType, const std::vector<int> &ordering) +bool GEdge::reorder(const int elementType, const std::vector<std::size_t> &ordering) { if(lines.size() != 0) { if(lines.front()->getTypeForMSH() != elementType) { return false; } if(ordering.size() != lines.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(lines.size())) return false; + if(*it < 0 || *it >= lines.size()) return false; } std::vector<MLine *> newLinesOrder(lines.size()); diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 9c263b44a9fc4a99636ca89a30680ab1ef0bb122..ddbb7c6248d6fae69cac4a5705dc6d1e3ea84b29 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -244,7 +244,7 @@ public: SPoint3 closestPoint(SPoint3 &p, double tolerance); virtual void mesh(bool verbose); - virtual bool reorder(const int elementType, const std::vector<int> &ordering); + virtual bool reorder(const int elementType, const std::vector<std::size_t> &ordering); }; #endif diff --git a/Geo/GEntity.h b/Geo/GEntity.h index 5609ea954a7960137473a4df762f5ef31a2469d4..414ce38fcdd318a6e04750080e31b37688ecd100 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -405,7 +405,7 @@ public: std::map<MVertex *, MVertex *> correspondingHOPoints; // reorder the mesh elements of the given type, according to ordering - virtual bool reorder(const int elementType, const std::vector<int> &ordering) + virtual bool reorder(const int elementType, const std::vector<std::size_t> &ordering) { return false; } diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index dc2deca72deabe6f3761f7ab71cb9a2ec18a6897..428ada1af9b035cff82ade665f055b812d1d6c01 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -2046,15 +2046,15 @@ void GFace::removeElement(int type, MElement *e) } } -bool GFace::reorder(const int elementType, const std::vector<int> &ordering) +bool GFace::reorder(const int elementType, const std::vector<std::size_t> &ordering) { if(triangles.size() != 0) { if(triangles.front()->getTypeForMSH() == elementType) { if(ordering.size() != triangles.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(triangles.size())) return false; + if(*it < 0 || *it >= triangles.size()) return false; } std::vector<MTriangle *> newTrianglesOrder(triangles.size()); @@ -2075,9 +2075,9 @@ bool GFace::reorder(const int elementType, const std::vector<int> &ordering) if(quadrangles.front()->getTypeForMSH() == elementType) { if(ordering.size() != quadrangles.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(quadrangles.size())) return false; + if(*it < 0 || *it >= quadrangles.size()) return false; } std::vector<MQuadrangle *> newQuadranglesOrder(quadrangles.size()); @@ -2098,9 +2098,9 @@ bool GFace::reorder(const int elementType, const std::vector<int> &ordering) if(polygons.front()->getTypeForMSH() == elementType) { if(ordering.size() != polygons.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(polygons.size())) return false; + if(*it < 0 || *it >= polygons.size()) return false; } std::vector<MPolygon *> newPolygonsOrder(polygons.size()); diff --git a/Geo/GFace.h b/Geo/GFace.h index f0df2245883c0742323dba1e9af2730d1bb362a8..2b90807bf601340763ccd5614f2cc8b6e7a9e5af 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -363,7 +363,7 @@ public: std::vector<SVector3> storage3; // sizes and directions storage std::vector<double> storage4; // sizes and directions storage - virtual bool reorder(const int elementType, const std::vector<int> &ordering); + virtual bool reorder(const int elementType, const std::vector<std::size_t> &ordering); }; #endif diff --git a/Geo/GRegion.cpp b/Geo/GRegion.cpp index a45659932fda01133a29b42758f6d17084543e18..5a0e6d136f42159d5a90b078da23b39984e061c1 100644 --- a/Geo/GRegion.cpp +++ b/Geo/GRegion.cpp @@ -591,15 +591,15 @@ void GRegion::removeElement(int type, MElement *e) } } -bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) +bool GRegion::reorder(const int elementType, const std::vector<std::size_t> &ordering) { if(tetrahedra.size() != 0) { if(tetrahedra.front()->getTypeForMSH() == elementType) { if(ordering.size() != tetrahedra.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(tetrahedra.size())) return false; + if(*it < 0 || *it >= tetrahedra.size()) return false; } std::vector<MTetrahedron *> newTetrahedraOrder(tetrahedra.size()); @@ -620,9 +620,9 @@ bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) if(hexahedra.front()->getTypeForMSH() == elementType) { if(ordering.size() != hexahedra.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(hexahedra.size())) return false; + if(*it < 0 || *it >= hexahedra.size()) return false; } std::vector<MHexahedron *> newHexahedraOrder(hexahedra.size()); @@ -643,9 +643,9 @@ bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) if(prisms.front()->getTypeForMSH() == elementType) { if(ordering.size() != prisms.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(prisms.size())) return false; + if(*it < 0 || *it >= prisms.size()) return false; } std::vector<MPrism *> newPrismsOrder(prisms.size()); @@ -666,9 +666,9 @@ bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) if(pyramids.front()->getTypeForMSH() == elementType) { if(ordering.size() != pyramids.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(pyramids.size())) return false; + if(*it < 0 || *it >= pyramids.size()) return false; } std::vector<MPyramid *> newPyramidsOrder(pyramids.size()); @@ -689,9 +689,9 @@ bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) if(polyhedra.front()->getTypeForMSH() == elementType) { if(ordering.size() != polyhedra.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(polyhedra.size())) return false; + if(*it < 0 || *it >= polyhedra.size()) return false; } std::vector<MPolyhedron *> newPolyhedraOrder(polyhedra.size()); @@ -712,9 +712,9 @@ bool GRegion::reorder(const int elementType, const std::vector<int> &ordering) if(trihedra.front()->getTypeForMSH() == elementType) { if(ordering.size() != trihedra.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(trihedra.size())) return false; + if(*it < 0 || *it >= trihedra.size()) return false; } std::vector<MTrihedron *> newTrihedraOrder(trihedra.size()); diff --git a/Geo/GRegion.h b/Geo/GRegion.h index d121b835de7d942b8a1ea4ffc3bf4fc0eda0ceb3..41475b84e077bcd9bddb9b0c66cc4b2eefcc497b 100644 --- a/Geo/GRegion.h +++ b/Geo/GRegion.h @@ -164,7 +164,7 @@ public: // get the boundary layer columns BoundaryLayerColumns *getColumns() { return &_columns; } - virtual bool reorder(const int elementType, const std::vector<int> &ordering); + virtual bool reorder(const int elementType, const std::vector<std::size_t> &ordering); // set the reverseMesh constraint in the bounding surfaces so that the // boundary mesh has outward pointing normals, based on the STL triangulation diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index 976975cc5ae62803f6932271ba70154e3812d5ed..58e1d9dedb5c4fa469cf58561d820c80fc6bbff7 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -180,15 +180,15 @@ void GVertex::removeElement(int type, MElement *e) } } -bool GVertex::reorder(const int elementType, const std::vector<int> &ordering) +bool GVertex::reorder(const int elementType, const std::vector<std::size_t> &ordering) { if(points.size() != 0) { if(points.front()->getTypeForMSH() == elementType) { if(ordering.size() != points.size()) return false; - for(std::vector<int>::const_iterator it = ordering.begin(); + for(std::vector<std::size_t>::const_iterator it = ordering.begin(); it != ordering.end(); ++it) { - if(*it < 0 || *it >= static_cast<int>(points.size())) return false; + if(*it < 0 || *it >= points.size()) return false; } std::vector<MPoint *> newPointsOrder(points.size()); diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 8d03df9e0f8ab43a203ee7edfe23b7d4611796ab..1b2f32b9583f6b2a94c3169666dda5de6a81f815 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -106,7 +106,7 @@ public: void addElement(int type, MElement *e); void removeElement(int type, MElement *e); - virtual bool reorder(const int elementType, const std::vector<int> &ordering); + virtual bool reorder(const int elementType, const std::vector<std::size_t> &ordering); }; #endif diff --git a/api/gen.py b/api/gen.py index 80c3a00ef4510a45554b902c881405bea2d34f4b..e1c6f8451d843a88488d721a5b81c86e70b9ef7d 100644 --- a/api/gen.py +++ b/api/gen.py @@ -305,7 +305,7 @@ doc = '''Embed the geometrical entities of dimension `dim' and tags `tags' in th mesh.add('embed',doc,None,iint('dim'),ivectorint('tags'),iint('inDim'),iint('inTag')) doc = '''Reorder the elements of type `elementType' classified on the entity of tag `tag' according to `ordering'.''' -mesh.add('reorderElements',doc,None,iint('elementType'),iint('tag'),ivectorint('ordering')) +mesh.add('reorderElements',doc,None,iint('elementType'),iint('tag'),ivectorsize('ordering')) doc = '''Renumber the node tags in a contiunous sequence.''' mesh.add('renumberNodes',doc,None) diff --git a/api/gmsh.h b/api/gmsh.h index 2105880f269343052c7df9600abecdbe9fa79e6e..763f24d4a7c0bc6cce222ee5e550bf65a8c58883 100644 --- a/api/gmsh.h +++ b/api/gmsh.h @@ -707,7 +707,7 @@ namespace gmsh { // Top-level functions // `tag' according to `ordering'. GMSH_API void reorderElements(const int elementType, const int tag, - const std::vector<int> & ordering); + const std::vector<std::size_t> & ordering); // Renumber the node tags in a contiunous sequence. GMSH_API void renumberNodes(); diff --git a/api/gmsh.h_cwrap b/api/gmsh.h_cwrap index 5cb5f4f84b54b00386b277c13aa79e6fdc0a48ab..23b118b22a64a8e85f7cbb96988c240f9b0f2f1b 100644 --- a/api/gmsh.h_cwrap +++ b/api/gmsh.h_cwrap @@ -1326,10 +1326,10 @@ namespace gmsh { // Top-level functions // `tag' according to `ordering'. GMSH_API void reorderElements(const int elementType, const int tag, - const std::vector<int> & ordering) + const std::vector<std::size_t> & ordering) { int ierr = 0; - int *api_ordering_; size_t api_ordering_n_; vector2ptr(ordering, &api_ordering_, &api_ordering_n_); + size_t *api_ordering_; size_t api_ordering_n_; vector2ptr(ordering, &api_ordering_, &api_ordering_n_); gmshModelMeshReorderElements(elementType, tag, api_ordering_, api_ordering_n_, &ierr); if(ierr) throw ierr; gmshFree(api_ordering_); diff --git a/api/gmsh.jl b/api/gmsh.jl index a6f0f5bc5ddb697dc5cfef394b1837052bdff17b..e1fba4e5b6eb54042283759431294f42825ef406 100644 --- a/api/gmsh.jl +++ b/api/gmsh.jl @@ -1701,8 +1701,8 @@ according to `ordering`. function reorderElements(elementType, tag, ordering) ierr = Ref{Cint}() ccall((:gmshModelMeshReorderElements, gmsh.lib), Nothing, - (Cint, Cint, Ptr{Cint}, Csize_t, Ptr{Cint}), - elementType, tag, convert(Vector{Cint}, ordering), length(ordering), ierr) + (Cint, Cint, Ptr{Csize_t}, Csize_t, Ptr{Cint}), + elementType, tag, convert(Vector{Csize_t}, ordering), length(ordering), ierr) ierr[] != 0 && error("gmshModelMeshReorderElements returned non-zero error code: $(ierr[])") return nothing end diff --git a/api/gmsh.py b/api/gmsh.py index d1d8cad778b1b7e87b4048edca7dced658dc7283..ddc4453d19d88ccea5b07f428f1999c61cfcb824 100644 --- a/api/gmsh.py +++ b/api/gmsh.py @@ -2028,7 +2028,7 @@ class model: Reorder the elements of type `elementType' classified on the entity of tag `tag' according to `ordering'. """ - api_ordering_, api_ordering_n_ = _ivectorint(ordering) + api_ordering_, api_ordering_n_ = _ivectorsize(ordering) ierr = c_int() lib.gmshModelMeshReorderElements( c_int(elementType), diff --git a/api/gmshc.cpp b/api/gmshc.cpp index 3d4cfb04f45f05a35b2e931875a9c606a34e3e89..82e03483b4f12a781d696c8c2cbfbebbf862b376 100644 --- a/api/gmshc.cpp +++ b/api/gmshc.cpp @@ -1150,11 +1150,11 @@ GMSH_API void gmshModelMeshEmbed(const int dim, int * tags, size_t tags_n, const } } -GMSH_API void gmshModelMeshReorderElements(const int elementType, const int tag, int * ordering, size_t ordering_n, int * ierr) +GMSH_API void gmshModelMeshReorderElements(const int elementType, const int tag, size_t * ordering, size_t ordering_n, int * ierr) { if(ierr) *ierr = 0; try { - std::vector<int> api_ordering_(ordering, ordering + ordering_n); + std::vector<std::size_t> api_ordering_(ordering, ordering + ordering_n); gmsh::model::mesh::reorderElements(elementType, tag, api_ordering_); } catch(int api_ierr_){ diff --git a/api/gmshc.h b/api/gmshc.h index 7b43fb74708438913fa1d393fa497547aaf15a53..db4c55ef5b38eeaade4bc2dd83648a413dfd6867 100644 --- a/api/gmshc.h +++ b/api/gmshc.h @@ -760,7 +760,7 @@ GMSH_API void gmshModelMeshEmbed(const int dim, * `tag' according to `ordering'. */ GMSH_API void gmshModelMeshReorderElements(const int elementType, const int tag, - int * ordering, size_t ordering_n, + size_t * ordering, size_t ordering_n, int * ierr); /* Renumber the node tags in a contiunous sequence. */