← Back to team overview

dolfin team mailing list archive

Re: assemebling process for a trilinearform

 

On Sun, Jan 20, 2008 at 11:49:57AM +0100, Anne Voigt wrote:
> -----Ursprüngliche Nachricht-----
> Von: Ola Skavhaug [mailto:skavhaug@xxxxxxxxx] 
> Gesendet: Freitag, 18. Januar 2008 23:53
> An: Anne Voigt; dolfin-dev@xxxxxxxxxx
> Betreff: Re: [DOLFIN-dev] assemebling process for a trilinearform
> 
> Anders Logg skrev den 18/01-2008 følgende:
> > On Fri, Jan 18, 2008 at 03:56:46PM +0100, Anne Voigt wrote:
> > > I just wanted to ask if there is any progress with the assembling
> > > process of a trilinearform.
> > > As a little reminder, here is what I wrote in December:
> > > I have the following problem. I defined a trilinearform with the help of
> > > FFC. Now I wanted to write the results into a 3D tensor which is
> > > assembled with the help of assemble.h . What I already did I implemented
> > > a subclass of GenericTensor called Tensor. But unfortunately I am still
> > > not able to assemble such a tenor. The reason is
> > > SparsityPatternBuilder.cpp which is not implemented for problems >2D:
> > > 
> > >  void SparsityPatternBuilder::build(SparsityPattern& sparsity_pattern,
> > >  Mesh& mesh,
> > >                     UFC& ufc)
> > >  {
> > >    if (ufc.form.rank() == 0)
> > >      scalarBuild(sparsity_pattern);
> > >     else if (ufc.form.rank() == 1)
> > >      vectorBuild(sparsity_pattern, ufc);
> > >    else if (ufc.form.rank() == 2)
> > >     matrixBuild(sparsity_pattern, mesh, ufc);
> > >    else
> > >      error("Cannot compute sparsity patterm for size > 2.");
> > >  }
> > >  
> > > I know that you all are very busy that's why I would be already pleased
> > > if you would be able to tell how much longer I may have to wait?!
> > > 
> > > Thanks for your help
> > > Anne
> > > 
> > > _______________________________________________
> > > DOLFIN-dev mailing list
> > > DOLFIN-dev@xxxxxxxxxx
> > > http://www.fenics.org/mailman/listinfo/dolfin-dev
> > 
> > We're working on this. The hangup right now is to solve a problem
> > related to circular dependencies between matrix classes and matrix
> > factories (in particular for uBLAS where things are templated).
> > 
> > We may have found a solution today (in particular Martin who has a
> > black belt in templates). Ola, did it work?
> 
> Sure, it did. I have to compile DOLFIN using PETSc for all the part to
> fit together. I'll probably commit early next week.
> 
> Ola
>  
> 
> Great news!!! Thanks to all of you. Now I can go ahead with my final
> thesis!!! :-)
> 
> Anne

ok, it might be fixed now. Try and see if you can make it work.

What we've done (mostly Ola and Martin) is that we have added a method
factory() to the interfaces. These should for each backend return a
factory that knows how to create vectors and matrices, and sparsity
patterns for that backend.

What you need to do to assemble into your own tensor is to implement
your own tensor class (subclass of GenericTensor), your own factory
(subclass of LinearAlgebraFactory) and your own sparsity pattern
(subclass of GenericSparsityPattern).

The assembler will ask your tensor to return a factory and then it
will ask that factory to create a sparsity pattern. Before assembling
into your tensor, it will iterate over the elements and let you build
the sparsity pattern. Depending on how you have implemented your
tensor class, you may or may not want to actually build the sparsity
pattern.

See if it works.

-- 
Anders


References