← Back to team overview

ffc team mailing list archive

Re: [HG FFC] Delete a lot of old stuff.

 

On Tue, Apr 21, 2009 at 10:24:25AM +0200, Kristian Oelgaard wrote:
> Quoting Anders Logg <logg@xxxxxxxxx>:
> 
> > I've made a first attempt to remove the old stuff. It mostly works but
> > there were some problems I couldn't figure out for the quadrature
> > representation.
> >
> > The MixedPoisson demo fails for quadrature with the following error:
> >
> >   File
> >
> >
> "/usr/lib/python2.5/site-packages/ffc/compiler/codegeneration/quadrature/uflquadraturegenerator_utils.py",
> > line 842, in __create_mapping_basis
> >     name, non_zeros, zeros, ones = self.name_map[name]
> > KeyError: 'FE0_C3'
> >
> > Any clues what goes wrong?
> 
> Yes, after some digging I discovered that it's because someone has changed
> 
> if ffc_element.value_mapping(component) == Mapping.AFFINE:
> to
> if ffc_element.space_mapping(component) == Mapping.AFFINE:
> 
> in many places.

Yes, that was me.

> However, value_mapping produces the following error now:
> 
>   File "/home/oelgaard/fenics/clone/ffc/ffc/fem/mixedelement.py", line 81, in
> value_mapping
>     i = Index(component)
> NameError: global name 'Index' is not defined
> 
> This is probably because Index has been removed from FFC? So we should use
> space_mapping?

Yes, value_mapping is replaced by space_mapping since value_mapping
depends on the old Index class.

I made the replacement the code above and it seemed to work for most
examples with quadrature. The tensor representation has used
space_mapping for a while.

> The problem is that for:
> 
> BDM = FiniteElement("Brezzi-Douglas-Marini", triangle, q)
> DG  = FiniteElement("Discontinuous Lagrange", triangle, q - 1)
> 
> mixed_element = BDM + DG
> 
> (tau, w) = TestFunctions(mixed_element)
> (sigma, u) = TrialFunctions(mixed_element)
> 
> a = w*u*dx
> 
> The FFC element for the mixed basis function is:
> Mixed finite element: [FiniteElement('Brezzi-Douglas-Marini', 'triangle', 1),
> FiniteElement('Discontinuous Lagrange', 'triangle', 0)]
> 
> But when trying to get the mapping for component 2 (the DG element)
> 
> ffc_element.space_mapping(2) =  1
> 
> which is not equal to Mapping.AFFINE = 0
> 
> Is there a simple way of fixing this using space_mapping, or should we fix the
> value_mapping?

I forgot how I handled this for the tensor representation, but when I
look now I haven't used space_mapping at all. One should instead call

  def component_element(self, component):
      "Return sub element and offset for given component."

For the above example with component = 2 this should return a tuple

  (sub_element, offset)

where sub_element is the DG element and offset is 2.

To get the mapping you can then call sub_element.mapping().

Will this work?

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References