9 #ifndef stk_mesh_BucketRepository_hpp 10 #define stk_mesh_BucketRepository_hpp 12 #include <stk_mesh/base/Types.hpp> 13 #include <stk_mesh/base/Bucket.hpp> 14 #include <stk_mesh/base/Iterators.hpp> 20 class EntityRepository;
22 class BucketRepository {
27 unsigned bucket_capacity,
28 unsigned entity_rank_count,
29 EntityRepository & entity_repo
33 const std::vector<Bucket*> & buckets( EntityRank rank )
const 35 ThrowAssertMsg( rank < m_buckets.size(),
"Invalid entity rank " << rank );
37 return m_buckets[ rank ];
45 void remove_entity( Bucket * ,
unsigned );
51 unsigned bucket_capacity()
const {
return m_bucket_capacity; }
67 void update_field_data_states()
const ;
70 void destroy_bucket(
const unsigned &
entity_rank , Bucket * last );
71 void destroy_bucket( Bucket * bucket );
72 void declare_nil_bucket();
73 Bucket * get_nil_bucket()
const {
return m_nil_bucket; }
74 Bucket * declare_bucket(
76 const unsigned part_count ,
77 const unsigned part_ord[] ,
78 const std::vector< FieldBase * > & field_set
80 void copy_fields( Bucket & k_dst ,
unsigned i_dst ,
81 Bucket & k_src ,
unsigned i_src )
82 { k_dst.m_bucketImpl.replace_fields(i_dst,k_src,i_src); }
84 void initialize_fields( Bucket & k_dst ,
unsigned i_dst );
86 void internal_sort_bucket_entities();
88 void optimize_buckets();
89 void sort_and_optimize_buckets();
91 void add_entity_to_bucket( Entity & entity, Bucket & bucket )
93 bucket.m_bucketImpl.replace_entity( bucket.size() , & entity ) ;
94 bucket.m_bucketImpl.increment_size();
97 void internal_propagate_relocation( Entity & );
99 AllBucketsRange get_bucket_range()
const 101 return stk_classic::mesh::get_bucket_range(m_buckets);
104 AllBucketsRange get_bucket_range(EntityRank
entity_rank)
const 106 std::vector< std::vector<Bucket*> >::const_iterator itr = m_buckets.begin() +
entity_rank;
107 return stk_classic::mesh::get_bucket_range(m_buckets, itr);
114 unsigned m_bucket_capacity ;
115 std::vector< std::vector<Bucket*> > m_buckets ;
116 Bucket * m_nil_bucket ;
118 EntityRepository & m_entity_repo ;
128 #endif // stk_mesh_BucketRepository_hpp
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).