General
The Refinement system allows to temporarily refine a grid or single entities without changing the grid itself. You may want to do this because you want to write your data to a file and have to do subsampling, but want to continue the calculation with the unmodified grid afterwards.
What Refinement can do for you
template<unsigned topologyId, class CoordType,
unsigned coerceToId, int dimension>
class StaticRefinement
{
public:
enum { dimension };
template<int codimension>
struct codim
{
class SubEntityIterator;
};
}
Holds the number of refined intervals per axis needed for virtual and static refinement.
Definition: base.cc:92
static ElementIterator eEnd(Dune::RefinementIntervals tag)
Get an ElementIterator.
Definition: base.cc:245
static ElementIterator eBegin(Dune::RefinementIntervals tag)
Get an ElementIterator.
Definition: base.cc:235
static int nElements(Dune::RefinementIntervals tag)
Get the number of Elements.
Definition: base.cc:225
Codim< 0 >::SubEntityIterator ElementIterator
The ElementIterator of the Refinement.
Definition: base.cc:161
static int nVertices(Dune::RefinementIntervals tag)
Get the number of Vertices.
Definition: base.cc:195
static VertexIterator vBegin(Dune::RefinementIntervals tag)
Get a VertexIterator.
Definition: base.cc:205
Codim< dimension >::SubEntityIterator VertexIterator
The VertexIterator of the Refinement.
Definition: base.cc:159
typedef CoordVector
The CoordVector of the Refinement.
Definition: base.cc:168
typedef IndexVector
The IndexVector of the Refinement.
Definition: base.cc:175
static VertexIterator vEnd(Dune::RefinementIntervals tag)
Get a VertexIterator.
Definition: base.cc:215
The Iterators can do all the usual things that Iterators can do, except dereferencing. In addition, to do something useful, they support some additional methods:
template<unsigned topologyId, class CoordType, unsigned coerceToId, int dimension>
class VertexIterator
{
public:
typedef ImplementationDefined Refinement;
int index() const;
Refinement::CoordVector coords() const;
}
template<unsigned topologyId, class CoordType, unsigned coerceToId, int dimension>
class ElementIterator
{
public:
typedef ImplementationDefined Refinement;
int index() const;
Refinement::CoordVector coords() const;
Refinement::IndexVector vertexIndices() const;
}
How to use it
If you want to write a Refinement implementation for a particular geometry type, e.g. SquaringTheCircle (or a particular set of geometry types) here is how:
- create a file refinement/squaringthecircle.cc and #include "base.cc". Your file will be included by others, so don't forget to protect against double inclusion.
- implement a class (or template class) RefinementImp conforming exactly to the user interface above.
- put it (and it's helper stuff as appropriate) into it's own namespace Dune::RefinementImp::SquaringTheCircle.
- define the mapping of topologyId, CoordType and coerceToId to your implementation by specialising template struct RefinementImp::Traits. It should look like this:
template<class CoordType>
struct Traits<sphereTopologyId, CoordType,
GeometryTypes::
cube(2), 2>
{
typedef SquaringTheCircle::RefinementImp<CoordType> Imp;
};
}
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:470
This namespace contains the implementation of Refinement.
Definition: base.cc:27
If you implement a template class, you have to specialise struct RefinementImp::Traits for every possible combination of topologyId and coerceToId that your implementation supports.
- #include "refinement/squaringthecircle.cc" from refinement.hh.
This is enough to integrate your implementation into the Refinement system. You probably want to include it into VirtualRefinement also.
Namespaces
◆ refinementIntervals()
◆ refinementLevels()