← Back to team overview

ufl team mailing list archive

Re: Fwd: FiniteElement classes

 

On Sat, Mar 15, 2008 at 11:46:23AM +0100, Martin Sandve Alnæs wrote:
> Sorry, missed the list.
> 
> ---------- Forwarded message ----------
> From: Martin Sandve Alnæs <martinal@xxxxxxxxx>
> Date: 15.mar.2008 11:45
> Subject: Re: [UFL-dev] FiniteElement classes
> To: Marie Rognes <meg@xxxxxxxxxxx>
> 
> 
> 2008/3/15, Marie Rognes <meg@xxxxxxxxxxx>:
> 
> > Martin Sandve Alnæs wrote:
>  >  > 2008/3/14, Anders Logg <logg@xxxxxxxxx>:
>  >  >
>  >  >> On Thu, Mar 13, 2008 at 05:46:03PM -0400, Marie Rognes wrote:
>  >  >>
>  >  > '>  > Just a comment: I typically want to write something like
>  >  >
>  >  >>  >
>  >  >>  >     VectorElement("Nedelec", ...)
>  >  >>  >
>  >  >>  > in order to have a vector of Nedelec elements...!
>  >  >>
>  >  >
>  >  > So, does that represent a tensor field?
>  >
>  >
>  > For instance, yes.
>  >
>  >
>  >  > I've implemented value_rank()
>  >  > in the VectorElement and TensorElement that way, so the value rank of
>  >  > a VectorElement is the value rank of the subelement (Nedelec) plus
>  >  > one. Thus each row of the tensor is represented by a Nedelec element.
>  >  >
>  >  > If you want a set of vector elements instead:
>  >  >   fe = FiniteElement("Nedelec",...)
>  >  >   me = MixedElement(fe, fe, fe)
>  >  >   # or
>  >  >   me = fe+fe+fe
>  >  > should also work. The value rank of a MixedElement constructed one of
>  >  > these ways is undefined, since Functions should be defined over its
>  >  > subelements anyway.
>  >  >
>  >  >
>  >
>  >
>  > I'm sure this works well. It is just a matter of philosophy in the
>  >  naming, I guess. A VectorElement could either represent a vector field
>  >  or a vector of elements... To me, the latter is the most intuitive, but
>  >  that's probably just because that's what I'm used to ;)
> 
> 
> The way I've implemented value_rank() now, VectorElement represents a
>  vector of elements which combines into a single field, while
>  MixedElement is "only" a list of elements where the element fields are
>  distinct.

Sounds good to me.

-- 
Anders


>  The reason value_rank() is important, is that UFL does consistency
>  checking as early as possible to give good user feedback. It should be
>  very difficult to construct an expression that doesn't make sense and
>  get away with it.
> 
>  --
> 
> Martin
> 
> 


References