WIP: Make geometry type handling more flexible
This implements three features: StaticGeometryType
, LagrangeFiniteElementCache
, and GeometryTypeProviders
. Together they allow to avoid the polymorphic local finite element interface if either the grid only supports a single geometry type, or if you explicitly know that it only contains a single geometry type.
StaticGeometryType
This encodes all the information of a GeometryType
as template
parameters. Some remarks on the implementation:
- This may be a solution for using geometry types a template paremters and is thus a candidate for dune-geometry
- All methods in
Dune::GeometryTypes::
have analogues inDune::Functions::StaticGeometryTypes::
and additional template aliases for parametrized types. Hence you can e.g. use Simplex. - There is
LocalHybridGeometryTypeIndex
which works likeLocalGeometryTypeIndex
but supportsGeometryType
andStaticGeometryType
. - Some topologyIds are different: If you want to overload for specific
StaticGeometryType
s, you must be sure that the same geometry type leads to the same type. Hence topologyIds are normalize to have 0 in the first bit. - One may consider using
uniqueTopologyId = (topologyId >> 1)
as template parameter instead to get rid of the nasty non-uniqueness.
LagrangeFiniteElementCache
This works like PQkFiniteElementCache
in dune-localfunctions
but also allows to obtain raw fe-implemenations without polymorphic
wrapper if the geometry type is provided statically as StaticGeometryType
.
This allows to seamlessly switch between the polymorphic and non-polymorphic
version by using GeometryType
or StaticGeometryType
.
GeometryTypeProviders
These allow to map an entity to its geometry type. Depending on the
selected provider and grid view, this is encoded as GeometryType
or
StaticGeometryType
. There are several implementations:
-
MixedGeometryTypeProvider
will always act like a mixed element grid and simply forward the dynamicGeometryType
. You'd normally not want to use this one. -
AutoGeometryTypeProvider
will use aStaticGeometryType
if the grid satisfieshasSingleGeometryType()
. OtherwiseGeometryType
is used. This is the default choise which should work always. -
SimplexGeometryTypeProvider
andCubeGeometryTypeProvider
will always provide the correspondingStaticGeometryType
. This can be used to avoid the costly polymorphic interface if your grid supports mixed elements, but you know, that there are only simplices or cubes.