5 #ifndef DUNE_GEOMETRY_TYPE_HH
6 #define DUNE_GEOMETRY_TYPE_HH
8 #define DISABLE_GEOMETRYTYPE_DEPRECATION_WARNING
9 #include <dune/common/geometrytype.hh>
10 #undef DISABLE_GEOMETRYTYPE_DEPRECATION_WARNING
20 #include <dune/common/exceptions.hh>
21 #include <dune/common/deprecated.hh>
56 unsigned int topologyId_;
59 unsigned char dim_ : 7;
67 : topologyId_(0), dim_(0), none_(true)
72 : topologyId_(0), dim_(dim), none_(false)
88 DUNE_THROW( RangeError,
89 "Invalid basic geometry type: no pyramids for dimension " << dim <<
"." );
95 DUNE_THROW( RangeError,
96 "Invalid basic geometry type: no prisms for dimension " << dim <<
"." );
102 DUNE_THROW( RangeError,
103 "Invalid basic geometry type: " << basicType <<
" for dimension " << dim <<
"." );
109 : topologyId_(topologyId), dim_(dim), none_(false)
122 template<
class TopologyType>
124 : topologyId_(TopologyType::
id), dim_(TopologyType::dimension), none_(false)
129 : topologyId_(0), dim_(dim), none_(false)
139 : topologyId_(0), dim_(dim), none_(false)
206 topologyId_ = ((dim>1) ? ((1 << dim) - 1) : 0);
233 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0001;
238 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0011;
243 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0001;
248 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0011;
253 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0101;
258 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0111;
263 return ! none_ && (topologyId_ | 1) == 1;
268 return ! none_ && ((topologyId_ ^ ((1 << dim_)-1)) >> 1 == 0);
277 unsigned int dim()
const {
297 unsigned int id()
const {
307 return ( ( none_ == other.none_ )
308 && ( ( none_ ==
true )
309 || ( ( dim_ == other.dim_ )
310 && ( (topologyId_ >> 1) == (other.topologyId_ >> 1) )
318 return ! ((*this)==other);
323 return ( ( none_ < other.none_ )
324 || ( !( other.none_ < none_ )
325 && ( ( dim_ < other.dim_ )
326 || ( (other.dim_ == dim_)
327 && ((topologyId_ >> 1) < (other.topologyId_ >> 1) )
340 s <<
"(simplex, " << a.
dim() <<
")";
345 s <<
"(cube, " << a.
dim() <<
")";
360 s <<
"(none, " << a.
dim() <<
")";
else
363 s <<
"(other [" << a.
id() <<
"], " << a.
dim() <<
")";
389 DUNE_THROW(Exception,
"invalid GeometryType::BasicType");
394 #endif // #ifdef DOXYGEN
396 #endif // DUNE_GEOMETRY_TYPE_HH