5#ifndef DUNE_GEOMETRY_REFINEMENT_PYRAMIDTRIANGULATION_CC
6#define DUNE_GEOMETRY_REFINEMENT_PYRAMIDTRIANGULATION_CC
8#include <dune/common/fvector.hh>
9#include <dune/common/typetraits.hh>
19 namespace RefinementImp
26 namespace PyramidTriangulation
42 template<
int dimension,
class CoordType,
int codimension>
50 template<
int dimension,
class CoordType> FieldVector<CoordType, dimension>
53 FieldVector<CoordType, dimension> transform;
54 transform[0]=1-point[0];
55 transform[1]=1-point[1];
56 transform[2]=point[2];
66 template<
int dimension_,
class CoordType>
74 template<
int codimension>
95 constexpr static int nKuhnSimplices = 2;
98 template<
int dimension,
class CoordType>
99 template<
int codimension>
102 class SubEntityIterator;
106 template<
int dimension,
class CoordType>
111 return BackendRefinement::nVertices(nIntervals) * nKuhnSimplices;
114 template<
int dimension,
class CoordType>
122 template<
int dimension,
class CoordType>
130 template<
int dimension,
class CoordType>
135 return BackendRefinement::nElements(nIntervals) * nKuhnSimplices;
138 template<
int dimension,
class CoordType>
146 template<
int dimension,
class CoordType>
160 template<
int dimension,
class CoordType>
180 constexpr static int nKuhnSimplices = 2;
189 template<
int dimension,
class CoordType>
192 : nIntervals_(nIntervals), kuhnIndex(0),
197 kuhnIndex = nKuhnSimplices;
200 template<
int dimension,
class CoordType>
206 if(backend == backendEnd)
208 backend = BackendRefinement::vBegin(nIntervals_);
213 template<
int dimension,
class CoordType>
219 getPermutation<dimension>(kuhnIndex)));
222 template<
int dimension,
class CoordType>
226 std::vector<CoordVector> corners(1);
227 corners[0] = referenceToKuhn(backend.coords(), getPermutation<dimension>(kuhnIndex));
231 template<
int dimension,
class CoordType>
236 return kuhnIndex*BackendRefinement::nVertices(nIntervals_) + backend.index();
240 template<
int dimension,
class CoordType>
265 constexpr static int nKuhnSimplices = 2;
274 template<
int dimension,
class CoordType>
277 : nIntervals_(nIntervals), kuhnIndex(0),
282 kuhnIndex = nKuhnSimplices;
285 template<
int dimension,
class CoordType>
291 if (backend == backendEnd)
293 backend = BackendRefinement::eBegin(nIntervals_);
298 template<
int dimension,
class CoordType>
305 int base = kuhnIndex * BackendRefinement::nVertices(nIntervals_);
311 template<
int dimension,
class CoordType>
316 return kuhnIndex*BackendRefinement::nElements(nIntervals_) + backend.index();
319 template<
int dimension,
class CoordType>
324 return global(backend.coords());
327 template<
int dimension,
class CoordType>
332 const typename BackendIterator::Geometry &
333 bgeo = backend.geometry();
334 std::vector<CoordVector> corners(dimension+1);
335 for(
int i = 0; i <= dimension; ++i)
336 corners[i] = global(bgeo.corner(i));
338 return Geometry(bgeo.type(), corners);
341 template<
int dimension,
class CoordType>
345 global(
const CoordVector &local)
const
348 getPermutation<dimension>(kuhnIndex)));
352 template<
int dimension,
class CoordType>
353 template<
int codimension>
355 :
public ForwardIteratorFacade<typename RefinementImp<dimension, CoordType>::template Codim<codimension>::SubEntityIterator, int>,
360 typedef SubEntityIterator
This;
371 template<
int dimension,
class CoordType>
372 template<
int codimension>
378 template<
int dimension,
class CoordType>
379 template<
int codimension>
382 equals(
const This &other)
const
384 return kuhnIndex == other.kuhnIndex && backend == other.backend;
391 namespace RefinementImp
398 template<
unsigned topologyId,
class CoordType,
unsigned coerceToId>
400 topologyId, CoordType, coerceToId, 3,
401 typename std::enable_if<
402 (GeometryTypes::pyramid.id() >> 1) ==
404 (GeometryTypes::simplex(3).id() >> 1) ==
408 typedef PyramidTriangulation::RefinementImp<3, CoordType> Imp;
This file contains the Refinement implementation for simplices (triangles, tetrahedrons....
This file contains the parts independent of a particular Refinement implementation.
A unique label for each type of element that can occur in a grid.
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition type.hh:507
Definition affinegeometry.hh:21
FieldVector< CoordType, dimension > transformCoordinate(FieldVector< CoordType, dimension > point)
Definition pyramidtriangulation.cc:51
FieldVector< int, n > getPermutation(int m)
Calculate permutation from it's index.
Definition simplex.cc:336
FieldVector< CoordType, dimension > referenceToKuhn(FieldVector< CoordType, dimension > point, const FieldVector< int, dimension > &kuhn)
Map from the reference simplex to some Kuhn simplex.
Definition simplex.cc:394
Static tag representing a codimension.
Definition dimension.hh:24
generic geometry implementation based on corner coordinates
Definition multilineargeometry.hh:181
Definition pyramidtriangulation.cc:43
Implementation of the refinement of a pyramid into simplices.
Definition pyramidtriangulation.cc:68
FieldVector< CoordType, dimension > CoordVector
Definition pyramidtriangulation.cc:77
static int nVertices(int nIntervals)
Definition pyramidtriangulation.cc:109
static int nElements(int nIntervals)
Definition pyramidtriangulation.cc:133
CoordType ctype
Definition pyramidtriangulation.cc:72
Codim< dimension >::SubEntityIterator VertexIterator
Definition pyramidtriangulation.cc:76
Codim< 0 >::SubEntityIterator ElementIterator
Definition pyramidtriangulation.cc:78
static constexpr int dimension
Definition pyramidtriangulation.cc:70
static ElementIterator eBegin(int nIntervals)
Definition pyramidtriangulation.cc:141
static ElementIterator eEnd(int nIntervals)
Definition pyramidtriangulation.cc:149
FieldVector< int, dimension+1 > IndexVector
Definition pyramidtriangulation.cc:79
static VertexIterator vBegin(int nIntervals)
Definition pyramidtriangulation.cc:117
static VertexIterator vEnd(int nIntervals)
Definition pyramidtriangulation.cc:125
Definition pyramidtriangulation.cc:101
Dune::MultiLinearGeometry< CoordType, dimension-codimension, dimension > Geometry
Definition pyramidtriangulation.cc:103
RefinementImp< dimension, CoordType > Refinement
Definition pyramidtriangulation.cc:164
Refinement::template Codim< dimension >::Geometry Geometry
Definition pyramidtriangulation.cc:166
Refinement::BackendRefinement BackendRefinement
Definition pyramidtriangulation.cc:178
BackendIterator backend
Definition pyramidtriangulation.cc:185
BackendRefinement::template Codim< dimension >::SubEntityIterator BackendIterator
Definition pyramidtriangulation.cc:179
int kuhnIndex
Definition pyramidtriangulation.cc:184
Refinement::CoordVector CoordVector
Definition pyramidtriangulation.cc:165
const BackendIterator backendEnd
Definition pyramidtriangulation.cc:186
int nIntervals_
Definition pyramidtriangulation.cc:182
const BackendIterator backendEnd
Definition pyramidtriangulation.cc:271
Refinement::CoordVector CoordVector
Definition pyramidtriangulation.cc:246
int nIntervals_
Definition pyramidtriangulation.cc:267
Refinement::template Codim< 0 >::Geometry Geometry
Definition pyramidtriangulation.cc:247
Refinement::IndexVector IndexVector
Definition pyramidtriangulation.cc:245
BackendRefinement::template Codim< 0 >::SubEntityIterator BackendIterator
Definition pyramidtriangulation.cc:264
int kuhnIndex
Definition pyramidtriangulation.cc:269
BackendIterator backend
Definition pyramidtriangulation.cc:270
RefinementImp< dimension, CoordType > Refinement
Definition pyramidtriangulation.cc:244
Refinement::BackendRefinement BackendRefinement
Definition pyramidtriangulation.cc:263
bool equals(const This &other) const
SubEntityIterator This
Definition pyramidtriangulation.cc:360
SubEntityIterator(int nIntervals, bool end=false)
RefinementImp< dimension, CoordType > Refinement
Definition pyramidtriangulation.cc:359
Definition simplex.cc:433