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)
96 DUNE_THROW( RangeError,
97 "Invalid basic geometry type: " << basicType <<
" for dimension " << dim <<
"." );
103 : topologyId_(topologyId), dim_(dim), none_(false)
116 template<
class TopologyType>
118 : topologyId_(TopologyType::
id), dim_(TopologyType::dimension), none_(false)
123 : topologyId_(0), dim_(dim), none_(false)
133 : topologyId_(0), dim_(dim), none_(false)
200 topologyId_ = ((dim>1) ? ((1 << dim) - 1) : 0);
227 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0001;
232 return ! none_ && dim_==2 && (topologyId_ | 1) ==
b0011;
237 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0001;
242 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0011;
247 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0101;
252 return ! none_ && dim_==3 && (topologyId_ | 1) ==
b0111;
257 return ! none_ && (topologyId_ | 1) == 1;
262 return ! none_ && ((topologyId_ ^ ((1 << dim_)-1)) >> 1 == 0);
271 unsigned int dim()
const {
291 unsigned int id()
const {
301 return ( ( none_ == other.none_ )
302 && ( ( none_ ==
true )
303 || ( ( dim_ == other.dim_ )
304 && ( (topologyId_ >> 1) == (other.topologyId_ >> 1) )
312 return ! ((*this)==other);
317 return ( ( none_ < other.none_ )
318 || ( !( other.none_ < none_ )
319 && ( ( dim_ < other.dim_ )
320 || ( (other.dim_ == dim_)
321 && ((topologyId_ >> 1) < (other.topologyId_ >> 1) )
334 s <<
"(simplex, " << a.
dim() <<
")";
339 s <<
"(cube, " << a.
dim() <<
")";
354 s <<
"(none, " << a.
dim() <<
")";
else
357 s <<
"(other [" << a.
id() <<
"], " << a.
dim() <<
")";
383 DUNE_THROW(Exception,
"invalid GeometryType::BasicType");
388 #endif // #ifdef DOXYGEN
390 #endif // DUNE_GEOMETRY_TYPE_HH