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 >
28 namespace FacadeOptions
45 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp >
49 static const bool v =
true;
100 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class >
class GeometryImp >
103 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
109 GridImp::
dimension, GridImp::dimensionworld,
110 typename GridImp::ctype,
111 typename GridImp::GridFamily> ;
130 typedef typename GridImp::ctype
ctype;
178 return impl().corner( i );
187 return impl().global( local );
196 return impl().local( global );
224 return impl().integrationElement( local );
230 return impl().volume();
245 return impl().center();
260 return impl().jacobianTransposed( local );
285 return impl().jacobianInverseTransposed(local);
292 deprecationWarning ( integral_constant< bool, storeReference >() );
299 void DUNE_DEPRECATED_MSG(
"This Dune::Geometry is still a reference to its implementation." )
300 deprecationWarning ( integral_constant<
bool, true > ) {}
303 deprecationWarning ( integral_constant< bool, false > ) {}
308 typename conditional< storeReference, const Implementation &, Implementation >::type
realGeometry;
320 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
328 typedef typename GridImp::ctype
ctype;
345 const ReferenceElement< ctype , mydim > & refElement =
346 ReferenceElements< ctype, mydim >::general(type);
350 const int corners = refElement.size(0,0,mydim);
351 for(
int i=0; i<corners; ++i) localBaryCenter += refElement.position(i,mydim);
352 localBaryCenter *= (
ctype) (1.0/corners);
355 return refElement.volume() * asImp().integrationElement(localBaryCenter);
364 const ReferenceElement< ctype , mydim > & refElement =
365 ReferenceElements< ctype, mydim >::general(type);
369 return asImp().global(refElement.position(0,0));
374 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
375 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
378 template<
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
389 typedef typename GridImp::ctype
ctype;
401 FieldVector<ctype, cdim>
global (
const FieldVector<ctype, mydim>& local)
const
403 return asImp().corner(0);
407 FieldVector<ctype, mydim>
local (
const FieldVector<ctype, cdim>& )
const
409 return FieldVector<ctype, mydim>();
427 return asImp().corner(0);
432 GeometryImp<mydim,cdim,GridImp>& asImp () {
return static_cast<GeometryImp<mydim,cdim,GridImp>&
>(*this);}
433 const GeometryImp<mydim,cdim,GridImp>& asImp ()
const {
return static_cast<const GeometryImp<mydim,cdim,GridImp>&
>(*this);}
438 #endif // DUNE_GRID_GEOMETRY_HH
static const int mydimension
Definition: common/geometry.hh:324
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:419
ctype volume() const
return volume of the geometry
Definition: common/geometry.hh:340
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:391
Definition: common/geometry.hh:123
FieldVector< ctype, cdim > global(const FieldVector< ctype, mydim > &local) const
return the only coordinate
Definition: common/geometry.hh:401
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
bool checkInside(const FieldVector< ctype, mydim > &) const
checkInside here returns true
Definition: common/geometry.hh:413
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: common/geometry.hh:130
conditional< storeReference, const Implementation &, Implementation >::type realGeometry
Definition: common/geometry.hh:308
GeometryType type() const
Return the name of the reference element. The type can be used to access the Dune::ReferenceElement.
Definition: common/geometry.hh:151
Definition: common/geometry.hh:128
Wrapper class for geometries.
Definition: common/geometry.hh:101
GridImp::ctype ctype
Definition: common/geometry.hh:389
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:398
GlobalCoordinate center() const
return center of the geometry
Definition: common/geometry.hh:359
Implementation::JacobianTransposed JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:146
GlobalCoordinate center() const
return center of geometry
Definition: common/geometry.hh:243
GeometryImp< mydim, cdim, GridImp > Implementation
Definition: common/geometry.hh:114
FieldMatrix< ctype, mydim, cdim > JacobianTransposed
type of jacobian transposed
Definition: common/geometry.hh:337
Traits class determining whether the Dune::Geometry facade class stores the implementation object by ...
Definition: common/geometry.hh:46
GridImp::ctype ctype
Definition: common/geometry.hh:328
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:334
FieldVector< ctype, mydim > LocalCoordinate
type of local coordinates
Definition: common/geometry.hh:133
ctype integrationElement(const LocalCoordinate &local) const
Return the factor appearing in the integral transformation formula.
Definition: common/geometry.hh:222
bool affine() const
Return true if the geometry mapping is affine and false otherwise.
Definition: common/geometry.hh:154
const JacobianInverseTransposed & jacobianInverseTransposed(const LocalCoordinate &local) const
Return inverse of transposed of Jacobian.
Definition: common/geometry.hh:283
JacobianInverseTransposed Jacobian
Definition: common/geometry.hh:143
FieldVector< ctype, cdim > GlobalCoordinate
type of the global coordinates
Definition: common/geometry.hh:136
Default implementation for class Geometry.
Definition: common/geometry.hh:321
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:392
static const bool storeReference
Definition: common/geometry.hh:306
FieldVector< ctype, mydim > LocalCoordinate
Definition: common/geometry.hh:330
GlobalCoordinate global(const LocalCoordinate &local) const
Evaluate the map .
Definition: common/geometry.hh:185
static const int coorddimension
Definition: common/geometry.hh:325
static const bool v
Whether to store by reference.
Definition: common/geometry.hh:49
LocalCoordinate local(const GlobalCoordinate &global) const
Evaluate the inverse map .
Definition: common/geometry.hh:194
Definition: common/geometry.hh:125
Implementation::JacobianInverseTransposed JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:139
const Implementation & impl() const
return reference to the implementation
Definition: common/geometry.hh:117
int corners() const
Return the number of corners of the reference element.
Definition: common/geometry.hh:162
Definition: common/geometry.hh:121
Definition: common/geometry.hh:24
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: common/geometry.hh:289
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: common/geometry.hh:176
FieldVector< ctype, cdim > center() const
return center of the geometry
Definition: common/geometry.hh:425
FieldMatrix< ctype, cdim, mydim > JacobianInverseTransposed
type of jacobian inverse transposed
Definition: common/geometry.hh:395
ctype volume() const
return volume of geometry
Definition: common/geometry.hh:228
const JacobianTransposed & jacobianTransposed(const LocalCoordinate &local) const
Return the transposed of the Jacobian.
Definition: common/geometry.hh:258
FieldVector< ctype, mydim > local(const FieldVector< ctype, cdim > &) const
return empty vector
Definition: common/geometry.hh:407
FieldVector< ctype, cdim > GlobalCoordinate
Definition: common/geometry.hh:331