[dune-fem] LocalFunctionAdapter

Martin Nolte nolte at mathematik.uni-freiburg.de
Fri Jun 5 15:00:20 CEST 2015


Hi Macro,

first of all, thank you very much for integrating the information into the 
documentation. Few people bother to update it.

As for your AnalyticalFunctionAdapter: I have such a thing myself (called 
SimpleGridFunction), so I do think it is useful (especially when used on a 
lambda expression).

It should, however, be remembered that such a simple grid function tends to be 
slow. Consider the following lambda:

[ &u ] ( const Entity &e, const DomainType &x )
{
   RangeType v;
   u.localFunction( entity ).evaluate( x, v );
   return v;
}

Here, for each evaluation the degrees of freedom of the discrete function u must 
be fetched from the global DofVector. Therefore, we have to ask whether this is 
the correct concept.

Personally, like the simplicity and, being aware of the performance pitfall, I 
do not use it in performance critical sections. But for initialization, 
data-i/o, or plain testing this is a great tool.

But: Using a LocalFunctionAdapter is not so much code, either. And this class 
does not automatically suffer from a performance impact.

Best,

Martin



On 06/05/2015 02:24 PM, Agnese, Marco wrote:
> Hi Andreas,
> to recap the class LocalAnalyticalFunction which I implemented simply store a reference to a C++ function
>
> RangeType f(const DomainType& x,const double& t,const EntityType& entity)
> {
>   //do stuff
> }
>
> and add all the necessary types/methods in such a way you can pass it to the LocalFunctionAdpater to obtain a GridFunction.
>
> I would like to add a class AnalyticalFunctionAdapter do Dune-Fem that takes a C++ function and return a GridFunction (using the aforementioned LocalAnalyticalFunction and LocalFunctionAdapter).
>
> In this way would be very handy for everybody to transform the c++ fucntion f into a GridFunction.
>
> Cheers,
> Marco.
> _______________________________________________
> dune-fem mailing list
> dune-fem at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-fem
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the dune-fem mailing list