1#ifndef DUNE_ALU3DGRIDFACEUTILITY_HH
2#define DUNE_ALU3DGRIDFACEUTILITY_HH
7#include <dune/geometry/referenceelements.hh>
10#include "alu3dinclude.hh"
22 inline alu3d_ctype (&fieldVector2alu3d_ctype ( FieldVector< alu3d_ctype, dim > &val ))[ dim ]
24 return ((alu3d_ctype (&)[dim]) (*( &(val[0])) ));
29 inline const alu3d_ctype (&fieldVector2alu3d_ctype (
const FieldVector< alu3d_ctype, dim > &val ))[ dim ]
31 return ((
const alu3d_ctype (&)[dim]) (*( &(val[0])) ) );
42 template<
int dim,
int dimworld, ALU3dGr
idElementType type,
class Comm >
43 class ALU3dGridFaceInfo
45 typedef ALU3dImplTraits< type, Comm > ImplTraits;
47 typedef typename ImplTraits::HasFaceType HasFaceType;
49 enum ConformanceState {CONFORMING, REFINED_INNER, REFINED_OUTER, UNDEFINED };
51 typedef typename ImplTraits::GEOFaceType GEOFaceType;
52 typedef typename ImplTraits::GEOElementType GEOElementType;
53 typedef typename ImplTraits::GEOPeriodicType GEOPeriodicType;
54 typedef typename ImplTraits::IMPLElementType IMPLElementType;
55 typedef typename ImplTraits::GhostPairType GhostPairType;
56 typedef typename ImplTraits::BNDFaceType BNDFaceType;
60 ALU3dGridFaceInfo(
const bool levelIntersection =
false );
61 void updateFaceInfo(
const GEOFaceType& face,
int innerLevel,
int innerTwist);
69 ALU3dGridFaceInfo(
const GEOFaceType& face,
int innerTwist);
70 ALU3dGridFaceInfo(
const ALU3dGridFaceInfo &orig);
76 bool isElementLike()
const;
81 bool innerBoundary()
const;
85 bool outerBoundary()
const;
88 bool boundary()
const;
91 bool neighbor()
const ;
95 bool ghostBoundary ()
const;
98 const GEOFaceType& face()
const;
100 const GEOElementType& innerEntity()
const;
103 const GEOElementType& outerEntity()
const;
106 const BNDFaceType& innerFace()
const;
109 const BNDFaceType& boundaryFace()
const;
112 int innerTwist()
const;
114 int outerTwist()
const;
117 int duneTwist(
const int faceIdx,
const int aluTwist)
const;
120 int innerALUFaceIndex()
const;
122 int outerALUFaceIndex()
const;
124 int outsideLevel()
const;
127 int segmentId()
const;
130 int boundaryId()
const;
133 ConformanceState conformanceState()
const;
136 bool parallel()
const {
return !std::is_same< Comm, ALUGridNoComm >::value; }
139 bool conformingRefinement ()
const {
return conformingRefinement_; }
142 bool ghostCellsEnabled ()
const {
return ghostCellsEnabled_; }
145 void setFlags(
const bool conformingRefinement,
const bool ghostCellsEnabled );
149 ConformanceState getConformanceState(
const int innerLevel)
const;
152 const ALU3dGridFaceInfo &
153 operator=(
const ALU3dGridFaceInfo &orig);
158 const GEOFaceType* face_;
159 const HasFaceType* innerElement_;
160 const HasFaceType* outerElement_;
162 int innerFaceNumber_;
163 int outerFaceNumber_;
168 mutable int segmentId_;
171 enum boundary_t { noBoundary = 0,
172 periodicBoundary = 1,
173 innerGhostBoundary = 2,
175 outerGhostBoundary = 4};
179 ConformanceState conformanceState_;
180 bool conformingRefinement_ ;
181 bool ghostCellsEnabled_ ;
182 const bool levelIntersection_ ;
189 template<
int dim,
int dimworld, ALU3dGr
idElementType type,
class Comm >
190 struct ALU3dGridSurfaceMappingFactory;
192 template<
int dim,
int dimworld,
class Comm >
193 struct ALU3dGridSurfaceMappingFactory< dim, dimworld, tetra, Comm >
197 typedef ALU3DSPACE LinearSurfaceMapping SurfaceMappingType;
198 typedef typename ALU3dGridFaceInfo< dim, dimworld, tetra, Comm >::GEOFaceType GEOFaceType;
200 static const int numVerticesPerFace = EntityCount< tetra >::numVerticesPerFace;
202 typedef FieldMatrix< alu3d_ctype, numVerticesPerFace, 3 > CoordinateType;
205 SurfaceMappingType *buildSurfaceMapping (
const CoordinateType &coords )
const;
207 SurfaceMappingType *buildSurfaceMapping (
const GEOFaceType &face )
const;
210 template<
int dim,
int dimworld,
class Comm >
211 struct ALU3dGridSurfaceMappingFactory< dim, dimworld, hexa, Comm >
213 typedef BilinearSurfaceMapping SurfaceMappingType;
214 typedef typename ALU3dGridFaceInfo< dim, dimworld, hexa, Comm >::GEOFaceType GEOFaceType;
216 static const int numVerticesPerFace = EntityCount< hexa >::numVerticesPerFace;
218 typedef FieldMatrix< alu3d_ctype, numVerticesPerFace, 3 > CoordinateType;
221 SurfaceMappingType *buildSurfaceMapping (
const CoordinateType &coords )
const;
223 SurfaceMappingType *buildSurfaceMapping (
const GEOFaceType &face )
const;
233 template<
int dim,
int dimworld, ALU3dGr
idElementType type,
class Comm >
235 :
public ALU3dGridSurfaceMappingFactory< dim, dimworld, type, Comm >
237 typedef ALU3dGridSurfaceMappingFactory< dim, dimworld, type, Comm > Base;
250 typedef std::decay_t< decltype( ReferenceElementContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
252 typedef std::decay_t< decltype( ReferenceFaceContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceFaceType;
254 enum SideIdentifier { INNER, OUTER };
255 enum { numVerticesPerFace =
256 EntityCount<type>::numVerticesPerFace };
264 typedef typename ALU3dGridFaceInfo< dim, dimworld, type, Comm >::GEOFaceType GEOFaceType;
267 typedef ALU3dGridFaceInfo< dim, dimworld, type, Comm > ConnectorType;
286 void generateLocalGeometries()
const;
288 int globalVertexIndex(
const int duneFaceIndex,
290 const int duneFaceVertexIndex)
const;
292 void referenceElementCoordinatesRefined(SideIdentifier side,
294 void referenceElementCoordinatesUnrefined(SideIdentifier side,
299 const ConnectorType& connector_;
301 std::array< FieldVector< alu3d_ctype, 2 >, type == tetra ? 3 : 4 > childLocal_;
306 mutable bool generatedGlobal_;
307 mutable bool generatedLocal_;
309 inline static const ReferenceElementType& getReferenceElement()
312 return (type == tetra) ?
320 template<
int dim,
int dimworld,
class Comm >
330 typedef typename ALU3dGridFaceInfo< dim, dimworld, tetra, Comm >::GEOFaceType GEOFaceType;
332 typedef ALU3dGridFaceInfo< dim, dimworld, tetra, Comm > ConnectorType;
344 template <
class GeometryImp>
352 using Base::connector_;
359 mutable bool normalUp2Date_;
364 template<
int dim,
int dimworld,
class Comm >
374 typedef typename ALU3dGridFaceInfo< dim, dimworld, hexa, Comm >::GEOFaceType GEOFaceType;
377 typedef ALU3dGridFaceInfo< dim, dimworld, hexa, Comm > ConnectorType;
389 template <
class GeometryImp>
397 using Base::connector_;
407 mutable bool mappingGlobalUp2Date_;
415 template<
int dimworld, ALU3dGr
idElementType type,
class Comm >
429 typedef std::decay_t< decltype( ReferenceElementContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
431 typedef std::decay_t< decltype( ReferenceFaceContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceFaceType;
433 enum SideIdentifier { INNER, OUTER };
434 enum { numVerticesPerFace = 2 };
445 typedef typename ALU3dGridFaceInfo< 2, dimworld, type, Comm >::GEOFaceType GEOFaceType;
448 typedef ALU3dGridFaceInfo< 2, dimworld, type, Comm > ConnectorType;
467 void generateLocalGeometries()
const;
472 int globalVertexIndex(
const int duneFaceIndex,
474 const int duneFaceVertexIndex)
const;
476 void referenceElementCoordinatesRefined(SideIdentifier side,
478 void referenceElementCoordinatesUnrefined(SideIdentifier side,
483 const ConnectorType& connector_;
488 mutable bool generatedGlobal_;
489 mutable bool generatedLocal_;
491 inline static const ReferenceElementType& getReferenceElement()
493 return (type == tetra) ?
502 template<
int dimworld,
class Comm >
512 typedef typename ALU3dGridFaceInfo< 2, dimworld, tetra, Comm >::GEOFaceType GEOFaceType;
513 typedef typename ALU3dGridFaceInfo< 2, dimworld, tetra, Comm >::GEOElementType GEOElementType;
514 typedef ALU3dGridFaceInfo< 2, dimworld, tetra, Comm > ConnectorType;
526 template <
class GeometryImp>
534 using Base::connector_;
541 mutable bool normalUp2Date_;
546 template<
int dimworld,
class Comm >
556 typedef typename ALU3dGridFaceInfo< 2, dimworld, hexa, Comm >::GEOFaceType GEOFaceType;
557 typedef typename ALU3dGridFaceInfo< 2, dimworld, hexa, Comm >::GEOElementType GEOElementType;
559 typedef ALU3dGridFaceInfo< 2, dimworld, hexa, Comm > ConnectorType;
571 template <
class GeometryImp>
579 using Base::connector_;
586 mutable bool normalUp2Date_;
592#include "faceutility_imp.cc"
Definition: faceutility.hh:236
void resetFaceGeom()
reset status of faceGeomInfo
Definition: faceutility_imp.cc:500
Definition: faceutility.hh:367
void buildGlobalGeom(GeometryImp &geo) const
update global geometry
Definition: faceutility_imp.cc:622
void resetFaceGeom()
reset status of faceGeomInfo
Definition: faceutility_imp.cc:604
Definition: faceutility.hh:323
void resetFaceGeom()
reset status of faceGeomInfo
Definition: faceutility_imp.cc:533
void buildGlobalGeom(GeometryImp &geo) const
update global geometry
Definition: faceutility_imp.cc:549
Definition: topology.hh:40
Definition: topology.hh:151
A dense n x m matrix.
Definition: fmatrix.hh:117
A bilinear surface mapping.
Definition: mappings.hh:88
topology of a Cartesian grid
Dune namespace.
Definition: alignedallocator.hh:13
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:170
static const ReferenceElement & cube()
get hypercube reference elements
Definition: referenceelements.hh:210
static const ReferenceElement & simplex()
get simplex reference elements
Definition: referenceelements.hh:204