LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
|
For every concept defined in LehrFEM++, we provide an archetype class that models the corresponding concept in the most minimal way possible without providing extra functionality. It can be used to test whether other classes/functions which require a parameter to model a certain concept, only rely on the functionality which has been defined in the concept.
Lets consider an example to understand what we mean by this. Suppose we have a concept Animal
:
Then we provide an archetype class AnimalAT
that models the concept Animal
:
We can check whether AnimalAT
actually models the concept Animal
by using the static_assert
macro:
The archetype class AnimalAT
is useful in a number of ways:
AnimalAT
documents that the concept Animal
requires the methods MakeSound()
and Eat()
. Additionally we can put doxygen comments in front of MakeSound()
and Eat()
to document their intended functionality. Animal
, we can check with the archetype, that the function template only requires the functionality provided by the concept Animal
. For example, assume that we have written the following errorneous function: AnimalAT
, we can check that the function Feed
really only requires the functionality provided by the concept Animal
. For this we explicitly instantiate the function Feed()
(without actually calling it) gender_t
we could just write: