dune-pdelab
2.7-git
|
A frequent example of pointwise operations on GridFunctions is calculating error norms (e.g. analytical vs numerical solution). Here we take the squared difference of two functions. However, the same approach applies to any operation.
First, let's define some grid functions for testing.
Now, we can either plug them into an existing adapter (itself a GridFunction) computing the difference squared
or define it ourselves. Here we use the per-element evaluation interface receiving an element and local coordinates on the reference element.
We can use the resulting GridFunctions as always, e.g. integrate them:
Full example code: recipe-grid-function-operations.cc