← Back to team overview

dolfin team mailing list archive

[Question #97807]: How to Obtain the Coordinates of the Vertices of a Mesh with P2 and Higher Elements

 

New question #97807 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/97807

Hello

How do I get the vertex coordinates for a mesh with P2 elements? For a P1 mesh, this works fine:

for (VertexIterator vertex(mesh); !vertex.end(); ++vertex) {
	 xy = new Array<double>(dim, geometry.x(vertex->index()));
	 x0 = (*xy)[0]; x1 = (*xy)[1];
	 std::cout << i << "(" << x0 << ", " << x1 << ")" << std::endl;
	 ++i;
}

It doesn't work for a P2 mesh though.

Some parts of my code which depend on knowing the vertex coordinates ultimately fail with the following error (P2 and above only):

         Assertion failed: (V.dofmap().global_dimension() <= x.size()), function Function, file dolfin/function/Function.cpp, line 62.

Could someone please help with this.

Thank you.

Ted



-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups