|
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_BucketRepository_hpp 00010 #define stk_mesh_BucketRepository_hpp 00011 00012 #include <stk_mesh/base/Types.hpp> 00013 #include <stk_mesh/base/Bucket.hpp> 00014 00015 00016 namespace stk { 00017 namespace mesh { 00018 namespace impl { 00019 00020 class EntityRepository; 00021 00022 class BucketRepository { 00023 public: 00024 ~BucketRepository(); 00025 BucketRepository( 00026 BulkData & mesh, 00027 unsigned bucket_capacity, 00028 unsigned entity_rank_count, 00029 EntityRepository & entity_repo 00030 ); 00031 00033 const std::vector<Bucket*> & buckets( EntityRank type ) const ; 00034 00035 /* Entity modification consequences: 00036 * 1) Change entity relation => update via part relation => change parts 00037 * 2) Change parts => update forward relations via part relation 00038 * => update via field relation 00039 */ 00040 void remove_entity( Bucket * , unsigned ); 00041 00042 //------------------------------------ 00046 unsigned bucket_capacity() const { return m_bucket_capacity; } 00047 00048 00049 //------------------------------------ 00050 00062 void update_field_data_states() const ; 00063 00064 // Destroy the last empty bucket in a family: 00065 void destroy_bucket( const unsigned & entity_rank , Bucket * last ); 00066 void destroy_bucket( Bucket * bucket ); 00067 void declare_nil_bucket(); 00068 Bucket * get_nil_bucket() const { return m_nil_bucket; } 00069 Bucket * declare_bucket( 00070 const unsigned entity_rank , 00071 const unsigned part_count , 00072 const unsigned part_ord[] , 00073 const std::vector< FieldBase * > & field_set 00074 ); 00075 void copy_fields( Bucket & k_dst , unsigned i_dst , 00076 Bucket & k_src , unsigned i_src ); 00077 void zero_fields( Bucket & k_dst , unsigned i_dst ); 00078 00079 void internal_sort_bucket_entities(); 00080 00081 void add_entity_to_bucket( Entity & entity, Bucket & bucket ) 00082 { 00083 bucket.m_bucketImpl.replace_entity( bucket.size() , & entity ) ; 00084 bucket.m_bucketImpl.increment_size(); 00085 } 00086 00087 void internal_propagate_relocation( Entity & ); 00088 00089 00090 private: 00091 BucketRepository(); 00092 00093 BulkData & m_mesh ; // Associated Bulk Data Aggregate 00094 unsigned m_bucket_capacity ; // Maximum number of entities per bucket 00095 std::vector< std::vector<Bucket*> > m_buckets ; // Vector of bucket pointers by rank 00096 Bucket * m_nil_bucket ; // nil bucket 00097 00098 EntityRepository & m_entity_repo ; 00099 }; 00100 00101 00102 00103 } // namespace impl 00104 } // namespace mesh 00105 } // namespace stk 00106 00107 00108 #endif // stk_mesh_BucketRepository_hpp