← Back to team overview

dolfin team mailing list archive

Re: Re: [DOLFIN-dev] Dimension d in elasticity module

 

On Fri, Oct 07, 2005 at 05:23:32PM +0200, Garth N. Wells wrote:

> Quoting Anders Logg <logg@xxxxxxxxx>:
> 
> > On Fri, Oct 07, 2005 at 04:58:10PM +0200, Garth N. Wells wrote:
> > 
> > > Knowing the tensor rank and dimension of each field of a mixed formulation
> > would
> > > be useful for extracting "subfunctions".
> > 
> > You can access the list of elements that compose a mixed element
> > through the member variable elements:
> > 
> > e0 = FiniteElement(...)
> > e1 = FiniteElement(...)
> > 
> > element = e0 + e1
> > 
> > rank_0 = element.elements[0].rank()
> > rank_1 = element.elements[1].rank()
> > 
> > But maybe you mean that you need this is information to be included in
> > the generated code so it can be accessed in DOLFIN? We could do that,
> > and it would make it possible to implement some more advanced
> > functionality for the Function class in DOLFIN, like slicing out
> > subfunctions:
> > 
> > Function w(...);
> > Function u(w, 0, 2); // Components 0-1
> > Function p(w, 2);    // Component 2
> > 
> 
> This is exactly what I was thinking. It's now possible to take slices out of
> vectors (without making a copy), so I now need to know how many components an
> element has, etc. Also, it would be good to extract the relevant trial
> functions. For example,
> 
> BilinearForm a;
> FiniteElement element0 = a.trial(0);
> FiniteElement element1 = a.trial(1);

ok, I'll put it on my TODO list. It's an easy fix, but it relates to
how the class files generated by FFC should be organized (class and
namespace nesting to make SWIG happy), so we probably need to clear
that up first. I made a previous post a couple of days ago on this
topic. Any suggestions are welcome. If someone wants to experiment,
just edit the file src/ffc/format/dolfin.py that controls the output
format for DOLFIN.

/Anders



References