← Back to team overview

dolfin team mailing list archive

Re: assemble in Python

 

On Wed, Dec 12, 2007 at 09:20:12AM +0100, Ola Skavhaug wrote:
> Anders Logg skrev den 11/12-2007 følgende:
> > On Tue, Dec 11, 2007 at 02:58:58PM +0000, Garth N. Wells wrote:
> > > 
> > > 
> > > Ola Skavhaug wrote:
> > > > Hi,
> > > > 
> > > > I'm trying to assemble dolfin/FFC forms into a user given matrix format
> > > > CRSNew, which inherits GenericTensor as it should. However, the assemble.py in
> > > > src/python in dolfin does not allow this.
> > > >
> > > 
> > > assembly.py has rather limited functionality compared to 
> > > dolfin::assemble. Does assembly into CRSNew using c++ work?.
> > 
> > Yes, assemble() in PyDOLFIN currently assumes that you give it an FFC
> > form and a Mesh. It then calls the JIT compiler on the form and then
> > calls the wrapped C++ assembler on the generated UFC code.
> > 
> > Does it work if you use cpp_assemble() instead of assemble()?
> > 
> > We should try and extend assemble() in Python so it can recognize
> > various combinations of input arguments (an FFC form or a UFC etc).
> > 
> > The assemble() function is just a few lines of code and it's defined
> > in assemble.py in src/pydolfin/.
> 
> I have made assembler more general now. There are still some difficulties
> regarding the type information across the user defined linear algebra backend
> (CRS in PyCC) and dolfin, but I don't think this will be too hard to fix.
> 
> A central question is what to send to assemble from Python. I vote for sending
> a factory, since the rank of the assembled tensor is defined by the form (and
> hence should not be given as input by the user).

Shouldn't assemble() in Python return a matrix instead of having it as
an argument?

    A = assemble(v*u*dx, mesh, ...)

If a special type of matrix is wanted, either assemble can take a
matrix factory as an optional argument or there can be a global
parameter that controls the linear algebra backend.

-- 
Anders


References