← Back to team overview

dolfin team mailing list archive

Re: Interpolate coefficients for a sub function

 

On Sat, Dec 27, 2008 at 08:47:45PM +0000, Garth N. Wells wrote:
> 
> 
> Anders Logg wrote:
> > On Sat, Dec 27, 2008 at 03:18:24PM +0000, Garth N. Wells wrote:
> >> Any thoughts on an interpolate function in Function which would 
> >> interpolate coefficients of a sub function only? At the moment, I have a 
> >> solver in which I can't use SpecialFunction::IsOutFlowFacet because the 
> >> velocity is a sub function of the solution Function. I can use 
> >> SubFunction, but SubFunction makes a copy of the vector every time. I 
> >> can think of a number of other examples in which this would be useful.
> >>
> >> An alternative would be to have a variant on a SubFunction which shares 
> >> the vector of the Function it is a part of.
> >>
> >> Garth
> > 
> > Is the copying of values expensive? 
> 
> It's intuitively (to me) not very nice to make a copy of a large part of 
> the solution vector just to decide if a facet is inflow or outflow.

I agree, but I don't know of a (simple) way to fix it interface-wise.
I'm worried it might complicate the design/interface.

> Now that you have added caching of
> > (sub) function spaces, I imagine the copying should be very fast and
> > be only a fraction of the cost for calling IsOutflowFacet::eval() on
> > all cells.
> >
> 
> There is quite a bit of code in IsOutflowFacet::eval(). Does anyone have 
> a feeling for the cost of this?

I haven't measure the performance, but it should be fairly
efficient. If you look closely at it, the only thing that may take
some time is the call

  field->eval(field_values, x.coordinates(), ufc_cell, data.cell().index());

which should be fast (just picking the dofs and evaluating the basis
functions).

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References