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 >
24 class GridDefaultImplementation;
65 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp >
95 typedef typename GridImp::ctype
ctype;
158 return impl().corner( i );
167 return impl().global( local );
204 return impl().integrationElement( local );
210 return impl().volume();
225 return impl().center();
241 return impl().jacobianTransposed( local );
267 return impl().jacobianInverseTransposed(local);
300 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
308 typedef typename GridImp::ctype
ctype;
328 auto refElement = referenceElement< ctype , mydim >(type);
332 const int corners = refElement.size(0,0,mydim);
333 for(
int i=0; i<corners; ++i) localBaryCenter += refElement.position(i,mydim);
334 localBaryCenter *= (
ctype) (1.0/corners);
337 return refElement.volume() * asImp().integrationElement(localBaryCenter);
346 auto refElement = referenceElement< ctype , mydim >(type);
350 return asImp().global(refElement.position(0,0));
355 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
356 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
359 template<
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
370 typedef typename GridImp::ctype
ctype;
383 FieldVector<ctype, cdim> global (
const FieldVector<ctype, mydim>& local)
const
385 return asImp().corner(0);
389 FieldVector<ctype, mydim> local (
const FieldVector<ctype, cdim>& )
const
391 return FieldVector<ctype, mydim>();
403 return asImp().corner(0);
408 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
409 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
417 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp>
440 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp,
typename Impl>
442 -> decltype(referenceElement<typename GridImp::ctype,mydim>(geo.type()))
445 return referenceElement<typename Geo::ctype,Geo::mydimension>(geo.type());
Include standard header files.
Definition: agrid.hh:59
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition: common/geometry.hh:418
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:180
Wrapper class for geometries.
Definition: common/geometry.hh:67
const Implementation & impl() const
access to the underlying implementation
Definition: common/geometry.hh:87
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: common/geometry.hh:101
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
Return the transposed of the Jacobian.
Definition: common/geometry.hh:239
GeometryType type() const
Return the type of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/geometry.hh:131
GlobalCoordinate global(const LocalCoordinate &local) const
Evaluate the map .
Definition: common/geometry.hh:165
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: common/geometry.hh:276
@ mydimension
Definition: common/geometry.hh:90
Implementation::JacobianTransposed JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:126
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:115
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: common/geometry.hh:156
decltype(std::declval< Implementation >().volume()) typedef Volume
Number type used for the geometry volume.
Definition: common/geometry.hh:104
int corners() const
Return the number of corners of the reference element.
Definition: common/geometry.hh:142
Volume volume() const
return volume of geometry
Definition: common/geometry.hh:208
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: common/geometry.hh:95
ctype integrationElement(const LocalCoordinate &local) const
Return the factor appearing in the integral transformation formula.
Definition: common/geometry.hh:202
Implementation & impl()
access to the underlying implementation
Definition: common/geometry.hh:81
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: common/geometry.hh:98
Implementation realGeometry
Definition: common/geometry.hh:288
GlobalCoordinate center() const
return center of geometry
Definition: common/geometry.hh:223
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: common/geometry.hh:134
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:441
@ coorddimension
Definition: common/geometry.hh:92
GeometryImp< mydim, cdim, GridImp > Implementation
type of underlying implementation
Definition: common/geometry.hh:74
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: common/geometry.hh:265
Default implementation for class Geometry.
Definition: common/geometry.hh:302
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:311
static const int mydimension
Definition: common/geometry.hh:304
Volume volume() const
return volume of the geometry
Definition: common/geometry.hh:323
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:310
GlobalCoordinate center() const
return center of the geometry
Definition: common/geometry.hh:341
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:320
GridImp::ctype ctype
Definition: common/geometry.hh:308
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:317
static const int coorddimension
Definition: common/geometry.hh:305
ctype Volume
Number type used for the geometry volume.
Definition: common/geometry.hh:314
GridImp::ctype ctype
Definition: common/geometry.hh:370
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:373
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:377
ctype Volume
Definition: common/geometry.hh:374
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:372
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:380
FieldVector< ctype, cdim > center() const
return center of the geometry
Definition: common/geometry.hh:401
Volume volume() const
return volume of the geometry
Definition: common/geometry.hh:395