← Back to team overview

dolfin team mailing list archive

Re: ConstantFunction

 

On Tue, Oct 28, 2008 at 11:20:17AM +0000, Garth N. Wells wrote:
> 
> 
> Anders Logg wrote:
> > On Tue, Oct 28, 2008 at 10:53:01AM +0000, Garth N. Wells wrote:
> >> I started looking at ConstantFunction, and if we keep the old interface 
> >> and let ConstantFunction inherit from Function, it will involve quite a 
> >> lot of code for something rather simple because on the basis of the cell 
> >> type and the rank of the constant, an element needs to be chosen. To 
> >> keep ConstantFunction simple, is it reasonable that a ConstantFunction 
> >> require a FunctionSpace in its constructor? FFC is already generating 
> >> this since it treats constant functions as DG0 elements. This way the 
> >> ConstantFunction code will be really simple.
> >>
> >> Garth
> > 
> > Locally, DG is always a subspace of whatever element space we have so
> > the interpolation of anything constant will be exact, and thus the
> > interpolation of something constant into whatever element space we
> > have will be exactly equal to the interpolation into DG.
> > 
> > So it is no limitation to assume that constant functions are always DG
> > functions. This means we don't need the FunctionSpace argument, but we
> > need to precompile some DG elements.
> >
> 
> My point is that there is a bit code to do all this. We have to check 
> the cell type (so ConstantFunction will need updating when cell types 
> are added), then once the cell type is determined, the right finite 
> element for that cell type and the function rank must be created on the 
> basis of a string. It isn't very attractive from a long-term maintenance 
> point of view. Plus Form already contains the necessary information.
> 
> It would be straightforward if the assembler used the 
> Function::interpolate(...) which provides the FunctionSpace,
> 
>    Function::interpolate(double*, const FunctionSpace&, const ufc::cell&)
> 
> Garth

Sounds good. Let's see if it works. It might lead to complications in
Function.cpp (more if-tests to check if the FunctionSpace is not null
and giving correct error messages otherwise).

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References