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 >
64 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp >
67 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
73 GridImp::
dimension, GridImp::dimensionworld,
74 typename GridImp::ctype,
75 typename GridImp::GridFamily> ;
98 typedef typename GridImp::ctype
ctype;
158 return impl().corner( i );
167 return impl().global( local );
176 return impl().local( global );
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;
325 const ReferenceElement< ctype , mydim > & refElement =
326 ReferenceElements< ctype, mydim >::general(type);
328 LocalCoordinate localBaryCenter ( 0 );
330 const int corners = refElement.size(0,0,mydim);
331 for(
int i=0; i<corners; ++i) localBaryCenter += refElement.position(i,mydim);
332 localBaryCenter *= (
ctype) (1.0/corners);
335 return refElement.volume() * asImp().integrationElement(localBaryCenter);
344 const ReferenceElement< ctype , mydim > & refElement =
345 ReferenceElements< ctype, mydim >::general(type);
349 return asImp().global(refElement.position(0,0));
354 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
355 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
358 template<
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
369 typedef typename GridImp::ctype
ctype;
381 FieldVector<ctype, cdim>
global (
const FieldVector<ctype, mydim>& local)
const
383 return asImp().corner(0);
387 FieldVector<ctype, mydim>
local (
const FieldVector<ctype, cdim>& )
const
389 return FieldVector<ctype, mydim>();
401 return asImp().corner(0);
406 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
407 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
412 #endif // DUNE_GRID_GEOMETRY_HH
GlobalCoordinate center() const
return center of the geometry
Definition: common/geometry.hh:339
JacobianInverseTransposed jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: common/geometry.hh:265
LocalCoordinate local(const GlobalCoordinate &global) const
Evaluate the inverse map .
Definition: common/geometry.hh:174
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: common/geometry.hh:101
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:320
GeometryImp< mydim, cdim, GridImp > Implementation
Definition: common/geometry.hh:78
Implementation realGeometry
Definition: common/geometry.hh:288
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: common/geometry.hh:276
Definition: common/geometry.hh:89
GridImp::ctype ctype
Definition: common/geometry.hh:308
Definition: common/geometry.hh:91
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:311
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:317
Definition: common/geometry.hh:96
ctype volume() const
return volume of geometry
Definition: common/geometry.hh:208
JacobianTransposed jacobianTransposed(const LocalCoordinate &local) const
Return the transposed of the Jacobian.
Definition: common/geometry.hh:239
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:314
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: common/geometry.hh:98
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: common/geometry.hh:134
Implementation::JacobianTransposed JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:126
int corners() const
Return the number of corners of the reference element.
Definition: common/geometry.hh:142
Wrapper class for geometries.
Definition: common/geometry.hh:65
static const int coorddimension
Definition: common/geometry.hh:305
GlobalCoordinate center() const
return center of geometry
Definition: common/geometry.hh:223
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:372
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: common/geometry.hh:156
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/geometry.hh:131
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:115
Definition: common/geometry.hh:24
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:378
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:393
static const int mydimension
Definition: common/geometry.hh:304
Definition: common/geometry.hh:87
const Implementation & impl() const
return reference to the 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:202
FieldVector< ctype, cdim > center() const
return center of the geometry
Definition: common/geometry.hh:399
FieldVector< ctype, cdim > global(const FieldVector< ctype, mydim > &local) const
return the only coordinate
Definition: common/geometry.hh:381
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:375
FieldVector< ctype, mydim > local(const FieldVector< ctype, cdim > &) const
return empty vector
Definition: common/geometry.hh:387
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: common/geometry.hh:104
Include standard header files.
Definition: agrid.hh:59
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:310
Default implementation for class Geometry.
Definition: common/geometry.hh:301
GridImp::ctype ctype
Definition: common/geometry.hh:369
GlobalCoordinate global(const LocalCoordinate &local) const
Evaluate the map .
Definition: common/geometry.hh:165
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:371
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178