← Back to team overview

dolfin team mailing list archive

Re: assemble 3D tensor with entries of a trilinear form

 

On Tue, Dec 11, 2007 at 06:27:07PM +0100, Anne Voigt wrote:
> I want to calculate  a 3D Tensor which is build with the help of a
> trilinear form. I think that I can assemble this tensor with the help of
> Dolfin assemble.h
> The problem is that all examples in Dolfin (e.g. MassMatrix or
> StiffnessMatrix) are with matrices (assembled with the help of a
> bilinear form) and not with tensors (assembled with the help of
> trilinear forms). I think it must be possible to assemble a tensor
> instead a matrix because the definition in assemble.h is really general
> (there they use GenericTensor for the assembled A).
> So is there anybody who tried to program something similar or may be
> knows how I must declare A so that I can assemble it with help of
> assemple.h???
> Thanks for your help
> Anne

The DOLFIN assembler can assemble tensors of arbitrary rank. The same
function is used to assemble scalars, vectors and matrices so yes, it
can be used to assemble trilinear forms as well.

However, we only have backends/concrete implementations of the
GenericTensor interface for scalars, vectors and matrices so
assembling trilinear forms is something that works only in principle,
not in practice.

What you need to do is to implement a subclass of GenericTensor for
storing a rank 3 tensor (or a general rank tensor). In particular, you
need to implement the function

  void add(const real* block,
           const uint* num_rows, const uint * const * rows) = 0;

which adds a block of values to the tensor.

-- 
Anders


References