9 #ifndef stk_mesh_Bucket_hpp 10 #define stk_mesh_Bucket_hpp 18 #include <stk_util/environment/ReportHandler.hpp> 20 #include <stk_mesh/baseImpl/BucketImpl.hpp> 22 #include <stk_mesh/base/Types.hpp> 23 #include <stk_mesh/base/Field.hpp> 24 #include <stk_mesh/base/Part.hpp> 25 #include <stk_mesh/base/Entity.hpp> 27 #include <boost/iterator/transform_iterator.hpp> 28 #include <boost/iterator/indirect_iterator.hpp> 32 #ifdef SIERRA_MIGRATION 49 class BucketRepository;
60 std::ostream &
operator << ( std::ostream & ,
const Bucket & );
64 print( std::ostream & ,
const std::string & indent ,
const Bucket & );
67 bool bucket_part_equal(
const unsigned * lhs ,
const unsigned * rhs );
78 bool has_superset(
const Bucket & ,
const unsigned & ordinal );
96 friend class impl::BucketRepository;
97 friend class impl::BucketImpl;
99 impl::BucketImpl m_bucketImpl;
101 #ifdef SIERRA_MIGRATION 102 const void* m_fmwk_mesh_bulk_data;
110 typedef boost::indirect_iterator<Entity*const*> iterator ;
113 inline iterator
begin()
const {
return iterator(m_bucketImpl.begin()); }
116 inline iterator
end()
const {
return iterator(m_bucketImpl.end()); }
119 size_t size()
const {
return m_bucketImpl.size() ; }
122 size_t capacity()
const {
return m_bucketImpl.capacity() ; }
129 {
return m_bucketImpl.field_data_size(field); }
133 {
return m_bucketImpl.field_data_stride(field); }
137 {
return m_bucketImpl.field_data_location(field,entity); }
141 {
return m_bucketImpl.field_data_location(field, ordinal); }
148 {
return m_bucketImpl.fast_field_data_location(field, ordinal); }
152 {
return m_bucketImpl.field_data_location(field); }
155 template<
class field_type >
156 typename FieldTraits< field_type >::data_type *
158 {
return m_bucketImpl.field_data(field,entity.bucket_ordinal()); }
167 unsigned entity_rank()
const {
return m_bucketImpl.entity_rank(); }
171 void supersets( OrdinalVector & )
const ;
179 bool member_all(
const OrdinalVector & )
const ;
183 bool member_any(
const OrdinalVector & )
const ;
187 std::pair<const unsigned *, const unsigned *>
193 return m_bucketImpl.equivalent(b.m_bucketImpl);
196 #ifndef DOXYGEN_COMPILE 197 const unsigned * key()
const {
return m_bucketImpl.key() ; }
206 #ifdef SIERRA_MIGRATION 207 typedef std::pair<iterator, iterator> EntityRange;
209 bool is_empty()
const {
return size() == 0; }
211 const sierra::Fmwk::MeshBulkData* get_bulk_data()
const 213 return static_cast<const sierra::Fmwk::MeshBulkData*
>(m_fmwk_mesh_bulk_data);
217 void set_bulk_data(
const T* bulk_ptr) { m_fmwk_mesh_bulk_data = bulk_ptr; }
224 BulkData & bulk_data()
const {
return m_bucketImpl.mesh(); }
230 Bucket(
const Bucket & );
231 Bucket & operator = (
const Bucket & );
233 Bucket( BulkData & arg_mesh ,
234 EntityRank arg_entity_rank,
235 const std::vector<unsigned> & arg_key,
239 friend class ::stk_classic::mesh::BulkData;
244 bool operator()(
const Bucket * lhs_bucket ,
const unsigned * rhs )
const ;
245 bool operator()(
const unsigned * lhs ,
const Bucket * rhs_bucket )
const ;
250 std::vector<Bucket*>::iterator
251 lower_bound( std::vector<Bucket*> & v ,
const unsigned * key )
252 {
return std::lower_bound( v.begin() , v.end() , key , BucketLess() ); }
255 Bucket::Bucket( BulkData & arg_mesh ,
256 EntityRank arg_entity_rank,
257 const std::vector<unsigned> & arg_key,
260 : m_bucketImpl(arg_mesh,arg_entity_rank,arg_key,arg_capacity)
268 const unsigned *
const i_beg = key() + 1 ;
269 const unsigned *
const i_end = key() + key()[0] ;
271 const OrdinalVector::const_iterator ip_end = parts.end();
272 OrdinalVector::const_iterator ip = parts.begin() ;
274 bool result_all = true ;
276 for ( ; result_all && ip_end != ip ; ++ip ) {
277 const unsigned ord = *ip;
278 result_all = contains_ordinal(i_beg, i_end, ord);
283 struct To_Ptr : std::unary_function<Entity&, Entity*>
285 Entity* operator()(Entity& entity)
const 292 typedef boost::transform_iterator<To_Ptr, Bucket::iterator> BucketPtrIterator;
294 typedef Bucket::iterator BucketIterator;
std::ostream & print(std::ostream &os, const std::string &indent, const Bucket &bucket)
Print the parts and entities of this bucket.
BulkData & mesh() const
The bulk data manager that owns this bucket.
Field base class with an anonymous data type and anonymous multi-dimension.
bool has_superset(const Bucket &bucket, const unsigned &ordinal)
Is this bucket a subset of the given part by partID.
bool assert_correct() const
A method to assist in unit testing - accesses private data as necessary.
unsigned field_data_size(const FieldBase &field) const
Query the size of this field data specified by FieldBase.
bool member_all(const PartVector &) const
Bucket is a subset of all of the given parts.
bool member_any(const PartVector &) const
Bucket is a subset of any of the given parts.
unsigned char * fast_field_data_location(const FieldBase &field, unsigned ordinal) const
Query the location of this field data specified by FieldBase and Entity-bucket-ordinal This method sh...
const FieldBase::Restriction::size_type * field_data_stride(const FieldBase &field) const
Query the stride of this field data specified by FieldBase.
std::pair< const unsigned *, const unsigned * > superset_part_ordinals() const
An application-defined subset of a problem domain.
size_t size() const
Number of entities associated with this bucket.
std::ostream & operator<<(std::ostream &s, const Bucket &k)
Print the part names for which this bucket is a subset.
unsigned char * field_data_location(const FieldBase &field, const Entity &entity) const
Query the location of this field data specified by FieldBase and Entity.
unsigned char * field_data_location(const FieldBase &field) const
Query the location of this field data specified by FieldBase.
unsigned allocation_size() const
The allocation size, in bytes, of this bucket.
Entity & operator[](size_t i) const
Query the i^th entity.
iterator begin() const
Beginning of the bucket.
iterator end() const
End of the bucket.
Manager for an integrated collection of entities, entity relations, and buckets of field data...
unsigned char * field_data_location(const FieldBase &field, unsigned ordinal) const
Query the location of this field data specified by FieldBase and Entity-bucket-ordinal.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
void supersets(PartVector &) const
This bucket is a subset of these parts.
bool equivalent(const Bucket &b) const
Equivalent buckets have the same parts.
size_t capacity() const
Capacity of this bucket.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
A container for the field data of a homogeneous collection of entities.
FieldTraits< field_type >::data_type * field_data(const field_type &field, const Entity &entity) const
Query the location of this field data specified by FieldBase and Entity.
bool member(const Part &) const
Bucket is a subset of the given part.
unsigned entity_rank() const
Type of entities in this bucket.