Loading...
Searching...
No Matches
base.cc
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_GEOMETRY_REFINEMENT_BASE_CC
#define DUNE_GEOMETRY_REFINEMENT_BASE_CC
#include <dune/geometry/type.hh>
namespace Dune
{
namespace RefinementImp
{
// /////////////////////////////////
//
// Declaration of RefinementImp::Traits
//
#ifdef DOXYGEN
// This is just for Doxygen
template<unsigned topologyId, class CoordType,
unsigned coerceToId, int dimension, class Dummy = void>
struct Traits
{
typedef SquaringTheCircle::Refinement Imp;
};
#else // !DOXYGEN
// Doxygen won't see this
template<unsigned topologyId, class CoordType,
unsigned coerceToId, int dimension, class = void>
struct Traits;
#endif // !DOXYGEN
} // namespace RefinementImp
class RefinementIntervals{
int intervals_=1;
public:
explicit RefinementIntervals(int i) : intervals_(i) {}
int intervals() const { return intervals_; }
};
inline RefinementIntervals refinementIntervals(int intervals)
{
return RefinementIntervals{intervals};
}
inline RefinementIntervals refinementLevels(int levels)
{
return RefinementIntervals{1<<levels};
}
// ///////////////
//
// Static Refinement
//
template<unsigned topologyId, class CoordType,
unsigned coerceToId, int dimension_>
class StaticRefinement
: public RefinementImp::Traits<topologyId, CoordType,
coerceToId, dimension_ >::Imp
{
public:
#ifdef DOXYGEN
template<int codimension>
struct Codim
{
typedef SubEntityIterator;
};
typedef Codim<dimension>::SubEntityIterator VertexIterator;
typedef Codim<0>::SubEntityIterator ElementIterator;
typedef CoordVector;
typedef IndexVector;
#endif
typedef typename RefinementImp::Traits< topologyId, CoordType, coerceToId, dimension_>::Imp RefinementImp;
using RefinementImp::dimension;
using RefinementImp::Codim;
using typename RefinementImp::VertexIterator;
using typename RefinementImp::CoordVector;
using typename RefinementImp::ElementIterator;
using typename RefinementImp::IndexVector;
static int nVertices(Dune::RefinementIntervals tag)
{
return RefinementImp::nVertices(tag.intervals());
}
static VertexIterator vBegin(Dune::RefinementIntervals tag)
{
return RefinementImp::vBegin(tag.intervals());
}
static VertexIterator vEnd(Dune::RefinementIntervals tag)
{
return RefinementImp::vEnd(tag.intervals());
}
static int nElements(Dune::RefinementIntervals tag)
{
return RefinementImp::nElements(tag.intervals());
}
static ElementIterator eBegin(Dune::RefinementIntervals tag)
{
return RefinementImp::eBegin(tag.intervals());
}
static ElementIterator eEnd(Dune::RefinementIntervals tag)
{
return RefinementImp::eEnd(tag.intervals());
}
};
} // namespace Dune
#endif // DUNE_GEOMETRY_REFINEMENT_BASE_CC
type.hh
A unique label for each type of element that can occur in a grid.
Dune::refinementIntervals
RefinementIntervals refinementIntervals(int intervals)
Creates a RefinementIntervals object.
Definition base.cc:108
Dune::refinementLevels
RefinementIntervals refinementLevels(int levels)
Creates a RefinementIntervals object.
Definition base.cc:117
Dune
Definition affinegeometry.hh:22
Dune::RefinementImp
This namespace contains the implementation of Refinement.
Definition base.cc:29
Dune::RefinementImp::Traits
Mapping from geometryType, CoordType and coerceTo to a particular Refinement implementation.
Definition base.cc:70
Dune::RefinementIntervals
Holds the number of refined intervals per axis needed for virtual and static refinement.
Definition base.cc:94
Dune::RefinementIntervals::RefinementIntervals
RefinementIntervals(int i)
Definition base.cc:98
Dune::RefinementIntervals::intervals
int intervals() const
Definition base.cc:100
Dune::StaticRefinement
Wrap each Refinement implementation to get a consistent interface.
Definition base.cc:141
Dune::StaticRefinement::eEnd
static ElementIterator eEnd(Dune::RefinementIntervals tag)
Get an ElementIterator.
Definition base.cc:247
Dune::StaticRefinement::eBegin
static ElementIterator eBegin(Dune::RefinementIntervals tag)
Get an ElementIterator.
Definition base.cc:237
Dune::StaticRefinement::nElements
static int nElements(Dune::RefinementIntervals tag)
Get the number of Elements.
Definition base.cc:227
Dune::StaticRefinement::ElementIterator
Codim< 0 >::SubEntityIterator ElementIterator
The ElementIterator of the Refinement.
Definition base.cc:163
Dune::StaticRefinement::nVertices
static int nVertices(Dune::RefinementIntervals tag)
Get the number of Vertices.
Definition base.cc:197
Dune::StaticRefinement::vBegin
static VertexIterator vBegin(Dune::RefinementIntervals tag)
Get a VertexIterator.
Definition base.cc:207
Dune::StaticRefinement::VertexIterator
Codim< dimension >::SubEntityIterator VertexIterator
The VertexIterator of the Refinement.
Definition base.cc:161
Dune::StaticRefinement< topologyId, CoordType, coerceToId, dimension >::CoordVector
typedef CoordVector
Definition base.cc:170
Dune::StaticRefinement< topologyId, CoordType, coerceToId, dimension >::IndexVector
typedef IndexVector
Definition base.cc:177
Dune::StaticRefinement::RefinementImp
RefinementImp::Traits< topologyId, CoordType, coerceToId, dimension_ >::Imp RefinementImp
Definition base.cc:180
Dune::StaticRefinement::vEnd
static VertexIterator vEnd(Dune::RefinementIntervals tag)
Get a VertexIterator.
Definition base.cc:217
Dune::StaticRefinement::Codim
The Codim struct inherited from the Refinement implementation.
Definition base.cc:151
Dune::StaticRefinement::SubEntityIterator::SubEntityIterator
typedef SubEntityIterator
Definition base.cc:157