← Back to team overview

dolfin team mailing list archive

Re: assemebling process for a trilinearform

 

On Tue, Jan 22, 2008 at 03:05:45PM +0100, Anne Voigt wrote:
> Thank you for the fast answer.
> 
> Am Dienstag, den 22.01.2008, 11:38 +0100 schrieb Anders Logg:
> > On Tue, Jan 22, 2008 at 11:09:27AM +0100, Anne Voigt wrote:
> > > 
> > > Thank you. I now try to write my own Tensor by deriving from the
> > > GenericTensor class. Could you write me some information about the interface? 
> > > Especially what the parameters of the function
> > > GenericTensor::get(..) and GenericTensor::set(..) are? It is not clear
> > > for me and I cannot find a documentation about it. 
> > > 
> > > Regards,
> > > Anne
> > 
> >   virtual void set(const real* block,
> >                    const uint* num_rows,
> >                    const uint* const * rows) = 0;
> > 
> > block is an array with values to be set
> > 
> > num_rows is an array of length rank()
> > 
> > num_rows[i] is the number of "rows" to be set for axis i
> > 
> > rows[i] is an array with the "rows" to be set for axis i
> > 
> > the length of the array block is num_rows[0]*num_rows[1]*...
> > 
> > For a matrix (rank = 2), the values will be set according to
> > 
> >   for (int i = 0; i < num_rows[0]; ++i)
> >     for (int j = 0; j < num_rows[1]; ++j)
> >       A[rows[i], rows[j]] = block[i*num_rows[1] + j];
> 
> When I understood it correctly, the last line should be:
> 
> A[rows[0][i], rows[1][j]] = block[i*num_rows[1] + j];
> 
> Is this correct or did I a mistake?

Correct, my mistake.

-- 
Anders


> > For a rank 3 tensor, you have three loops etc.
> > 
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References