# How to Obtain the Coordinates of the Vertices of a Mesh with P2 and Higher Elements

Asked by
Ted Kord

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.

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(

Could someone please help with this.

Thank you.

Ted

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Garth Wells

- Solved:

- Last query:

- Last reply:

## This question was reopened

- by Ted Kord

To post a message you must log in.