-
- Downloads
[!87] Add GeometryType::Id to allow using GeometryType as a template parameter
Merge branch 'feature/add-geometrytype-id' into 'master' ref:core/dune-geometry After thinking about what I proposed in [#17], I realized that an index is probably not the right idea of thinking about this. Instead, we can just do a 1-to-1 mapping of GeometryType to a canonical id, as GeometryType itself is just a 8 byte struct that stores three integral values. I've nested the id within GeometryType as GeometryType::Id here and added implicit conversions between the two. The id type is a scoped enum to avoid any future nastiness with implicit conversions to other integral types. With this merge request, you can have a template with a GeometryType parameter with just a tiny bit of overhead on the implementor's side: // note the additional "::Id" template<GeometryType::Id gt_> class Foo { // reconstruct the GeometryType static constexpr GeometryType gt = gt_; }; For the user, it looks like they can just plug in a GeometryType: Foo<GeometryTypes::triangle> foo; This solves a major 2.6 headache in PDELab (see [#17], [pdelab/dune-pdelab#102]), so I'd really like this to go into 2.6. Closes [#17]. See merge request [!87] [#17]: gitlab.dune-project.org/NoneNone/issues/17 [pdelab/dune-pdelab#102]: gitlab.dune-project.org/pdelab/dune-pdelab/issues/102 [!87]: gitlab.dune-project.org/core/dune-geometry/merge_requests/87 Closes #17
No related branches found
No related tags found
dune/geometry/test/test-geometrytype-id.cc
0 → 100644
Please register or sign in to comment