After loading a mesh (.XML format), how may I extract the vertex coordinates and values without suffering interpolation errors.
This seems to work, I just want to be sure the values are direct, and not interpolated.
mesh = Mesh(meshFileName);
V = FunctionSpace(mesh);
x = Function(V, xFileName);
std::size_t count = mesh.num_vertices();
std::vector<double> vertex_values(count);
x.compute_vertex_values ( vertex_values ) ;
for(std::size_t i = 0; i < count; i++)
{
double X = mesh.geometry().point(i).x();
double Y = mesh.geometry().point(i).y();
double f = vertex_values[i];
// I store the point / value in a list (sort of a cache)
}
I then refine the mesh, and interpolate a function onto x again, where I use cached values of x from the load so I don't have to recalculate the function for the points already known (x is an expensive function).
My concern came with reading compute_vertex_values
void Function::compute_vertex_values(std::vector<double>& vertex_values,
const Mesh& mesh) const
{
// ....
element.interpolate_vertex_values(&cell_vertex_values[0],
&coefficients[0],
cell_orientation,
ufc_cell);
// ...
}