dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #07358
Re: DiscreteFunction::interpolate vs UFC interpolate_vertex_values definition
On Thu, Apr 10, 2008 at 07:07:25PM +0200, Ola Skavhaug wrote:
> Martin Sandve Alnæs skrev den 10/04-2008 følgende:
> > 2008/4/10, Ola Skavhaug <skavhaug@xxxxxxxxx>:
> > > Anders Logg skrev den 10/04-2008 følgende:
> > >
> > > > 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?
> > >
> > >
> > > Sure. You update stuff, I'll make it work with Viper later.
> > >
> > >
> > > Ola
> >
> > What does VTK expect?
>
> In general, it is described here:
> www.vtk.org/pdf/file-formats.pdf
>
> Ola
Do you do anything with the values you get from u.interpolate() (which
I assume you use) before sending the array to VTK?
Would changing the order mean you have to copy and reorder the values,
or do you do that already?
--
Anders
Follow ups
References