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

removed gmshModelGetVertexCoordinates (not necessary) + return parametric...

removed gmshModelGetVertexCoordinates (not necessary) + return parametric coords in gmshModelGetMeshVertices
parent ff0fa898
No related branches found
No related tags found
No related merge requests found
...@@ -278,20 +278,6 @@ GMSH_API gmshModelGetPhysicalName(const int dim, const int tag, ...@@ -278,20 +278,6 @@ GMSH_API gmshModelGetPhysicalName(const int dim, const int tag,
return GMSH_OK; 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, GMSH_API gmshModelGetBoundary(const vector_pair &inDimTags, vector_pair &outDimTags,
const bool combined, const bool oriented, const bool combined, const bool oriented,
const bool recursive) const bool recursive)
...@@ -356,19 +342,24 @@ GMSH_API gmshModelMesh(int dim) ...@@ -356,19 +342,24 @@ GMSH_API gmshModelMesh(int dim)
GMSH_API gmshModelGetMeshVertices(const int dim, const int tag, GMSH_API gmshModelGetMeshVertices(const int dim, const int tag,
std::vector<int> &vertexTags, std::vector<int> &vertexTags,
std::vector<double> &coords) std::vector<double> &coordinates,
std::vector<double> &parametricCoordinates)
{ {
if(!_isInitialized()) return GMSH_ERROR(-1); if(!_isInitialized()) return GMSH_ERROR(-1);
vertexTags.clear(); vertexTags.clear();
coords.clear(); coordinates.clear();
GEntity *ge = GModel::current()->getEntityByTag(dim, tag); GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
if(!ge) return GMSH_ERROR(1); if(!ge) return GMSH_ERROR(1);
for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){ for(unsigned int i = 0; i < ge->mesh_vertices.size(); i++){
MVertex *v = ge->mesh_vertices[i]; MVertex *v = ge->mesh_vertices[i];
vertexTags.push_back(v->getNum()); vertexTags.push_back(v->getNum());
coords.push_back(v->x()); coordinates.push_back(v->x());
coords.push_back(v->y()); coordinates.push_back(v->y());
coords.push_back(v->z()); 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; return GMSH_OK;
} }
......
...@@ -61,8 +61,6 @@ GMSH_API gmshModelSetPhysicalName(const int dim, const int tag, ...@@ -61,8 +61,6 @@ GMSH_API gmshModelSetPhysicalName(const int dim, const int tag,
const std::string &name); const std::string &name);
GMSH_API gmshModelGetPhysicalName(const int dim, const int tag, GMSH_API gmshModelGetPhysicalName(const int dim, const int tag,
std::string &name); 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, GMSH_API gmshModelGetBoundary(const vector_pair &inDimTags, vector_pair &outDimTags,
const bool combined = true, const bool oriented = true, const bool combined = true, const bool oriented = true,
const bool recursive = false); const bool recursive = false);
...@@ -76,7 +74,8 @@ GMSH_API gmshModelRemove(const vector_pair &dimTags, const bool recursive = fals ...@@ -76,7 +74,8 @@ GMSH_API gmshModelRemove(const vector_pair &dimTags, const bool recursive = fals
GMSH_API gmshModelMesh(const int dim); GMSH_API gmshModelMesh(const int dim);
GMSH_API gmshModelGetMeshVertices(const int dim, const int tag, GMSH_API gmshModelGetMeshVertices(const int dim, const int tag,
std::vector<int> &vertexTags, std::vector<int> &vertexTags,
std::vector<double> &coords); std::vector<double> &coordinates,
std::vector<double> &parametricCoordinates);
GMSH_API gmshModelGetMeshElements(const int dim, const int tag, GMSH_API gmshModelGetMeshElements(const int dim, const int tag,
std::vector<int> &types, std::vector<int> &types,
std::vector<std::vector<int> > &elementTags, std::vector<std::vector<int> > &elementTags,
......
...@@ -21,9 +21,9 @@ int main(int argc, char **argv) ...@@ -21,9 +21,9 @@ int main(int argc, char **argv)
// get the mesh vertices for each elementary entity // get the mesh vertices for each elementary entity
std::vector<int> vertexTags; std::vector<int> vertexTags;
std::vector<double> vertexCoords; std::vector<double> vertexCoords, vertexParams;
int dim = entities[i].first, tag = entities[i].second; 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 // get the mesh elements for each elementary entity
std::vector<int> elemTypes; std::vector<int> elemTypes;
......
...@@ -4,7 +4,7 @@ from gmsh import * ...@@ -4,7 +4,7 @@ from gmsh import *
import sys import sys
if len(sys.argv) < 2: if len(sys.argv) < 2:
print "Usage: basic.py file.geo [options]" print "Usage: " + sys.argv[0] + " file.geo [options]"
exit(0) exit(0)
gmshInitialize() gmshInitialize()
...@@ -19,8 +19,8 @@ gmshModelGetEntities(entities) ...@@ -19,8 +19,8 @@ gmshModelGetEntities(entities)
for e in entities: for e in entities:
# get the mesh vertices for each elementary entity # get the mesh vertices for each elementary entity
vertexTags = IntVector() vertexTags = IntVector()
vertexCoords = DoubleVector() vertexCoords = DoubleVector(); vertexParams = DoubleVector()
gmshModelGetMeshVertices(e[0], e[1], vertexTags, vertexCoords) gmshModelGetMeshVertices(e[0], e[1], vertexTags, vertexCoords, vertexParams)
# get the mesh elements for each elementary entity # get the mesh elements for each elementary entity
elemTypes = IntVector() elemTypes = IntVector()
elemTags = IntVectorVector(); elemVertexTags = IntVectorVector() elemTags = IntVectorVector(); elemVertexTags = IntVectorVector()
......
...@@ -4,7 +4,7 @@ from gmsh import * ...@@ -4,7 +4,7 @@ from gmsh import *
import sys import sys
if len(sys.argv) < 2: if len(sys.argv) < 2:
print "Usage: basic.py file.geo [options]" print "Usage: " + sys.argv[0] + " file.geo [options]"
exit(0) exit(0)
gmshInitialize() gmshInitialize()
......
// This file reimplements gmsh/tutorial/t1.geo in C++. For all the elementary // This file reimplements gmsh/tutorial/t1.geo in C++.
// 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++ // For all the elementary explanations about the general philosphy of entities
// API. // 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: // The Gmsh API is entirely defined in the <gmsh.h> header:
#include <gmsh.h> #include <gmsh.h>
......
#!/usr/bin/env python #!/usr/bin/env python
# This file reimplements gmsh/tutorial/t1.geo in Python. For all the elementary # This file reimplements gmsh/tutorial/t1.geo in Python.
# 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. # 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 # The API is entirely defined in the gmsh module
from gmsh import * from gmsh import *
......
...@@ -44,7 +44,7 @@ int main(int argc, char **argv) ...@@ -44,7 +44,7 @@ int main(int argc, char **argv)
// The "Duplicata" functionality in .geo files is handled by // The "Duplicata" functionality in .geo files is handled by
// gmshModelGeoCopy(), which takes a vector of (dim, tag) pairs as input, and // gmshModelGeoCopy(), which takes a vector of (dim, tag) pairs as input, and
// returns another vector of (dim, tag) pairs. // 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); gmshModelGeoCopy({{0, 3}}, ov);
gmshModelGeoTranslate(ov, 0, 0.1, 0); gmshModelGeoTranslate(ov, 0, 0.1, 0);
...@@ -90,6 +90,7 @@ int main(int argc, char **argv) ...@@ -90,6 +90,7 @@ int main(int argc, char **argv)
// Extrusion works as expected, by providing a vector of (dim, tag) pairs as // 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. // 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); gmshModelGeoExtrude({ov[1]}, 0, 0, 0.12, ov2);
// Mesh sizes associated to geometrical points can be set by passing a vector // Mesh sizes associated to geometrical points can be set by passing a vector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment