QuantityGrid: A grid for unit safe types
The idea is simple: support grids that want to be expressed in terms of units. These unit safe types are usually types that just have the correct operations between them but only store a double
or any other given type, nothing else. A model for that is boost::units
, but there are many others out there that do the same following the same principle.
So, assuming qtype
is the type with units and that sizeof(ctype)==sizeof(qtype)
, it is perfectly fine to use any host grid that store its values in double
or any other basic type, and simply reinterpreting the output in Geometry into a correct combination of qtype
should suffice to provide a unit safe grid.
The cast reinterpretation is quite straightforward and should require only compilation time. The only requirement is that core/dune-grid#79 (closed) gets accepted into the dune-grid interface.
Notice that there is basically no support for reference elements with unit safe types in dune-geometry which makes this grid useless for most of the other dune packages (like pdelab or localfunctions), but this is at least a start to care about that.