← Back to team overview

dolfin team mailing list archive

Re: new dolfin::function

 

Just do the following:

Mesh mesh; Function f;

real* vertex_values = new real[mesh.numVertices()];
f.interpolate(vertex_values);

Then vertex_values will be an array with the values at all vertices.

For a scalar function, you simply get all the vertex values and for a vector (or in general tensor-valued) function, you first get all the values for component 0, then all values for component 1 etc.

/Anders


Alessio Quaglino wrote:
On Tue, Jun 26, 2007 at 02:56:52PM +0200, Alessio Quaglino wrote:
I'm trying to get my code working with the new dolfin 0.7.0-1 but it
seems
there are a several problems. For example, a part of the
dolfin::Function
interface has disappeared. In particular, it is not possible to get the
value corresponding to a vertex or the finite element space where the
function is living. Have these functionalities been moved somewhere
else?

Regards,
Alessio Quaglino
Use Function::interpolate() to access the values. Often, one can
avoid ever needing to access the values directly, but if they should
be needed, then it is possible to either interpolate the Function to a
given Cell (getting the expansion coefficients in the local finite
element basis) or get the values at all vertices.

So, try to avoid accessing the values but if you really need the
values at vertices you can still get them.

/Anders
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev

Ok I see, however with interpolate() I can either get all the Vertex
values or the values at a given Cell. While the latter case is unefficient
for my purpose  because I'd pass through the same Vertex several times, in
the former I get a vector with the values at all vertices but no
information about how to access such a vector.

Regards,
Alessio


_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References