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_;
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 )
provides a wrapper for ALBERTA's el_info structure
Include standard header files.
Definition: agrid.hh:60
void abs(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:328
ALBERTA REAL Real
Definition: misc.hh:48
static K determinant(const FieldMatrix< K, 0, m > &matrix)
Definition: algebra.hh:30
ALBERTA REAL_D GlobalVector
Definition: misc.hh:50
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
[ provides Dune::Grid ]
Definition: agrid.hh:109
Definition: geometry.cc:172
Definition: geometry.cc:216
Definition: albertagrid/geometry.hh:30
static constexpr int codimension
Definition: albertagrid/geometry.hh:34
Alberta::Real ctype
Definition: albertagrid/geometry.hh:38
static constexpr int mydimension
Definition: albertagrid/geometry.hh:35
std::remove_const< GridImp >::type Grid
Definition: albertagrid/geometry.hh:31
static constexpr int dimension
Definition: albertagrid/geometry.hh:33
static constexpr int coorddimension
Definition: albertagrid/geometry.hh:36
AlbertaGridCoordinateReader(const GridImp &grid, const ElementInfo &elementInfo, int subEntity)
Definition: albertagrid/geometry.hh:43
bool hasDeterminant() const
Definition: albertagrid/geometry.hh:67
FieldVector< ctype, coorddimension > Coordinate
Definition: albertagrid/geometry.hh:41
void coordinate(int i, Coordinate &x) const
Definition: albertagrid/geometry.hh:56
ctype determinant() const
Definition: albertagrid/geometry.hh:72
const ElementInfo & elementInfo() const
Definition: albertagrid/geometry.hh:51
Alberta::ElementInfo< dimension > ElementInfo
Definition: albertagrid/geometry.hh:40
geometry implementation for AlbertaGrid
Definition: albertagrid/geometry.hh:108
static constexpr int coorddimension
Definition: albertagrid/geometry.hh:124
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:153
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:175
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:218
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: geometry.cc:55
int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:162
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: geometry.cc:73
AlbertaGridGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:147
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:126
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:130
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:168
void print(std::ostream &out) const
Definition: geometry.cc:20
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:191
ctype integrationElement(const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:198
GlobalCoordinate global(const LocalCoordinate &local) const
map a point from the reference element to the geometry
Definition: geometry.cc:34
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:119
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:204
Jacobian jacobian(const LocalCoordinate &local) const
geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:238
static constexpr int codimension
Definition: albertagrid/geometry.hh:123
FieldMatrix< ctype, mydimension, coorddimension > JacobianInverse
Definition: albertagrid/geometry.hh:133
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:127
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:232
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Definition: albertagrid/geometry.hh:132
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:129
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:254
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:244
bool affine() const
returns always true since we only have simplices
Definition: albertagrid/geometry.hh:159
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: geometry.cc:90
static constexpr int dimension
Definition: albertagrid/geometry.hh:121
AlbertaGridGeometry()
Definition: albertagrid/geometry.hh:141
static constexpr int mydimension
Definition: albertagrid/geometry.hh:122
Definition: albertagrid/geometry.hh:303
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:308
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:313
Definition: albertagrid/geometry.hh:322
GlobalCoordinate corner(const int i) const
obtain the i-th corner of this geometry
Definition: albertagrid/geometry.hh:381
FieldVector< ctype, mydimension > LocalCoordinate
Definition: albertagrid/geometry.hh:342
GeometryType type() const
obtain the type of reference element
Definition: albertagrid/geometry.hh:369
void invalidate()
invalidate the geometry
Definition: albertagrid/geometry.hh:480
const JacobianInverseTransposed & jacobianInverseTransposed() const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:451
int corners() const
number of corner the geometry
Definition: albertagrid/geometry.hh:375
JacobianInverse jacobianInverse(const LocalCoordinate &local) const
inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:470
void build(const CoordReader &coordReader)
build the geometry from a coordinate reader
Definition: albertagrid/geometry.hh:487
const JacobianTransposed & jacobianTransposed() const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:434
AlbertaGridGlobalGeometry(const CoordReader &coordReader)
Definition: albertagrid/geometry.hh:363
GlobalCoordinate global(const LocalCoordinate &local) const
map a point from the reference element to the geometry
AlbertaGridGlobalGeometry()
Definition: albertagrid/geometry.hh:357
FieldMatrix< ctype, mydimension, coorddimension > JacobianInverse
Definition: albertagrid/geometry.hh:349
GlobalCoordinate center() const
return center of geometry
Definition: albertagrid/geometry.hh:392
Alberta::Real ctype
type of coordinates
Definition: albertagrid/geometry.hh:335
Jacobian jacobian(const LocalCoordinate &local) const
geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:464
ctype integrationElement() const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:412
FieldMatrix< ctype, mydimension, coorddimension > JacobianTransposed
Definition: albertagrid/geometry.hh:345
FieldMatrix< ctype, coorddimension, mydimension > Jacobian
Definition: albertagrid/geometry.hh:348
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
transposed inverse of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:458
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
transposed of the geometry mapping's Jacobian
Definition: albertagrid/geometry.hh:441
ctype integrationElement(const LocalCoordinate &local) const
integration element of the geometry mapping
Definition: albertagrid/geometry.hh:418
FieldVector< ctype, coorddimension > GlobalCoordinate
Definition: albertagrid/geometry.hh:343
ctype volume() const
volume of geometry
Definition: albertagrid/geometry.hh:424
FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed
Definition: albertagrid/geometry.hh:346
Definition: albertagrid/geometry.hh:504
static constexpr int dimension
Definition: albertagrid/geometry.hh:510
const LocalFaceGeometry & faceGeometry(int face, int twist=0) const
Definition: albertagrid/geometry.hh:566
static const This & instance()
Definition: albertagrid/geometry.hh:573
const LocalElementGeometry & geometryInFather(int child, const int orientation=1) const
Definition: albertagrid/geometry.hh:558
Codim< 1 >::LocalGeometry LocalFaceGeometry
Definition: albertagrid/geometry.hh:519
Grid::ctype ctype
Definition: albertagrid/geometry.hh:508
static constexpr int numFaceTwists
Definition: albertagrid/geometry.hh:526
static constexpr int maxFaceTwist
Definition: albertagrid/geometry.hh:525
static constexpr int numFaces
Definition: albertagrid/geometry.hh:522
static constexpr int numChildren
Definition: albertagrid/geometry.hh:521
static constexpr int minFaceTwist
Definition: albertagrid/geometry.hh:524
Codim< 0 >::LocalGeometry LocalElementGeometry
Definition: albertagrid/geometry.hh:518
Definition: albertagrid/geometry.hh:514
AlbertaGridGeometry< dimension-codim, dimension, Grid > LocalGeometry
Definition: albertagrid/geometry.hh:515
Grid abstract base class.
Definition: common/grid.hh:375
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/grid.hh:390
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:532
Wrapper and interface classes for element geometries.