5 #ifndef DUNE_ALBERTA_GEOMETRY_HH 6 #define DUNE_ALBERTA_GEOMETRY_HH 20 template<
int dim,
int dimworld >
28 template<
int codim,
class Gr
idImp >
31 typedef typename std::remove_const< GridImp >::type
Grid;
48 subEntity_( subEntity )
58 assert( !elementInfo_ ==
false );
61 const int k = mapVertices( subEntity_, i );
79 static int mapVertices (
int subEntity,
int i )
106 template<
int mydim,
int cdim,
class Gr
idImp >
112 typedef GridImp Grid;
115 static constexpr
int dimbary = mydim + 1;
132 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
138 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
146 template<
class CoordReader >
149 build( coordReader );
170 assert( (i >= 0) && (i <
corners()) );
193 assert( calcedDet_ );
262 template<
class CoordReader >
263 void build (
const CoordReader &coordReader );
265 void print ( std::ostream &out )
const;
269 ctype elDeterminant ()
const 287 mutable bool builtJT_;
289 mutable bool builtJTInv_;
291 mutable bool calcedDet_;
292 mutable ctype elDet_;
300 template<
int mydim,
int cdim,
class Gr
idImp >
312 template<
class CoordReader >
314 :
Base( coordReader )
319 #if !DUNE_ALBERTA_CACHE_COORDINATES 320 template<
int dim,
int cdim >
329 static constexpr
int dimbary = dim + 1;
348 typedef FieldMatrix< ctype, coorddimension, mydimension >
Jacobian;
354 typedef FieldMatrix< ctype, numCorners, coorddimension > CoordMatrix;
362 template<
class CoordReader >
365 build( coordReader );
383 assert( (i >= 0) && (i <
corners()) );
384 const Alberta::GlobalCoordinate &x = elementInfo_.coordinate( i );
395 for(
int i = 1; i < numCorners; ++i )
397 centroid_ *=
ctype( 1 ) /
ctype( numCorners );
414 return elementInfo_.geometryCache().integrationElement();
436 return elementInfo_.geometryCache().jacobianTransposed();
453 return elementInfo_.geometryCache().jacobianInverseTransposed();
486 template<
class CoordReader >
487 void build (
const CoordReader &coordReader )
489 elementInfo_ = coordReader.elementInfo();
493 ElementInfo elementInfo_;
495 #endif // #if !DUNE_ALBERTA_CACHE_COORDINATES 502 template<
class Gr
id >
512 template<
int codim >
534 buildGeometryInFather();
542 delete geometryInFather_[ child ][ 0 ];
543 delete geometryInFather_[ child ][ 1 ];
549 delete faceGeometry_[ i ][ j ];
553 void buildGeometryInFather();
554 void buildFaceGeometry();
561 assert( (orientation == 1) || (orientation == -1) );
562 return *geometryInFather_[ child ][ (orientation + 1) / 2 ];
568 assert( (face >= 0) && (face <
numFaces) );
575 static This theInstance;
580 template<
int codim >
581 static int mapVertices (
int subEntity,
int i )
592 #endif // #if HAVE_ALBERTA 594 #endif // #ifndef DUNE_ALBERTA_GEOMETRY_HH int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:162
void abs(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:328
const JacobianInverseTransposed & jacobianInverseTransposed([[maybe_unused]] const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:232
void print(std::ostream &out) const
Definition: geometry.cc:20
ctype integrationElement(const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:418
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/grid.hh:390
ctype integrationElement([[maybe_unused]] const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:198
Definition: albertagrid/geometry.hh:503
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: geometry.cc:90
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:244
static constexpr int numChildren
Definition: albertagrid/geometry.hh:521
geometry implementation for AlbertaGrid
Definition: albertagrid/geometry.hh:107
Jacobian jacobian(const LocalCoordinate &local) const
geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:238
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:470
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:308
Alberta::Real ctype
Definition: albertagrid/geometry.hh:38
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:254
static constexpr int maxFaceTwist
Definition: albertagrid/geometry.hh:525
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:369
provides a wrapper for ALBERTA's el_info structure
int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:375
const LocalElementGeometry & geometryInFather(int child, const int orientation=1) const
Definition: albertagrid/geometry.hh:558
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:375
AlbertaGridGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:147
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: albertagrid/geometry.hh:487
ctype determinant() const
Definition: albertagrid/geometry.hh:72
static const This & instance()
Definition: albertagrid/geometry.hh:573
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:335
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:168
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:412
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:127
static constexpr int dimension
Definition: albertagrid/geometry.hh:33
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:381
ALBERTA REAL_D GlobalVector
Definition: misc.hh:50
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:130
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:204
AlbertaGridGeometry< dimension-codim, dimension, Grid > LocalGeometry
Definition: albertagrid/geometry.hh:515
static constexpr int codimension
Definition: albertagrid/geometry.hh:123
static constexpr int mydimension
Definition: albertagrid/geometry.hh:35
static constexpr int numFaceTwists
Definition: albertagrid/geometry.hh:526
static constexpr int coorddimension
Definition: albertagrid/geometry.hh:124
const JacobianTransposed & jacobianTransposed([[maybe_unused]] const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:218
std::remove_const< GridImp >::type Grid
Definition: albertagrid/geometry.hh:31
static constexpr int numFaces
Definition: albertagrid/geometry.hh:522
ALBERTA REAL Real
Definition: misc.hh:48
AlbertaGridCoordinateReader(const GridImp &grid, const ElementInfo &elementInfo, int subEntity)
Definition: albertagrid/geometry.hh:43
static constexpr int coorddimension
Definition: albertagrid/geometry.hh:36
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:392
Jacobian jacobian(const LocalCoordinate &local) const
geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:464
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:345
static constexpr int dimension
Definition: albertagrid/geometry.hh:510
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:424
const ElementInfo & elementInfo() const
Definition: albertagrid/geometry.hh:51
static constexpr int minFaceTwist
Definition: albertagrid/geometry.hh:524
FieldVector< ctype, coorddimension > Coordinate
Definition: albertagrid/geometry.hh:41
Codim< 1 >::LocalGeometry LocalFaceGeometry
Definition: albertagrid/geometry.hh:519
LocalCoordinate local(const GlobalCoordinate &global) const
map a point from the geometry to the reference element
Definition: geometry.cc:45
Definition: geometry.cc:171
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: geometry.cc:73
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: geometry.cc:55
Include standard header files.
Definition: agrid.hh:59
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:434
Grid::ctype ctype
Definition: albertagrid/geometry.hh:508
static constexpr int codimension
Definition: albertagrid/geometry.hh:34
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:342
bool affine() const
returns always true since we only have simplices
Definition: albertagrid/geometry.hh:159
Definition: albertagrid/geometry.hh:321
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:129
static constexpr int dimension
Definition: albertagrid/geometry.hh:121
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:153
AlbertaGridGeometry()
Definition: albertagrid/geometry.hh:141
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:458
FieldMatrix< ctype, mydimension, coorddimension > JacobianInverse
Definition: albertagrid/geometry.hh:133
Codim< 0 >::LocalGeometry LocalElementGeometry
Definition: albertagrid/geometry.hh:518
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:346
GlobalCoordinate global(const LocalCoordinate &local) const
map a point from the reference element to the geometry
Definition: geometry.cc:34
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:441
bool hasDeterminant() const
Definition: albertagrid/geometry.hh:67
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/geometry.hh:40
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:451
void coordinate(int i, Coordinate &x) const
Definition: albertagrid/geometry.hh:56
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:518
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:480
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:191
Definition: albertagrid/geometry.hh:29
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:357
[ provides Dune::Grid ]
Definition: agrid.hh:106
Wrapper and interface classes for element geometries.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
const LocalFaceGeometry & faceGeometry(int face, int twist=0) const
Definition: albertagrid/geometry.hh:566
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:343
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Definition: albertagrid/geometry.hh:348
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:119
static K determinant([[maybe_unused]] const FieldMatrix< K, 0, m > &matrix)
Definition: algebra.hh:30
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:175
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:363
FieldMatrix< ctype, mydimension, coorddimension > JacobianInverse
Definition: albertagrid/geometry.hh:349
Definition: albertagrid/geometry.hh:513
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Definition: albertagrid/geometry.hh:132
static constexpr int mydimension
Definition: albertagrid/geometry.hh:122
Definition: albertagrid/geometry.hh:301
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:313
Definition: geometry.cc:215
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:126