3 #ifndef DUNE_ALU3DGRIDGEOMETRY_HH 4 #define DUNE_ALU3DGRIDGEOMETRY_HH 9 #include <dune/common/power.hh> 22 template<
int cd,
int dim,
class Gr
idImp>
23 class ALU3dGridEntity;
24 template<
int cd,
class Gr
idImp >
25 class ALU3dGridEntityPointer;
26 template<
int mydim,
int coorddim,
class Gr
idImp>
27 class ALU3dGridGeometry;
28 template< ALU3dGr
idElementType,
class >
30 class BilinearSurfaceMapping;
31 class TrilinearMapping;
33 template<
class Gr
idImp >
34 class ALU3dGridIntersectionIterator;
46 template <
int dim,
int corners,
class Mapping>
60 template <
int dummy,
int dimused>
63 typedef CoordinateMatrixType
Type;
69 typedef CoordinateMatrixType*
Type;
123 template <
class CoordPtrType>
124 static inline void copy(
const CoordPtrType& p,
125 CoordinateVectorType& c)
133 template <
class CoordPtrType>
141 const CoordPtrType& )
const 143 DUNE_THROW(InvalidStateException,
"This method should not be called!");
146 template <
class CoordPtrType>
150 const CoordPtrType& )
const 152 DUNE_THROW(InvalidStateException,
"This method should not be called!");
155 template <
class CoordPtrType>
158 const CoordPtrType& )
const 160 DUNE_THROW(InvalidStateException,
"This method should not be called!");
177 template <
int dummy,
int dim,
181 template <
int dummy,
int dim, ALU3dGr
idElementType eltype>
186 using BaseType :: corners_ ;
187 using BaseType :: copy ;
188 using BaseType :: coord_ ;
189 using BaseType :: map_ ;
190 using BaseType :: status_ ;
194 using BaseType :: update ;
195 using BaseType :: valid ;
198 inline const CoordinateVectorType& operator [] (
const int i)
const 216 template <
class CoordPtrType>
217 inline void update(
const CoordPtrType& p0)
227 template <
int dummy, ALU3dGr
idElementType eltype>
234 using BaseType :: corners_ ;
235 using BaseType :: copy ;
236 using BaseType :: coord_ ;
237 using BaseType :: map_ ;
238 using BaseType :: status_ ;
242 using BaseType :: update ;
243 using BaseType :: valid ;
246 inline const CoordinateVectorType& operator [] (
const int i)
const 264 template <
class CoordPtrType>
265 inline void update(
const CoordPtrType& p0,
266 const CoordPtrType& p1)
283 using BaseType :: corners_ ;
284 using BaseType :: copy ;
285 using BaseType :: coord_ ;
286 using BaseType :: map_ ;
287 using BaseType :: status_ ;
291 using BaseType :: update ;
292 using BaseType :: valid ;
295 inline const CoordinateVectorType& operator [] (
const int i)
const 303 template <
class CoordPtrType>
304 inline void update(
const CoordPtrType& p0,
305 const CoordPtrType& p1,
306 const CoordPtrType& p2)
340 using BaseType :: corners_ ;
341 using BaseType :: copy ;
342 using BaseType :: coord_ ;
343 using BaseType :: map_ ;
344 using BaseType :: status_ ;
348 using BaseType :: update ;
349 using BaseType :: valid ;
352 inline const CoordinateVectorType& operator [] (
const int i)
const 360 template <
class CoordPtrType>
361 inline void update(
const CoordPtrType& p0,
362 const CoordPtrType& p1,
363 const CoordPtrType& p2,
364 const CoordPtrType& p3)
393 using BaseType :: corners_ ;
394 using BaseType :: copy ;
395 using BaseType :: coord_ ;
396 using BaseType :: map_ ;
397 using BaseType :: status_ ;
407 using BaseType :: update ;
408 using BaseType :: valid ;
428 assert( coordPtr_[i] );
429 return coordPtr_[ i ];
433 inline CoordinateVectorType operator [] (
const int i)
const 435 CoordinateVectorType coord ;
436 copy( point( i ), coord );
441 inline void update(
const CoordPtrType& p0,
442 const CoordPtrType& p1,
443 const CoordPtrType& p2,
444 const CoordPtrType& p3,
445 const CoordPtrType& p4,
446 const CoordPtrType& p5,
447 const CoordPtrType& p6,
448 const CoordPtrType& p7)
450 coordPtr_[0] = &p0[ 0 ];
451 coordPtr_[1] = &p1[ 0 ];
452 coordPtr_[2] = &p2[ 0 ];
453 coordPtr_[3] = &p3[ 0 ];
454 coordPtr_[4] = &p4[ 0 ];
455 coordPtr_[5] = &p5[ 0 ];
456 coordPtr_[6] = &p6[ 0 ];
457 coordPtr_[7] = &p7[ 0 ];
462 template <
class GeometryImp>
464 const GeometryImp &myGeom)
471 CoordinateMatrixType& coord = *
coord_;
473 for(
int i=0; i < myGeom.corners() ; ++i)
476 coord[i] = fatherGeom.local( myGeom.corner( i ) );
479 coordPtr_[i] = (&(coord[i][0]));
482 for(
int j=0; j<cdim; ++j)
484 if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
497 map_.buildMapping( point( 0 ), point( 1 ), point( 2 ), point( 3 ),
498 point( 4 ), point( 5 ), point( 6 ), point( 7 ) );
520 using BaseType :: corners_ ;
521 using BaseType :: copy ;
522 using BaseType :: coord_ ;
523 using BaseType :: map_ ;
524 using BaseType :: status_ ;
534 using BaseType :: update ;
535 using BaseType :: valid ;
555 assert( coordPtr_[ i ] );
556 return coordPtr_[ i ];
560 inline CoordinateVectorType operator [] (
const int i)
const 562 CoordinateVectorType coord ;
563 copy( point( i ), coord );
568 inline void update(
const CoordPtrType& p0,
569 const CoordPtrType& p1,
570 const CoordPtrType& p2,
571 const CoordPtrType& p3)
573 coordPtr_[0] = &p0[ 0 ];
574 coordPtr_[1] = &p1[ 0 ];
575 coordPtr_[2] = &p2[ 0 ];
576 coordPtr_[3] = &p3[ 0 ];
581 template <
class GeometryImp>
583 const GeometryImp & myGeom)
590 CoordinateMatrixType& coord = *
coord_;
592 for(
int i=0; i < myGeom.corners() ; ++i)
595 coord[i] = fatherGeom.local( myGeom.corner( i ) );
598 coordPtr_[i] = (&(coord[i][0]));
601 for(
int j=0; j<cdim; ++j)
603 if ( coord[i][j] < 1e-16) coord[i][j] = 0.0;
616 map_.buildMapping( point( 0 ), point( 1 ), point( 2 ), point( 3 ) );
624 template <
int mydim,
int cdim,
class Gr
idImp>
630 typedef typename GridImp::MPICommunicatorType Comm;
647 enum {
corners_ = (elementType ==
hexa) ? StaticPower<2,mydim>::power : mydim+1 };
651 template GeometryImpl<0, mydim, elementType > GeometryImplType;
654 typedef typename GridImp :: ctype
ctype;
669 typedef FieldMatrix<ctype,
690 int corners ()
const;
693 GlobalCoordinate corner (
int i)
const;
697 GlobalCoordinate global (
const LocalCoordinate& local)
const;
701 LocalCoordinate local (
const GlobalCoordinate& global)
const;
704 ctype integrationElement (
const LocalCoordinate& local)
const;
708 const JacobianInverseTransposed &jacobianInverseTransposed (
const LocalCoordinate& local)
const;
711 const JacobianTransposed& jacobianTransposed (
const LocalCoordinate& local)
const;
714 inline bool affine ()
const;
723 bool buildGeom(
const IMPLElementType & item);
724 bool buildGeom(
const HFaceType & item,
int twist,
int faceNum);
725 bool buildGeom(
const HEdgeType & item,
int twist,
int);
726 bool buildGeom(
const VertexType & item,
int twist,
int);
729 bool buildGeom(
const FaceCoordinatesType& coords);
732 template <
class coord_t>
733 bool buildGeom(
const coord_t& p0,
739 template <
class coord_t>
740 bool buildGeom(
const coord_t& p0,
745 template <
class GeometryType>
750 void print (std::ostream& ss)
const;
756 bool valid ()
const ;
772 #ifdef USE_SMP_PARALLEL 774 static std::vector< GeometryProviderType > storage( GridObjectFactoryType :: maxThreads() );
775 return storage[ GridObjectFactoryType :: threadNumber () ];
777 static GeometryProviderType storage;
795 #include "geometry_imp.cc" bool operator!() const
return true if object has no references anymore
Definition: alugrid/3d/geometry.hh:117
void updateInFather(const GeometryImp &fatherGeom, const GeometryImp &myGeom)
Definition: alugrid/3d/geometry.hh:463
void operator--()
decrease reference count
Definition: alugrid/3d/geometry.hh:114
const alu3d_ctype * point(const int i) const
Definition: alugrid/3d/geometry.hh:424
static GeometryProviderType & geoProvider()
return storage provider for geometry objects
Definition: alugrid/3d/geometry.hh:770
double alu3d_ctype
Definition: alu3dinclude.hh:59
general type of geometry implementation
Definition: alugrid/3d/geometry.hh:178
void update(const CoordPtrType &p0)
Definition: alugrid/3d/geometry.hh:217
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: alugrid/3d/geometry.hh:663
Definition: mappings.hh:30
Definition: objectfactory.hh:26
void operator++()
increase reference count
Definition: alugrid/3d/geometry.hh:111
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:374
CoordinateStorageType coord_
to coordinates
Definition: alugrid/3d/geometry.hh:78
void updateInFather(const GeometryImp &fatherGeom, const GeometryImp &myGeom)
Definition: alugrid/3d/geometry.hh:582
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: alugrid/3d/geometry.hh:147
GeometryImplBase()
default constructor
Definition: alugrid/3d/geometry.hh:93
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2)
Definition: alugrid/3d/geometry.hh:304
GeometryImplType & geoImpl() const
Definition: alugrid/3d/geometry.hh:783
CoordinateMatrixType Type
Definition: alugrid/3d/geometry.hh:63
double volume_
volume of element
Definition: alugrid/3d/geometry.hh:84
organize the memory management for entitys used by the NeighborIterator
Definition: alugrid/2d/grid.hh:68
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
static const signed char buildmapping
Definition: alugrid/3d/geometry.hh:44
Definition: alugrid/3d/geometry.hh:37
void reset()
reset status and reference count
Definition: alugrid/3d/geometry.hh:102
static const signed char invalid
Definition: alugrid/3d/geometry.hh:42
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:205
Definition: topology.hh:13
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: alugrid/3d/geometry.hh:660
void invalidate()
Definition: alugrid/3d/geometry.hh:164
FieldMatrix< alu3d_ctype, corners, cdim > CoordinateMatrixType
the vertex coordinates
Definition: alugrid/3d/geometry.hh:58
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:315
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2, const CoordPtrType &p3)
Definition: alugrid/3d/geometry.hh:568
Mapping MappingType
the type of the mapping
Definition: alugrid/3d/geometry.hh:75
bool valid() const
Definition: alugrid/3d/geometry.hh:167
void update(const CoordPtrType &p0, const CoordPtrType &p1)
Definition: alugrid/3d/geometry.hh:265
FieldVector< alu3d_ctype, cdim > CoordinateVectorType
Definition: alugrid/3d/geometry.hh:40
Definition: alugrid/3d/entity.hh:32
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: alugrid/3d/geometry.hh:657
Definition: alu3dinclude.hh:201
void update(const CoordPtrType &p0, const CoordPtrType &p1, const CoordPtrType &p2, const CoordPtrType &p3)
Definition: alugrid/3d/geometry.hh:361
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: alugrid/3d/geometry.hh:441
~GeometryImpl()
Definition: alugrid/3d/geometry.hh:546
Definition: topology.hh:16
A bilinear surface mapping.
Definition: mappings.hh:144
FieldMatrix< ctype, EntityCount< elementType >::numVerticesPerFace, 3 > FaceCoordinatesType
Definition: alugrid/3d/geometry.hh:670
Definition: alugrid/3d/entity.hh:28
bool stillUsed() const
return true if there exists more then on reference
Definition: alugrid/3d/geometry.hh:120
unsigned int refCount_
the reference counter
Definition: alugrid/3d/geometry.hh:87
CoordTypeExtractorType< 0, dim >::Type CoordinateStorageType
Definition: alugrid/3d/geometry.hh:72
bool valid() const
Definition: alugrid/3d/geometry.hh:508
ALUMemoryProvider< GeometryImplType > GeometryProviderType
Definition: alugrid/3d/geometry.hh:767
Definition: topology.hh:126
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:253
void setVolume(const double volume)
Definition: alugrid/3d/geometry.hh:170
static void copy(const CoordPtrType &p, CoordinateVectorType &c)
Definition: alugrid/3d/geometry.hh:124
GeometryImplType * geoImpl_
Definition: alugrid/3d/geometry.hh:790
Definition: topology.hh:13
MappingType map_
the mapping
Definition: alugrid/3d/geometry.hh:81
void invalidate()
Definition: alugrid/3d/geometry.hh:505
double volume() const
Definition: alugrid/3d/geometry.hh:173
CoordinateMatrixType * Type
Definition: alugrid/3d/geometry.hh:69
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:611
GeometryImpl()
constructor creating geo impl
Definition: alugrid/3d/geometry.hh:411
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: alugrid/3d/geometry.hh:666
MappingType & mapping()
Definition: alugrid/3d/geometry.hh:492
const alu3d_ctype * point(const int i) const
Definition: alugrid/3d/geometry.hh:551
Include standard header files.
Definition: agrid.hh:59
Definition: alugrid/3d/geometry.hh:61
ALU3dGridElementType
Definition: topology.hh:13
static const signed char updated
Definition: alugrid/3d/geometry.hh:43
Different resources needed by all grid implementations.
GridImp::ctype ctype
Definition: alugrid/3d/geometry.hh:654
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: alugrid/3d/geometry.hh:134
static const int corners_
number of corners
Definition: alugrid/3d/geometry.hh:55
Definition: alugrid/3d/geometry.hh:47
void update(const CoordPtrType &, const CoordPtrType &, const CoordPtrType &) const
Definition: alugrid/3d/geometry.hh:156
GeometryImpl()
Definition: alugrid/3d/geometry.hh:538
Definition: topology.hh:40
signed char status_
the status (see different status above)
Definition: alugrid/3d/geometry.hh:90
Default implementation for class Geometry.
Definition: common/geometry.hh:301
~GeometryImpl()
Definition: alugrid/3d/geometry.hh:419