← Back to team overview

dolfin team mailing list archive

Re: DiscreteFunction::interpolate vs UFC interpolate_vertex_values definition

 

On Thu, Apr 10, 2008 at 06:19:59PM +0200, Martin Sandve Alnæs wrote:
> I've been debugging some boundary condition trouble with the
> syfi/pydolfin combination and vector elements, and narrowed it down to
> the interpolate function which is used prior to plotting.
> 
> The bug is in the assumed numbering of the vertex_values array as
> returned by ufc::finite_element::interpolate_vertex_values:
> 
> void DiscreteFunction::interpolate(real* values) const
> {
> ...
> 
>     // Copy values to array of vertex values
>     for (VertexIterator vertex(*cell); !vertex.end(); ++vertex)
>       for (uint i = 0; i < scratch->size; ++i)
>         values[i*mesh.numVertices() + vertex->index()] =
> vertex_values[i*num_cell_vertices + vertex.pos()];
> 
> 
> By the UFC definition this should've been:
> 
> vertex_values[vertex.pos()*scratch->size + i];
> 
> i.e. the vector components are collected together in memory for each
> vertex. This bug must be mirrored in FFC, and should be fixed both
> places at once.
> 
> I'll let someone with write access to FFC and DOLFIN fix it.

Then should we also change the order Viper expects to receive the
values?

It would be good to have the same order everywhere.

-- 
Anders


Follow ups

References