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 );
173 return impl().local( global );
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);
324 LocalCoordinate localBaryCenter ( 0 );
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 FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:366
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: common/geometry.hh:98
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: common/geometry.hh:153
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:388
int corners() const
Return the number of corners of the reference element.
Definition: common/geometry.hh:139
GridImp::ctype ctype
Definition: common/geometry.hh:364
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: common/geometry.hh:95
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:373
FieldVector< ctype, cdim > center() const
return center of the geometry
Definition: common/geometry.hh:394
LocalCoordinate local(const GlobalCoordinate &global) const
Evaluate the inverse map .
Definition: common/geometry.hh:171
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:311
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:308
GlobalCoordinate center() const
return center of geometry
Definition: common/geometry.hh:220
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: common/geometry.hh:262
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: common/geometry.hh:273
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
Return the transposed of the Jacobian.
Definition: common/geometry.hh:236
Definition: common/geometry.hh:92
Default implementation for class Geometry.
Definition: common/geometry.hh:298
GlobalCoordinate center() const
return center of the geometry
Definition: common/geometry.hh:335
Definition: common/geometry.hh:90
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:370
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:314
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Wrapper class for geometries.
Definition: common/geometry.hh:66
ctype integrationElement(const LocalCoordinate &local) const
Return the factor appearing in the integral transformation formula.
Definition: common/geometry.hh:199
Implementation & impl()
access to the underlying implementation
Definition: common/geometry.hh:81
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, cdim > GlobalCoordinate
Definition: common/geometry.hh:367
ctype volume() const
return volume of geometry
Definition: common/geometry.hh:205
GridImp::ctype ctype
Definition: common/geometry.hh:305
Definition: common/geometry.hh:24
Implementation::JacobianTransposed JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:123
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
GeometryImp< mydim, cdim, GridImp > Implementation
type of underlying implementation
Definition: common/geometry.hh:74
FieldVector< ctype, cdim > global(const FieldVector< ctype, mydim > &local) const
return the only coordinate
Definition: common/geometry.hh:376
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: common/geometry.hh:101
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: common/geometry.hh:131
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
GlobalCoordinate global(const LocalCoordinate &local) const
Evaluate the map .
Definition: common/geometry.hh:162
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:307
Include standard header files.
Definition: agrid.hh:58
Implementation realGeometry
Definition: common/geometry.hh:285
FieldVector< ctype, mydim > local(const FieldVector< ctype, cdim > &) const
return empty vector
Definition: common/geometry.hh:382