9 #ifndef stk_mesh_EntityKey_hpp 10 #define stk_mesh_EntityKey_hpp 14 #include <boost/functional/hash.hpp> 16 #include <stk_mesh/base/Types.hpp> 65 typedef uint64_t raw_key_type ;
67 enum { rank_digits = 8 };
72 invalid_key = ~raw_key_type(0) ,
73 raw_digits = std::numeric_limits<raw_key_type>::digits ,
74 id_digits = raw_digits - rank_digits ,
75 id_mask = ~raw_key_type(0) >> rank_digits
81 raw_key_type id : id_digits ;
82 raw_key_type rank : rank_digits ;
86 raw_key_type rank : rank_digits ;
87 raw_key_type id : id_digits ;
102 { key = rhs.key ;
return *this ; }
117 raw_key_type id()
const {
return key & id_mask ; }
119 EntityRank rank()
const {
return key >> id_digits ; }
121 EntityRank type()
const {
return rank(); }
123 bool operator==(
const EntityKey &rhs)
const {
124 return key == rhs.key;
127 bool operator!=(
const EntityKey &rhs)
const {
128 return !(key == rhs.key);
131 bool operator<(
const EntityKey &rhs)
const {
132 return key < rhs.key;
135 bool operator>(
const EntityKey &rhs)
const {
136 return rhs.key < key;
139 bool operator<=(
const EntityKey &rhs)
const {
140 return !(key < rhs.key);
143 bool operator>=(
const EntityKey &rhs)
const {
144 return !(rhs.key < key);
151 explicit EntityKey(
const raw_key_type *
const value )
154 raw_key_type raw_key()
const {
return key ; }
178 bool entity_id_valid( EntityKey::raw_key_type
id ) {
179 return 0 <
id &&
id <= EntityKey().id();
183 size_t hash_value( EntityKey key) {
184 return boost::hash_value(key.raw_key());
bool entity_key_valid(const EntityKey &key)
Query if an entity key is valid.
Integer type for the entity keys, which is an encoding of the entity type and entity identifier...
EntityId entity_id(const EntityKey &key)
Given an entity key, return the identifier for the entity.
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).