3 #ifndef DUNE_GEOMETRY_TYPE_HH
4 #define DUNE_GEOMETRY_TYPE_HH
12 #include <dune/common/exceptions.hh>
13 #include <dune/common/unused.hh>
48 unsigned int topologyId_;
51 unsigned char dim_ : 7;
59 : topologyId_(0), dim_(0), none_(true)
64 : topologyId_(0), dim_(dim), none_(false)
80 DUNE_THROW( RangeError,
81 "Invalid basic geometry type: no pyramids for dimension " << dim <<
"." );
87 DUNE_THROW( RangeError,
88 "Invalid basic geometry type: no prisms for dimension " << dim <<
"." );
94 DUNE_THROW( RangeError,
95 "Invalid basic geometry type: " << basicType <<
" for dimension " << dim <<
"." );
105 : topologyId_(topologyId), dim_(dim), none_(false)
118 template<
class TopologyType>
120 : topologyId_(TopologyType::
id), dim_(TopologyType::dimension), none_(false)
122 DUNE_UNUSED_PARAMETER(t);
127 : topologyId_(0), dim_(dim), none_(false)
137 : topologyId_(0), dim_(dim), none_(false)
204 topologyId_ = ((dim>1) ? ((1 << dim) - 1) : 0);
237 DUNE_THROW(NotImplemented,
"2d elements with " << vertices <<
" corners are not supported!");
254 DUNE_THROW(NotImplemented,
"3d elements with " << vertices <<
" corners are not supported!");
257 DUNE_THROW(NotImplemented,
"makeFromVertices only implemented up to 3d");
278 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0001;
283 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0011;
288 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0001;
293 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0011;
298 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0101;
303 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0111;
308 return ! none_ && (topologyId_ | 1) == 1;
313 return ! none_ && ((topologyId_ ^ ((1 << dim_)-1)) >> 1 == 0);
322 unsigned int dim()
const {
327 unsigned int id()
const {
337 return ( ( none_ == other.none_ )
338 && ( ( none_ ==
true )
339 || ( ( dim_ == other.dim_ )
340 && ( (topologyId_ >> 1) == (other.topologyId_ >> 1) )
348 return ! ((*this)==other);
353 return ( ( none_ < other.none_ )
354 || ( !( other.none_ < none_ )
355 && ( ( dim_ < other.dim_ )
356 || ( (other.dim_ == dim_)
357 && ((topologyId_ >> 1) < (other.topologyId_ >> 1) )
370 s <<
"(simplex, " << a.
dim() <<
")";
375 s <<
"(cube, " << a.
dim() <<
")";
390 s <<
"(none, " << a.
dim() <<
")";
393 s <<
"(other [" << a.
id() <<
"], " << a.
dim() <<
")";
419 DUNE_THROW(Exception,
"invalid GeometryType::BasicType");
425 #endif // DUNE_GEOMETRY_TYPE_HH