← Back to team overview

dolfin team mailing list archive

Re: new Function design

 

On Tue, Oct 21, 2008 at 10:52:24PM +0200, Martin Sandve Alnæs wrote:
> 2008/10/21 Garth N. Wells <gnw20@xxxxxxxxx>:
> >
> >
> > Anders Logg wrote:
> >> On Tue, Oct 21, 2008 at 04:45:01PM +0100, Garth N. Wells wrote:
> >>> I have a few questions and thoughts regarding the new Function design
> >>>
> >>> * It's not clear to me what the intention is with user-defined
> >>> functions. The functions Function::interpolate(...) never call eval(..),
> >>> so they can't pick up user-defined values. Should Function::interpolate
> >>> test for the presence of a GenericVector to decide whether or not the
> >>> Function is discrete or user-defined?
> >>
> >> Yes, sorry. I've missed this. I'll fix it.
> >>
> >>> * It would be useful to declare user-defined functions without
> >>> associating a FunctionSpace. If we want to interpolate the function, a
> >>> FunctionSpace must then be provided. Anyone see any problems with this?
> >>
> >> The reasoning here is that all Functions must always be associated
> >> with a FunctionSpace so that they may be correctly interpreted in
> >> forms and correctly plotted. When a Function is created in PyDOLFIN,
> >> it must always be associated with a certain FiniteElement (and in a
> >> while FunctionSpace). It would simplify the handling of Functions if
> >> they are always associated with a FunctionSpace.
> >>
> >>
> >
> > Something else to think about is that user-defined functions don't have
> > a dof map, so we need can't initialise a FunctionSpace with the present
> > FunctionSpace constructors.
> >
> > Garth
> 
> A sidenote: If a FunctionSpace is always needed to create a
> Function, and this must match the FunctionSpace for a coefficient
> when assembling, then a ConstantFunction can't be used as
> coefficient to non-DG0 form arguments.

We could require that a ConstantFunction takes a FunctionSpace
argument in the constructor. If not provided, a default one will be
chosen (DG).

-- 
Anders


> I agree that the requirement that userfunctions have a FunctionSpace
> seems very strict. Seems to me it also forces a tighter coupling of
> application components.
> 

Attachment: signature.asc
Description: Digital signature


References