3 #ifndef DUNE_ALBERTA_GEOMETRY_HH
4 #define DUNE_ALBERTA_GEOMETRY_HH
18 template<
int dim,
int dimworld >
26 template<
int codim,
class Gr
idImp >
29 typedef typename remove_const< GridImp >::type
Grid;
45 elementInfo_( elementInfo ),
46 subEntity_( subEntity )
56 assert( !elementInfo_ ==
false );
59 const int k = mapVertices( subEntity_, i );
77 static int mapVertices (
int subEntity,
int i )
104 template<
int mydim,
int cdim,
class Gr
idImp >
110 typedef GridImp Grid;
113 static const int dimbary = mydim + 1;
133 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
141 template<
class CoordReader >
144 build( coordReader );
150 typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
166 assert( (i >= 0) && (i <
corners()) );
189 assert( calcedDet_ );
246 template<
class CoordReader >
247 void build (
const CoordReader &coordReader );
249 void print ( std::ostream &out )
const;
253 ctype elDeterminant ()
const
271 mutable bool builtJT_;
273 mutable bool builtJTInv_;
275 mutable bool calcedDet_;
276 mutable ctype elDet_;
284 template<
int mydim,
int cdim,
class Gr
idImp >
296 template<
class CoordReader >
298 :
Base( coordReader )
303 #if !DUNE_ALBERTA_CACHE_COORDINATES
304 template<
int dim,
int cdim >
313 static const int dimbary = dim + 1;
335 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
343 template<
class CoordReader >
346 build( coordReader );
352 typedef typename GenericGeometry::SimplexTopology< mydimension >::type Topology;
365 assert( (i >= 0) && (i <
corners()) );
366 const Alberta::GlobalCoordinate &x = elementInfo_.coordinate( i );
377 for(
int i = 1; i < numCorners; ++i )
379 centroid_ *=
ctype( 1 ) /
ctype( numCorners );
396 return elementInfo_.geometryCache().integrationElement();
418 return elementInfo_.geometryCache().jacobianTransposed();
435 return elementInfo_.geometryCache().jacobianInverseTransposed();
456 template<
class CoordReader >
457 void build (
const CoordReader &coordReader )
459 elementInfo_ = coordReader.elementInfo();
463 ElementInfo elementInfo_;
465 #endif // #if !DUNE_ALBERTA_CACHE_COORDINATES
472 template<
class Gr
id >
482 template<
int codim >
504 buildGeometryInFather();
512 delete geometryInFather_[ child ][ 0 ];
513 delete geometryInFather_[ child ][ 1 ];
519 delete faceGeometry_[ i ][ j ];
523 void buildGeometryInFather();
524 void buildFaceGeometry();
530 assert( (child >= 0) && (child < numChildren) );
531 assert( (orientation == 1) || (orientation == -1) );
532 return *geometryInFather_[ child ][ (orientation + 1) / 2 ];
538 assert( (face >= 0) && (face < numFaces) );
545 static This theInstance;
550 template<
int codim >
551 static int mapVertices (
int subEntity,
int i )
562 #endif // #if HAVE_ALBERTA
564 #endif // #ifndef DUNE_ALBERTA_GEOMETRY_HH
Definition: albertagrid/geometry.hh:285
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:330
Alberta::Real ctype
Definition: albertagrid/geometry.hh:36
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: geometry.cc:53
Codim< 0 >::LocalGeometry LocalElementGeometry
Definition: albertagrid/geometry.hh:488
AlbertaGridCoordinateReader(const GridImp &grid, const ElementInfo &elementInfo, int subEntity)
Definition: albertagrid/geometry.hh:41
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:148
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:117
The dimension of the world the grid lives in.
Definition: common/grid.hh:408
int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:357
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:329
Definition: albertagrid/geometry.hh:27
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:350
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:433
static const int coorddimension
Definition: albertagrid/geometry.hh:122
static const int dimension
Definition: albertagrid/geometry.hh:31
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:363
ctype integrationElement(const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:194
static const int maxFaceTwist
Definition: albertagrid/geometry.hh:495
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:406
static const int mydimension
Definition: albertagrid/geometry.hh:33
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:338
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:292
AlbertaGridGeometry< dimension-codim, dimension, Grid > LocalGeometry
Definition: albertagrid/geometry.hh:485
geometry implementation for AlbertaGrid
Definition: albertagrid/geometry.hh:105
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:125
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:344
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: geometry.cc:71
static const int coorddimension
Definition: albertagrid/geometry.hh:34
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:164
remove_const< GridImp >::type Grid
Definition: albertagrid/geometry.hh:29
static const int numChildren
Definition: albertagrid/geometry.hh:491
GlobalCoordinate global(const LocalCoordinate &local) const
map a point from the refence element to the geometry
Definition: geometry.cc:32
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:228
Definition: geometry.cc:169
ALBERTA REAL Real
Definition: misc.hh:45
AlbertaGridGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:142
ALBERTA REAL_D GlobalVector
Definition: misc.hh:47
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:548
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:238
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:374
static const This & instance()
Definition: albertagrid/geometry.hh:543
Definition: albertagrid/geometry.hh:473
static const int dimension
Definition: albertagrid/geometry.hh:480
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
[ provides Dune::Grid ]
Definition: agrid.hh:137
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:200
Definition: albertagrid/geometry.hh:483
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:394
provides a wrapper for ALBERTA's el_info structure
Codim< 1 >::LocalGeometry LocalFaceGeometry
Definition: albertagrid/geometry.hh:489
static K determinant(const FieldMatrix< K, 0, m > &matrix)
Definition: algebra.hh:28
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: geometry.cc:88
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:423
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:388
static const int numFaceTwists
Definition: albertagrid/geometry.hh:496
const LocalFaceGeometry & faceGeometry(int face, int twist=0) const
Definition: albertagrid/geometry.hh:536
AlbertaGridGeometry()
Definition: albertagrid/geometry.hh:136
Definition: albertagrid/geometry.hh:305
void print(std::ostream &out) const
Definition: geometry.cc:18
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:171
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:440
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:187
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/geometry.hh:38
LocalCoordinate local(const GlobalCoordinate &global) const
map a point from the geometry to the reference element
Definition: geometry.cc:43
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:297
static const int codimension
Definition: albertagrid/geometry.hh:121
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:127
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:416
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:319
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:214
ctype determinant() const
Definition: albertagrid/geometry.hh:70
Grid::ctype ctype
Definition: albertagrid/geometry.hh:478
The dimension of the grid.
Definition: common/grid.hh:402
ctype integrationElement(const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:400
FieldVector< ctype, coorddimension > Coordinate
Definition: albertagrid/geometry.hh:39
const LocalElementGeometry & geometryInFather(int child, const int orientation=1) const
Definition: albertagrid/geometry.hh:528
Definition: geometry.cc:213
bool affine() const
returns always true since we only have simplices
Definition: albertagrid/geometry.hh:155
static const int dimension
Definition: albertagrid/geometry.hh:119
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:124
bool hasDeterminant() const
Definition: albertagrid/geometry.hh:65
Wrapper and interface classes for element geometries.
static const int mydimension
Definition: albertagrid/geometry.hh:120
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: albertagrid/geometry.hh:457
const ElementInfo & elementInfo() const
Definition: albertagrid/geometry.hh:49
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:326
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:128
static const int minFaceTwist
Definition: albertagrid/geometry.hh:494
void abs(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:326
static const int codimension
Definition: albertagrid/geometry.hh:32
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:327
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:450
int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:158
void coordinate(int i, Coordinate &x) const
Definition: albertagrid/geometry.hh:54
static const int numFaces
Definition: albertagrid/geometry.hh:492