Implement vector valued unknowns by extending the indexing functions
For higher order finite elements or e.g. DG1 discretizations, we need vector values unknowns on the discretized domain.
Currently this is implemented (but not tested and most likely not functional!) by template parameters (ValueType
) that could theoretically be set to std::array
or similar.
As an alternative, we could extend the indexing functions by another dimension that refers to the nth element of such a vector valued unknown.
Example: To get the three DG1 unknowns at position x, y on a macro-face an indexing function call could look like this:
real_t dg1_a = data[ index< Level >( x, y, DG_CENTER, 0 ) ];
real_t dg1_b = data[ index< Level >( x, y, DG_CENTER, 1 ) ];
real_t dg1_c = data[ index< Level >( x, y, DG_CENTER, 2 ) ];
(Such mappings of course must be documented (which would be true for the templated approach as well).)
The function memory is simply extended to the required size.
Further advantages:
- the
ValueType
template parametercan be removedwould be restricted to eitherfloat
ordouble
- the memory layout (AoS vs SoA) can be easily switched by exchanging the indexing function(!) - this would not be possible with the
ValueType
-template approach
Disadvantages:
- we would restrict the function classes to unknowns of type
real_t
^Nfloat
^N ordouble
^N (foruint_t
typed functions we then need extra classes (but maybe that's not that bad anyway?)) https://i10git.cs.fau.de/terraneo/tinyhhg/issues/34 would be really hard to solve (but uncertain if we ever need that)