Go to the documentation of this file.
3 #ifndef DUNE_GRID_GEOMETRY_HH
4 #define DUNE_GRID_GEOMETRY_HH
12 #include <dune/common/fmatrix.hh>
13 #include <dune/common/typetraits.hh>
15 #include <dune/geometry/referenceelements.hh>
23 template<
int dim,
int dimworld,
class ct,
class Gr
idFamily >
65 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp >
95 typedef typename GridImp::ctype
ctype;
155 return impl().corner( i );
164 return impl().global( local );
201 return impl().integrationElement( local );
207 return impl().volume();
222 return impl().center();
238 return impl().jacobianTransposed( local );
264 return impl().jacobianInverseTransposed(local);
297 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
305 typedef typename GridImp::ctype
ctype;
322 auto refElement = referenceElement< ctype , mydim >(type);
326 const int corners = refElement.size(0,0,mydim);
327 for(
int i=0; i<corners; ++i) localBaryCenter += refElement.position(i,mydim);
328 localBaryCenter *= (
ctype) (1.0/corners);
331 return refElement.volume() * asImp().integrationElement(localBaryCenter);
340 auto refElement = referenceElement< ctype , mydim >(type);
344 return asImp().global(refElement.position(0,0));
349 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
350 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
353 template<
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
364 typedef typename GridImp::ctype
ctype;
376 FieldVector<ctype, cdim>
global (
const FieldVector<ctype, mydim>& local)
const
378 return asImp().corner(0);
382 FieldVector<ctype, mydim> local (
const FieldVector<ctype, cdim>& )
const
384 return FieldVector<ctype, mydim>();
396 return asImp().corner(0);
401 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
402 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
410 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp>
433 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp,
typename Impl>
435 -> decltype(referenceElement<typename GridImp::ctype,mydim>(geo.type()))
438 return referenceElement<typename Geo::ctype,Geo::mydimension>(geo.type());
443 #endif // DUNE_GRID_GEOMETRY_HH
GeometryType type() const
Return the type of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/geometry.hh:128
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: common/geometry.hh:98
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: common/geometry.hh:262
GridImp::ctype ctype
Definition: common/geometry.hh:364
Default implementation for class Geometry.
Definition: common/geometry.hh:298
Implementation & impl()
access to the underlying implementation
Definition: common/geometry.hh:81
ctype integrationElement(const LocalCoordinate &local) const
Return the factor appearing in the integral transformation formula.
Definition: common/geometry.hh:199
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
int corners() const
Return the number of corners of the reference element.
Definition: common/geometry.hh:139
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: common/geometry.hh:95
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:112
const Implementation & impl() const
access to the underlying implementation
Definition: common/geometry.hh:87
GlobalCoordinate global(const LocalCoordinate &local) const
Evaluate the map .
Definition: common/geometry.hh:162
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
Return the transposed of the Jacobian.
Definition: common/geometry.hh:236
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: common/geometry.hh:101
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:373
ctype volume() const
return volume of geometry
Definition: common/geometry.hh:205
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: common/geometry.hh:131
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: common/geometry.hh:153
static const int coorddimension
Definition: common/geometry.hh:302
static const int mydimension
Definition: common/geometry.hh:301
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: common/geometry.hh:273
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo, const Impl &impl) -> decltype(referenceElement< typename GridImp::ctype, mydim >(geo.type()))
Second-level dispatch to select the correct reference element for a grid geometry.
Definition: common/geometry.hh:434
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:308
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:314
@ mydimension
Definition: common/geometry.hh:90
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:367
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:366
GlobalCoordinate center() const
return center of geometry
Definition: common/geometry.hh:220
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:317
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:311
GridImp::ctype ctype
Definition: common/geometry.hh:305
Wrapper class for geometries.
Definition: common/geometry.hh:66
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition: common/geometry.hh:411
@ coorddimension
Definition: common/geometry.hh:92
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:370
GeometryImp< mydim, cdim, GridImp > Implementation
type of underlying implementation
Definition: common/geometry.hh:74
Include standard header files.
Definition: agrid.hh:58
GlobalCoordinate center() const
return center of the geometry
Definition: common/geometry.hh:335
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:307
FieldVector< ctype, cdim > global(const FieldVector< ctype, mydim > &local) const
return the only coordinate
Definition: common/geometry.hh:376
Implementation::JacobianTransposed JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:123
Implementation realGeometry
Definition: common/geometry.hh:285
Definition: common/geometry.hh:24
FieldVector< ctype, cdim > center() const
return center of the geometry
Definition: common/geometry.hh:394
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:388