Commit 8ad8115d authored by Christophe Geuzaine's avatar Christophe Geuzaine

example for getElementProperties

parent dc1cf042
......@@ -50,7 +50,7 @@ def compute_size_field(vertices, triangles, err, N):
return triangle_max_edge(x)/ri
print ("Usage: adapt_mesh [intial lc] [target #elements] [dump files]")
print("Usage: adapt_mesh [intial lc] [target #elements] [dump files]")
lc = 0.02;
N = 10000;
......
......@@ -32,16 +32,20 @@ int main(int argc, char **argv)
int numElem = 0;
for(unsigned int i = 0; i < elemTags.size(); i++)
numElem += elemTags[i].size();
std::cout << vertexTags.size() << " mesh vertices and "
<< numElem << " mesh elements on entity ("
<< dim << "," << tag << ")\n";
for(unsigned int i = 0; i < elemTypes.size(); i++){
std::string name;
int d, order, numv;
std::vector<double> param;
gmsh::model::mesh::getElementProperties(elemTypes[i], name, d, order, numv, param);
std::cout << "found " << name << " on entity (" << dim << "," << tag << ")\n";
std::cout << " - Element type: " << name << ", order " << order << "\n";
std::cout << " with " << numv << " vertices in param coord: (";
for(unsigned int j = 0; j < param.size(); j++)
std::cout << param[j] << " ";
std::cout << ")\n";
}
std::cout << vertexTags.size() << " mesh vertices and "
<< numElem << " mesh elements on entity ("
<< dim << "," << tag << ")\n";
}
gmsh::finalize();
......
......@@ -19,11 +19,12 @@ for e in entities:
elemTypes, elemTags, elemVertexTags = gmsh.model.mesh.getElements(e[0], e[1])
# report some statistics
numElem = sum(len(i) for i in elemTags)
for t in elemTypes:
name, dim, order, numv, _ = gmsh.model.mesh.getElementProperties(t)
print "found " + name + " on entity " + str(e)
print str(len(vertexTags)) + " mesh vertices " + str(numElem),\
print str(len(vertexTags)) + " mesh vertices and " + str(numElem),\
"mesh elements on entity " + str(e)
for t in elemTypes:
name, dim, order, numv, parv = gmsh.model.mesh.getElementProperties(t)
print " - Element type: " + name + ", order " + str(order)
print " with " + str(numv) + " vertices in param coord: ", parv
# all mesh vertex coordinates
vertexTags, vertexCoords, _ = gmsh.model.mesh.getVertices()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment