1#ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_GEOMETRY_HH
2#define DUNE_FEM_GRIDPART_GEOGRIDPART_GEOMETRY_HH
6#include <dune/geometry/multilineargeometry.hh>
8#include <dune/grid/geometrygrid/geometry.hh>
10#include <dune/fem/gridpart/common/capabilities.hh>
11#include <dune/fem/gridpart/geogridpart/cornerstorage.hh>
22 template<
class Gr
idFamily >
23 class GeoGeometryTraits
25 typedef typename std::remove_const< GridFamily >::type::Traits Traits;
27 typedef typename Traits::HostGridPartType HostGridPartType;
29 static const int dimension = std::remove_const< GridFamily >::type::dimension;
32 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
34 typedef Dune::Impl::FieldMatrixHelper< ctype > MatrixHelper;
36 static ctype tolerance () {
return 16 * std::numeric_limits< ctype >::epsilon(); }
38 template<
int mydim,
int cdim >
41 typedef GeoCornerStorage< mydim, cdim, GridFamily > Type;
45 struct hasSingleGeometryType
46 :
public Dune::GeoGrid::InferHasSingleGeometryType< GridPartCapabilities::hasSingleGeometryType< HostGridPartType >, dimension, mydim >
55 template<
int mydim,
int cdim,
class Gr
idFamily >
58 typedef GeoGeometry< mydim, cdim, GridFamily > ThisType;
61 typedef typename std::remove_const< GridFamily >::type::ctype ctype;
63 static const int mydimension = mydim;
64 static const int coorddimension = cdim;
65 static const int dimension = std::remove_const< GridFamily >::type::dimension;
66 static const int codimension = dimension - mydimension;
69 typedef CachedMultiLinearGeometry< ctype, mydimension, coorddimension, GeoGeometryTraits< GridFamily > > Mapping;
72 typedef typename Mapping::LocalCoordinate LocalCoordinate;
73 typedef typename Mapping::GlobalCoordinate GlobalCoordinate;
75 typedef typename Mapping::JacobianTransposed JacobianTransposed;
76 typedef typename Mapping::JacobianInverseTransposed JacobianInverseTransposed;
78 typedef typename Mapping::Jacobian Jacobian;
79 typedef typename Mapping::JacobianInverse JacobianInverse;
85 template<
class CoordVector >
86 GeoGeometry (
const GeometryType &type,
const CoordVector &coords )
88 assert(
int( type.dim() ) == mydimension );
89 mapping_ =
new( mappingStorage_ ) Mapping( type, coords );
92 GeoGeometry (
const ThisType &other )
95 mapping_ =
new( mappingStorage_ ) Mapping( *other.mapping_ );
103 mapping_->~Mapping();
106 const ThisType &operator= (
const ThisType &other )
109 mapping_->~Mapping();
111 mapping_ =
new( mappingStorage_ ) Mapping( *other.mapping_ );
117 operator bool ()
const {
return bool( mapping_ ); }
119 bool affine ()
const {
return mapping_->affine(); }
122 int corners ()
const {
return mapping_->corners(); }
123 GlobalCoordinate corner (
const int i )
const {
return mapping_->corner( i ); }
124 GlobalCoordinate center ()
const {
return mapping_->center(); }
126 GlobalCoordinate global (
const LocalCoordinate &local )
const {
return mapping_->global( local ); }
127 LocalCoordinate local (
const GlobalCoordinate &global )
const {
return mapping_->local( global ); }
129 ctype integrationElement (
const LocalCoordinate &local )
const {
return mapping_->integrationElement( local ); }
130 ctype volume ()
const {
return mapping_->volume(); }
132 JacobianTransposed jacobianTransposed (
const LocalCoordinate &local )
const {
return mapping_->jacobianTransposed( local ); }
133 JacobianInverseTransposed jacobianInverseTransposed (
const LocalCoordinate &local )
const {
return mapping_->jacobianInverseTransposed( local ); }
135 Jacobian jacobian (
const LocalCoordinate &local )
const {
return mapping_->jacobian( local ); }
136 JacobianInverse jacobianInverse (
const LocalCoordinate &local )
const {
return mapping_->jacobianInverse( local ); }
140 char mappingStorage_[
sizeof( Mapping ) ];
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Dune namespace.
Definition: alignedallocator.hh:13