← Back to team overview

dolfin team mailing list archive

Re: Getting Function values and vertex coordinates

 

On Friday September 2 2011 16:38:55 Garth N. Wells wrote:
> It would be useful if we could get coordinates of vertices and function
> values at each vertex in a handy object. This could be used in plotting
> programs like Matplotlib. Are there any tricks already implemented to do
> this? with iterating over a Mesh?

coordinates are retreived by:
  
  coord = func.mesh().coordinates()

and function values at vertices can retrieved by:

  values = np.zeros(coord.shape[1])
  func.compute_vertex_values(values, func.mesh())

We could make this a little bit more convinient from the Python side, by 
optionally constructing the value array on the fly and using the mesh from the 
function as a default.

Johan

> Garth
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp


References