diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp index 5e197788cc28731bd5bd0fa76e97fa7326b3bd25..55770ef6c9acc79c95b4d4cfdde99b6b488dbc07 100644 --- a/Common/gmsh.cpp +++ b/Common/gmsh.cpp @@ -278,20 +278,6 @@ GMSH_API gmshModelGetPhysicalName(const int dim, const int tag, return GMSH_OK; } -GMSH_API gmshModelGetVertexCoordinates(const int tag, double &x, double &y, - double &z) -{ - if(!_isInitialized()) return GMSH_ERROR(-1); - GVertex *gv = GModel::current()->getVertexByTag(tag); - if(gv){ - x = gv->x(); - y = gv->y(); - z = gv->z(); - return GMSH_OK; - } - return GMSH_ERROR(1); -} - GMSH_API gmshModelGetBoundary(const vector_pair &inDimTags, vector_pair &outDimTags, const bool combined, const bool oriented, const bool recursive) @@ -356,19 +342,24 @@ GMSH_API gmshModelMesh(int dim) GMSH_API gmshModelGetMeshVertices(const int dim, const int tag, std::vector<int> &vertexTags, - std::vector<double> &coords) + std::vector<double> &coordinates, + std::vector<double> ¶metricCoordinates) { if(!_isInitialized()) return GMSH_ERROR(-1); vertexTags.clear(); - coords.clear(); + coordinates.clear(); GEntity *ge = GModel::current()->getEntityByTag(dim, tag); if(!ge) return GMSH_ERROR(1); for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){ MVertex *v = ge->mesh_vertices[i]; vertexTags.push_back(v->getNum()); - coords.push_back(v->x()); - coords.push_back(v->y()); - coords.push_back(v->z()); + coordinates.push_back(v->x()); + coordinates.push_back(v->y()); + coordinates.push_back(v->z()); + double par; + for(int j = 0; j < dim; j++){ + if(v->getParameter(j, par)) parametricCoordinates.push_back(par); + } } return GMSH_OK; } diff --git a/Common/gmsh.h b/Common/gmsh.h index ece85a799e6ed62d50d784853da9bf98da63b86c..f023ab6d83766d4de7db3c7f3e47c485c6a64865 100644 --- a/Common/gmsh.h +++ b/Common/gmsh.h @@ -61,8 +61,6 @@ GMSH_API gmshModelSetPhysicalName(const int dim, const int tag, const std::string &name); GMSH_API gmshModelGetPhysicalName(const int dim, const int tag, std::string &name); -GMSH_API gmshModelGetVertexCoordinates(const int tag, double &x, double &y, - double &z); GMSH_API gmshModelGetBoundary(const vector_pair &inDimTags, vector_pair &outDimTags, const bool combined = true, const bool oriented = true, const bool recursive = false); @@ -76,7 +74,8 @@ GMSH_API gmshModelRemove(const vector_pair &dimTags, const bool recursive = fals GMSH_API gmshModelMesh(const int dim); GMSH_API gmshModelGetMeshVertices(const int dim, const int tag, std::vector<int> &vertexTags, - std::vector<double> &coords); + std::vector<double> &coordinates, + std::vector<double> ¶metricCoordinates); GMSH_API gmshModelGetMeshElements(const int dim, const int tag, std::vector<int> &types, std::vector<std::vector<int> > &elementTags, diff --git a/demos/api/explore.cpp b/demos/api/explore.cpp index 6b068c895e3bc02419173465ca7ac24c5f6a308a..24e7a760f5a6fbbf76e56cec7eec46f9651551cc 100644 --- a/demos/api/explore.cpp +++ b/demos/api/explore.cpp @@ -21,9 +21,9 @@ int main(int argc, char **argv) // get the mesh vertices for each elementary entity std::vector<int> vertexTags; - std::vector<double> vertexCoords; + std::vector<double> vertexCoords, vertexParams; int dim = entities[i].first, tag = entities[i].second; - gmshModelGetMeshVertices(dim, tag, vertexTags, vertexCoords); + gmshModelGetMeshVertices(dim, tag, vertexTags, vertexCoords, vertexParams); // get the mesh elements for each elementary entity std::vector<int> elemTypes; diff --git a/demos/api/explore.py b/demos/api/explore.py index 5bec30b80c2702f1d1f7ba55f95d4795d5a7b89f..a817fb07c3a23233e474960ea1717ca758efae9b 100644 --- a/demos/api/explore.py +++ b/demos/api/explore.py @@ -4,7 +4,7 @@ from gmsh import * import sys if len(sys.argv) < 2: - print "Usage: basic.py file.geo [options]" + print "Usage: " + sys.argv[0] + " file.geo [options]" exit(0) gmshInitialize() @@ -19,8 +19,8 @@ gmshModelGetEntities(entities) for e in entities: # get the mesh vertices for each elementary entity vertexTags = IntVector() - vertexCoords = DoubleVector() - gmshModelGetMeshVertices(e[0], e[1], vertexTags, vertexCoords) + vertexCoords = DoubleVector(); vertexParams = DoubleVector() + gmshModelGetMeshVertices(e[0], e[1], vertexTags, vertexCoords, vertexParams) # get the mesh elements for each elementary entity elemTypes = IntVector() elemTags = IntVectorVector(); elemVertexTags = IntVectorVector() diff --git a/demos/api/open.py b/demos/api/open.py index 968d905f784f3813c7f43e6a05eda0bcf434eda3..4f09a068f2c47915a3805fc20f7b594f64880627 100644 --- a/demos/api/open.py +++ b/demos/api/open.py @@ -4,7 +4,7 @@ from gmsh import * import sys if len(sys.argv) < 2: - print "Usage: basic.py file.geo [options]" + print "Usage: " + sys.argv[0] + " file.geo [options]" exit(0) gmshInitialize() diff --git a/demos/api/t1.cpp b/demos/api/t1.cpp index 522b7ee2f45081b70e78dec6c8569ab8616f93fd..1d5f3f23e0f74455cb698c70e0045764159b0577 100644 --- a/demos/api/t1.cpp +++ b/demos/api/t1.cpp @@ -1,7 +1,8 @@ -// This file reimplements gmsh/tutorial/t1.geo in C++. For all the elementary -// explanations about the general philosphy of entities in Gmsh, see the -// comments in the .geo file. Comments here focus on the specifics of the C++ -// API. +// This file reimplements gmsh/tutorial/t1.geo in C++. + +// For all the elementary explanations about the general philosphy of entities +// in Gmsh, see the comments in the .geo file. Comments here focus on the +// specifics of the C++ API. // The Gmsh API is entirely defined in the <gmsh.h> header: #include <gmsh.h> diff --git a/demos/api/t1.py b/demos/api/t1.py index 532a0d8899108df441c17e7f93eaa1a0f7fda18d..dc8a5940eb90cf7c41d04815d80e10bcdd7d92d1 100644 --- a/demos/api/t1.py +++ b/demos/api/t1.py @@ -1,8 +1,10 @@ #!/usr/bin/env python -# This file reimplements gmsh/tutorial/t1.geo in Python. For all the elementary -# explanations about the general philosphy of entities in Gmsh, see the comments -# in the .geo file. Comments here focus on the specifics of the Python API. +# This file reimplements gmsh/tutorial/t1.geo in Python. + +# For all the elementary explanations about the general philosphy of entities in +# Gmsh, see the comments in the .geo file. Comments here focus on the specifics +# of the Python API. # The API is entirely defined in the gmsh module from gmsh import * diff --git a/demos/api/t2.cpp b/demos/api/t2.cpp index b60e48a6cac0fdae6ff36dca1eae262a52dde482..f7e60ab0c7bc57e95523c78fa577a0740d2fdee4 100644 --- a/demos/api/t2.cpp +++ b/demos/api/t2.cpp @@ -44,7 +44,7 @@ int main(int argc, char **argv) // The "Duplicata" functionality in .geo files is handled by // gmshModelGeoCopy(), which takes a vector of (dim, tag) pairs as input, and // returns another vector of (dim, tag) pairs. - std::vector<std::pair<int, int> > ov, ov2; + std::vector<std::pair<int, int> > ov; gmshModelGeoCopy({{0, 3}}, ov); gmshModelGeoTranslate(ov, 0, 0.1, 0); @@ -90,6 +90,7 @@ int main(int argc, char **argv) // Extrusion works as expected, by providing a vector of (dim, tag) pairs as // input, the translation vector, and a vector of (dim, tag) pairs as output. + std::vector<std::pair<int, int> > ov2; gmshModelGeoExtrude({ov[1]}, 0, 0, 0.12, ov2); // Mesh sizes associated to geometrical points can be set by passing a vector