1 #ifndef DUNE_GEOGRID_GEOMETRY_HH
2 #define DUNE_GEOGRID_GEOMETRY_HH
4 #include <dune/common/nullptr.hh>
5 #include <dune/common/typetraits.hh>
7 #include <dune/geometry/referenceelements.hh>
8 #include <dune/geometry/genericgeometry/mappingprovider.hh>
22 template<
int cdim,
class Gr
id >
25 typedef typename remove_const< Grid >::type::Traits
Traits;
27 typedef GenericGeometry::DuneCoordTraits< typename Traits::ctype >
CoordTraits;
31 template<
class Topology >
35 typedef GenericGeometry::CornerMapping< CoordTraits, Topology, dimWorld, CornerStorage >
type;
43 static const GenericGeometry::EvaluationType
evaluateNormal = GenericGeometry::ComputeOnDemand;
54 unsigned int refCount_;
63 template<
int cdim,
class Gr
id >
66 typedef typename remove_const< Grid >::type::Traits Traits;
77 typedef GenericGeometry::HybridMapping< dimension, GeometryTraits >
ElementMapping;
84 typedef typename GenericGeometry::Topology< topologyId, dimension >::type Topology;
85 typedef GenericGeometry::NonHybridMapping< Topology, GeometryTraits >
ElementMapping;
89 typedef typename SelectType< Capabilities::hasSingleGeometryType< Grid >::v, NonHybrid< true >, Hybrid< false > >::Type::ElementMapping
ElementMapping;
94 typedef GenericGeometry::MappingProvider< ElementMapping, codim >
MappingProvider;
95 typedef typename MappingProvider::Mapping
Mapping;
106 template<
int mydim,
int cdim,
class Gr
id >
112 typedef typename remove_const< Grid >::type::Traits Traits;
123 typedef typename MappingFamily::template Codim< codimension >::MappingProvider
MappingProvider;
124 typedef typename MappingFamily::template Codim< codimension >::Mapping
Mapping;
127 typedef typename Mapping::FieldType
ctype;
143 template<
class CoordVector >
147 char *mappingStorage = grid.template allocateMappingStorage< codimension >(
type );
148 mapping_ = MappingProvider::construct( type.id(), coords, mappingStorage );
149 mapping_->userData().addReference();
152 template<
int fatherdim >
154 : grid_( father.grid_ )
156 const unsigned int codim = fatherdim - mydim;
157 char *mappingStorage =
grid().template allocateMappingStorage< codimension >(
type );
158 mapping_ = father.mapping_->template trace< codim >( i, mappingStorage );
159 mapping_->userData().addReference();
163 : grid_( other.grid_ ),
164 mapping_( other.mapping_ )
167 mapping_->userData().addReference();
172 if( mapping_ && mapping_->userData().removeReference() )
179 other.mapping_->userData().addReference();
180 if( mapping_ && mapping_->userData().removeReference() )
183 mapping_ = other.mapping_;
187 operator bool ()
const {
return bool( mapping_ ); }
189 bool affine ()
const {
return mapping_->affine(); }
192 int corners ()
const {
return mapping_->numCorners(); }
208 void destroyMapping ()
211 mapping_->~Mapping();
212 grid().template deallocateMappingStorage< codimension >( gt, (
char *)mapping_ );
226 namespace FacadeOptions
229 template<
int mydim,
int cdim,
class Gr
id >
232 static const bool v =
false;
239 #endif // #ifndef DUNE_GEOGRID_GEOMETRY_HH