[dune-fem] LocalFunctionAdapter
Andreas Dedner
a.s.dedner at warwick.ac.uk
Fri Jun 5 15:56:18 CEST 2015
Sorry about the confusion - I forgot the name change to
GridFunctionAdapter.
Martin already mentioned the performance issue - depending on
the space getting a local function is not that cheap. Having the
lambda option with global functions is nice and I would like to see
that integrated in dune-fem.
Best
Andreas
On 05/06/15 14:00, Martin Nolte wrote:
> 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
>>
>
More information about the dune-fem
mailing list