|
Sierra Toolkit Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #ifndef stk_mesh_base_Entity_hpp 00010 #define stk_mesh_base_Entity_hpp 00011 00012 #include <utility> 00013 #include <vector> 00014 00015 #include <stk_mesh/base/Types.hpp> 00016 00017 #include <stk_mesh/baseImpl/EntityImpl.hpp> 00018 00019 namespace stk { 00020 namespace mesh { 00021 00022 namespace impl { 00023 00024 class EntityRepository; 00025 class BucketRepository; 00026 00027 } 00028 00033 //---------------------------------------------------------------------- 00034 00035 00036 00037 //---------------------------------------------------------------------- 00053 class Entity { 00054 public: 00055 00057 EntityModificationLog log_query() const { return m_entityImpl.log_query(); } 00058 00060 EntityRank entity_rank() const { return m_entityImpl.entity_rank(); } 00061 00065 EntityId identifier() const { return m_entityImpl.identifier(); } 00066 00070 const EntityKey & key() const { return m_entityImpl.key(); } 00071 00073 Bucket & bucket() const { return m_entityImpl.bucket(); } 00074 00076 unsigned bucket_ordinal() const { return m_entityImpl.bucket_ordinal(); } 00077 00085 size_t synchronized_count() const { return m_entityImpl.synchronized_count(); } 00086 00087 //------------------------------------ 00091 PairIterRelation relations() const { return m_entityImpl.relations(); } 00092 00096 PairIterRelation relations( unsigned type ) const { return m_entityImpl.relations(type); } 00097 00098 //------------------------------------ 00100 unsigned owner_rank() const { return m_entityImpl.owner_rank(); } 00101 00103 PairIterEntityComm sharing() const { return m_entityImpl.sharing(); } 00104 00106 PairIterEntityComm comm() const { return m_entityImpl.comm(); } 00107 00109 PairIterEntityComm comm( const Ghosting & sub ) const { return m_entityImpl.comm( sub ); } 00110 00111 //------------------------------------ 00112 private: 00113 00114 impl::EntityImpl m_entityImpl; 00115 00116 ~Entity(); 00117 explicit Entity( const EntityKey & arg_key ); 00118 00119 Entity(); 00120 Entity( const Entity & ); 00121 Entity & operator = ( const Entity & ); 00122 00123 #ifndef DOXYGEN_COMPILE 00124 friend class impl::EntityRepository ; 00125 friend class impl::EntityImpl ; 00126 00127 #endif /* DOXYGEN_COMPILE */ 00128 }; 00129 00131 class EntityLess { 00132 public: 00133 ~EntityLess() {} 00134 EntityLess() {} 00135 EntityLess( const EntityLess & ) {} 00136 EntityLess & operator = ( const EntityLess & ) { return *this ; } 00137 00139 bool operator()(const Entity& lhs, const Entity& rhs) const 00140 { return lhs.key() < rhs.key(); } 00141 00142 bool operator()(const Entity& lhs, const EntityKey & rhs) const 00143 { return lhs.key() < rhs ; } 00144 00146 bool operator()(const Entity* lhs, const Entity* rhs) const 00147 { 00148 const EntityKey lhs_key = lhs ? lhs->key() : EntityKey() ; 00149 const EntityKey rhs_key = rhs ? rhs->key() : EntityKey() ; 00150 return lhs_key < rhs_key ; 00151 } 00152 00153 bool operator()(const Entity* lhs, const Entity& rhs) const 00154 { 00155 const EntityKey lhs_key = lhs ? lhs->key() : EntityKey(); 00156 return lhs_key < rhs.key() ; 00157 } 00158 00159 bool operator()(const Entity& lhs, const Entity* rhs) const 00160 { 00161 const EntityKey rhs_key = rhs ? rhs->key() : EntityKey(); 00162 return lhs.key() < rhs_key ; 00163 } 00164 00165 bool operator()(const Entity* lhs, const EntityKey & rhs) const 00166 { 00167 const EntityKey lhs_key = lhs ? lhs->key() : EntityKey() ; 00168 return lhs_key < rhs ; 00169 } 00170 00171 bool operator()( const EntityProc & lhs, const EntityProc & rhs) const 00172 { 00173 const EntityKey lhs_key = lhs.first ? lhs.first->key() : EntityKey() ; 00174 const EntityKey rhs_key = rhs.first ? rhs.first->key() : EntityKey() ; 00175 return lhs_key != rhs_key ? lhs_key < rhs_key : lhs.second < rhs.second ; 00176 } 00177 00178 bool operator()( const EntityProc & lhs, const Entity & rhs) const 00179 { 00180 const EntityKey lhs_key = lhs.first ? lhs.first->key() : EntityKey() ; 00181 return lhs_key < rhs.key(); 00182 } 00183 00184 bool operator()( const EntityProc & lhs, const Entity * rhs) const 00185 { 00186 const EntityKey lhs_key = lhs.first ? lhs.first->key() : EntityKey() ; 00187 const EntityKey rhs_key = rhs ? rhs->key() : EntityKey() ; 00188 return lhs_key < rhs_key ; 00189 } 00190 00191 bool operator()( const EntityProc & lhs, const EntityKey & rhs) const 00192 { 00193 const EntityKey lhs_key = lhs.first ? lhs.first->key() : EntityKey() ; 00194 return lhs_key < rhs ; 00195 } 00196 00197 }; //class EntityLess 00198 00199 class EntityEqual 00200 { 00201 public: 00202 bool operator()(const stk::mesh::Entity* lhs, const stk::mesh::Entity* rhs) const 00203 { 00204 const stk::mesh::EntityKey lhs_key = lhs ? lhs->key() : stk::mesh::EntityKey(); 00205 const stk::mesh::EntityKey rhs_key = rhs ? rhs->key() : stk::mesh::EntityKey(); 00206 return lhs_key == rhs_key; 00207 } 00208 00209 bool operator()(const stk::mesh::Entity& lhs, const stk::mesh::Entity& rhs) const 00210 { 00211 const stk::mesh::EntityKey lhs_key = lhs.key(); 00212 const stk::mesh::EntityKey rhs_key = rhs.key(); 00213 return lhs_key == rhs_key; 00214 } 00215 }; 00216 00217 //---------------------------------------------------------------------- 00218 00221 } // namespace mesh 00222 } // namespace stk 00223 00224 //---------------------------------------------------------------------- 00225 //---------------------------------------------------------------------- 00226 00227 #endif /* stk_mesh_base_Entity_hpp */ 00228