1 #ifndef DUNE_ALU3DGRIDGEOMETRY_HH
2 #define DUNE_ALU3DGRIDGEOMETRY_HH
9 #include <dune/common/version.hh>
10 #include <dune/common/power.hh>
11 #include <dune/grid/common/grid.hh>
23 template<
int cd,
int dim,
class Gr
idImp>
24 class ALU3dGridEntity;
25 template<
int cd,
class Gr
idImp >
26 class ALU3dGridEntityPointer;
27 template<
int mydim,
int coorddim,
class Gr
idImp>
28 class ALU3dGridGeometry;
29 template<
int dim,
int dimworld, ALU3dGr
idElementType,
class >
31 class BilinearSurfaceMapping;
32 class TrilinearMapping;
34 template<
class Gr
idImp >
35 class ALU3dGridIntersectionIterator;
47 template <
int dim,
int corners,
class Mapping>
62 typedef typename std::conditional<
64 std::unique_ptr< CoordinateMatrixType >,
96 template <
class CoordPtrType>
97 static inline void copy(
const CoordPtrType& p,
108 template <
class CoordPtrType>
116 const CoordPtrType& )
const
118 DUNE_THROW(InvalidStateException,
"This method should not be called!");
121 template <
class CoordPtrType>
125 const CoordPtrType& )
const
127 DUNE_THROW(InvalidStateException,
"This method should not be called!");
130 template <
class CoordPtrType>
133 const CoordPtrType& )
const
135 DUNE_THROW(InvalidStateException,
"This method should not be called!");
138 template <
class CoordPtrType>
140 const CoordPtrType& )
const
142 DUNE_THROW(InvalidStateException,
"This method should not be called!");
145 template <
class CoordPtrType>
148 DUNE_THROW(InvalidStateException,
"This method should not be called!");
152 template <
class GeometryImp>
154 const GeometryImp &myGeom)
160 for(
int i=0; i < myGeom.corners() ; ++i)
163 coord_[i] = fatherGeom.local( myGeom.corner( i ) );
166 for(
int j=0; j<cdim; ++j)
189 template <
int dummy,
int dim,
193 template <
int dummy,
int dim, ALU3dGr
idElementType eltype>
229 template <
class CoordPtrType>
230 inline void update(
const CoordPtrType& p0)
240 template <
int dummy, ALU3dGr
idElementType eltype>
278 template <
class CoordPtrType>
279 inline void update(
const CoordPtrType& p0,
280 const CoordPtrType& p1)
318 template <
class CoordPtrType>
319 inline void update(
const CoordPtrType& p0,
320 const CoordPtrType& p1,
321 const CoordPtrType& p2)
376 template <
class CoordPtrType>
377 inline void update(
const CoordPtrType& p0,
378 const CoordPtrType& p1,
379 const CoordPtrType& p2,
380 const CoordPtrType& p3)
440 return coordPtr_[ i ];
447 copy( point( i ), coord );
452 inline void update(
const CoordPtrType& p0,
453 const CoordPtrType& p1,
454 const CoordPtrType& p2,
455 const CoordPtrType& p3,
456 const CoordPtrType& p4,
457 const CoordPtrType& p5,
458 const CoordPtrType& p6,
459 const CoordPtrType& p7)
461 coordPtr_[0] = &p0[ 0 ];
462 coordPtr_[1] = &p1[ 0 ];
463 coordPtr_[2] = &p2[ 0 ];
464 coordPtr_[3] = &p3[ 0 ];
465 coordPtr_[4] = &p4[ 0 ];
466 coordPtr_[5] = &p5[ 0 ];
467 coordPtr_[6] = &p6[ 0 ];
468 coordPtr_[7] = &p7[ 0 ];
473 template <
class GeometryImp>
475 const GeometryImp &myGeom)
484 for(
int i=0; i < myGeom.corners() ; ++i)
487 coord[i] = fatherGeom.local( myGeom.corner( i ) );
490 coordPtr_[i] = (&(coord[i][0]));
493 for(
int j=0; j<cdim; ++j)
495 if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
509 point( 4 ), point( 5 ), point( 6 ), point( 7 ) );
561 return coordPtr_[ i ];
568 copy( point( i ), coord );
573 inline void update(
const CoordPtrType& p0,
574 const CoordPtrType& p1,
575 const CoordPtrType& p2,
576 const CoordPtrType& p3)
578 coordPtr_[0] = &p0[ 0 ];
579 coordPtr_[1] = &p1[ 0 ];
580 coordPtr_[2] = &p2[ 0 ];
581 coordPtr_[3] = &p3[ 0 ];
586 template <
class GeometryImp>
588 const GeometryImp & myGeom)
595 CoordinateMatrixType& coord = *
coord_;
597 for(
int i=0; i < myGeom.corners() ; ++i)
600 coord[i] = fatherGeom.local( myGeom.corner( i ) );
603 coordPtr_[i] = (&(coord[i][0]));
606 for(
int j=0; j<cdim; ++j)
608 if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
629 template <
int mydim,
int cdim,
class Gr
idImp>
631 public GeometryDefaultImplementation<mydim, cdim, GridImp, ALU3dGridGeometry>
635 typedef typename GridImp::MPICommunicatorType Comm;
647 typedef typename ALU3dImplTraitsType::HFaceType
HFaceType;
648 typedef typename ALU3dImplTraitsType::HEdgeType
HEdgeType;
655 enum {
corners_ = (elementType ==
hexa) ? StaticPower<2,(mydim> -1) ? mydim : 0 >::power : mydim+1 };
662 typedef typename GridImp :: ctype
ctype;
677 typedef FieldMatrix<
ctype,
682 GeometryType
type ()
const;
709 inline bool affine ()
const;
727 template <
class coord_t>
734 template <
class coord_t>
740 template <
class coord_t>
745 template <
class GeometryType>
746 bool buildGeomInFather(
const GeometryType &fatherGeom ,
const GeometryType & myGeom);
750 void print (std::ostream& ss)
const;
#define ALU3DSPACE
Definition: alu3dinclude.hh:24
#define alugrid_assert(EX)
Definition: alugrid_assert.hh:20
Definition: alu3dinclude.hh:80
ALU3dGridElementType
Definition: topology.hh:12
@ hexa
Definition: topology.hh:12
@ tetra
Definition: topology.hh:12
double alu3d_ctype
Definition: alu3dinclude.hh:85
Definition: alu3dinclude.hh:259
Definition: geometry.hh:632
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
jacobian transposed
Definition: geometry_imp.cc:116
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
Definition: geometry_imp.cc:108
GridImp ::ctype ctype
Definition: geometry.hh:662
bool valid() const
invalidate geometry implementation to avoid errors
Definition: geometry.hh:756
ALU3dImplTraitsType::GEOFaceType GEOFaceType
Definition: geometry.hh:642
FieldMatrix< ctype, GridImp::dimension==3 ? EntityCount< elementType >::numVerticesPerFace :2, cdim > FaceCoordinatesType
Definition: geometry.hh:678
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: geometry.hh:671
GlobalCoordinate corner(int i) const
access to coordinates of corners. Index is the number of the corner
Definition: geometry_imp.cc:33
int corners() const
return the number of corners of this element. Corners are numbered 0..n-1
Definition: geometry_imp.cc:25
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: geometry.hh:668
void invalidate()
invalidate geometry implementation to avoid errors
Definition: geometry.hh:753
ALU3dImplTraitsType::HEdgeType HEdgeType
Definition: geometry.hh:648
FaceTopologyMapping< elementType > FaceTopo
Definition: geometry.hh:653
ALU3dImplTraitsType::VertexType VertexType
Definition: geometry.hh:649
ALU3dImplTraitsType::GEOEdgeType GEOEdgeType
Definition: geometry.hh:643
bool buildGeom(const IMPLElementType &item)
Methods that not belong to the Interface, but have to be public.
Definition: geometry_imp.cc:167
bool buildGeomInFather(const GeometryType &fatherGeom, const GeometryType &myGeom)
build geometry of local coordinates relative to father
Definition: geometry_imp.cc:141
ALU3DSPACE SharedPointer< GeometryImplType > geoImplPtr_
Definition: geometry.hh:766
ctype integrationElement(const LocalCoordinate &local) const
A(l) , see grid.hh.
Definition: geometry_imp.cc:62
ALU3dImplTraitsType::IMPLElementType IMPLElementType
Definition: geometry.hh:641
MyALUGridGeometryImplementation< cdim >::template GeometryImpl< 0, mydim, elementType > GeometryImplType
Definition: geometry.hh:659
void print(std::ostream &ss) const
Definition: geometry_imp.cc:124
bool affine() const
returns true if mapping is affine
Definition: geometry_imp.cc:100
ctype volume() const
returns volume of geometry
Definition: geometry_imp.cc:77
GlobalCoordinate global(const LocalCoordinate &local) const
Definition: geometry_imp.cc:42
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: geometry.hh:665
ALU3dImplTraitsType::GEOVertexType GEOVertexType
Definition: geometry.hh:644
@ corners_
Definition: geometry.hh:655
GeometryType type() const
Definition: geometry_imp.cc:15
ALU3dImplTraitsType::HFaceType HFaceType
Definition: geometry.hh:647
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: geometry.hh:674
GeometryImplType & geoImpl() const
Definition: geometry.hh:760
ElementTopologyMapping< elementType > ElementTopo
Definition: geometry.hh:652
Definition: geometry.hh:39
static const signed char buildmapping
Definition: geometry.hh:45
FieldVector< alu3d_ctype, cdim > CoordinateVectorType
Definition: geometry.hh:41
static const signed char invalid
Definition: geometry.hh:43
static const signed char updated
Definition: geometry.hh:44
Definition: geometry.hh:49
std::conditional< dim==3, std::unique_ptr< CoordinateMatrixType >, CoordinateMatrixType >::type CoordinateStorageType
Definition: geometry.hh:65
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: geometry.hh:109
static const int corners_
number of corners
Definition: geometry.hh:56
void update(const CoordPtrType &, const CoordPtrType &) const
Definition: geometry.hh:139
static void copy(const CoordPtrType &p, CoordinateVectorType &c)
Definition: geometry.hh:97
double volume_
volume of element
Definition: geometry.hh:77
void invalidate()
Definition: geometry.hh:176
unsigned int refCount_
reference counter used by SharedPointer
Definition: geometry.hh:84
double volume() const
Definition: geometry.hh:185
Mapping MappingType
the type of the mapping
Definition: geometry.hh:68
MappingType map_
the mapping
Definition: geometry.hh:74
FieldMatrix< alu3d_ctype, corners, cdim > CoordinateMatrixType
the vertex coordinates
Definition: geometry.hh:59
bool valid() const
Definition: geometry.hh:179
void updateInFather(const GeometryImp &fatherGeom, const GeometryImp &myGeom)
Definition: geometry.hh:153
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: geometry.hh:131
void setVolume(const double volume)
Definition: geometry.hh:182
CoordinateStorageType coord_
to coordinates
Definition: geometry.hh:71
signed char status_
the status (see different status above)
Definition: geometry.hh:80
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: geometry.hh:122
void update(const CoordPtrType &) const
Definition: geometry.hh:146
GeometryImplBase()
default constructor
Definition: geometry.hh:87
general type of geometry implementation
Definition: geometry.hh:195
MappingType & mapping()
Definition: geometry.hh:218
void update(const CoordPtrType &p0)
Definition: geometry.hh:230
BaseType ::MappingType MappingType
Definition: geometry.hh:205
const CoordinateVectorType & operator[](const int i) const
Definition: geometry.hh:211
GeometryImplBase< dim, dim+1, LinearMapping< cdim, dim > > BaseType
Definition: geometry.hh:197
BaseType ::MappingType MappingType
Definition: geometry.hh:254
MappingType & mapping()
Definition: geometry.hh:267
void update(const CoordPtrType &p0, const CoordPtrType &p1)
Definition: geometry.hh:279
GeometryImplBase< dim, dim+1, LinearMapping< cdim, dim > > BaseType
Definition: geometry.hh:246
BaseType ::MappingType MappingType
Definition: geometry.hh:304
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2)
Definition: geometry.hh:319
GeometryImplBase< 2, 3, LinearMapping< cdim, 2 > > BaseType
Definition: geometry.hh:296
MappingType & mapping()
Definition: geometry.hh:330
GeometryImplBase< 2, 4, BilinearMapping< cdim > > BaseType
Definition: geometry.hh:354
BaseType ::MappingType MappingType
Definition: geometry.hh:362
MappingType & mapping()
Definition: geometry.hh:390
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2, const CoordPtrType &p3)
Definition: geometry.hh:377
GeometryImplBase< 3, 8, TrilinearMapping > BaseType
Definition: geometry.hh:408
BaseType ::CoordinateMatrixType CoordinateMatrixType
Definition: geometry.hh:417
void invalidate()
Definition: geometry.hh:516
const alu3d_ctype * point(const int i) const
Definition: geometry.hh:435
BaseType ::MappingType MappingType
Definition: geometry.hh:416
GeometryImpl()
constructor creating geo impl
Definition: geometry.hh:428
void updateInFather(const GeometryImp &fatherGeom, const GeometryImp &myGeom)
Definition: geometry.hh:474
MappingType & mapping()
Definition: geometry.hh:503
bool valid() const
Definition: geometry.hh:519
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2, const CoordPtrType &p3, const CoordPtrType &p4, const CoordPtrType &p5, const CoordPtrType &p6, const CoordPtrType &p7)
Definition: geometry.hh:452
const alu3d_ctype * point(const int i) const
Definition: geometry.hh:556
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2, const CoordPtrType &p3)
Definition: geometry.hh:573
void updateInFather(const GeometryImp &fatherGeom, const GeometryImp &myGeom)
Definition: geometry.hh:587
MappingType & mapping()
Definition: geometry.hh:616
GeometryImpl()
Definition: geometry.hh:549
void buildMapping(const vector_t &, const vector_t &, const vector_t &, const vector_t &)
Definition: topology.hh:15
Definition: topology.hh:40
Definition: topology.hh:151