9 #ifndef stk_mesh_Part_hpp 10 #define stk_mesh_Part_hpp 19 #include <stk_util/util/CSet.hpp> 20 #include <stk_mesh/base/Types.hpp> 21 #include <stk_mesh/base/PartRelation.hpp> 22 #include <stk_mesh/baseImpl/PartImpl.hpp> 67 const std::string &
name()
const {
return m_partImpl.name(); }
84 const std::vector<PartRelation> &
relations()
const {
return m_partImpl.relations(); }
94 const A *
attribute()
const {
return m_partImpl.attribute<A>(); }
101 MetaData & meta_data()
const {
return m_partImpl.mesh_meta_data(); }
104 impl::PartImpl m_partImpl;
112 friend class ::stk_classic::mesh::impl::PartRepository ;
113 friend class ::stk_classic::mesh::MetaData ;
115 #ifndef DOXYGEN_COMPILE 120 Part( MetaData * arg_meta_data ,
const std::string & arg_name, EntityRank arg_rank,
size_t arg_ordinal)
121 : m_partImpl(arg_meta_data,arg_name,arg_rank,arg_ordinal)
126 Part(
const Part & );
127 Part & operator = (
const Part & );
133 static const char INTERNAL_PART_PREFIX =
'{';
134 static const char INTERNAL_PART_POSTFIX =
'}';
137 bool is_internal(
const std::string& part_name)
139 return part_name.size() > 2 && *part_name.begin() == INTERNAL_PART_PREFIX && *part_name.rbegin() == INTERNAL_PART_POSTFIX;
143 bool is_internal(
const Part& part)
144 {
return is_internal(part.name()); }
146 std::string convert_to_internal_name(
const std::string& part_name);
152 inline bool operator()(
const Part & lhs ,
const Part & rhs )
const 155 inline bool operator()(
const Part & lhs ,
const Part * rhs )
const 158 inline bool operator()(
const Part * lhs ,
const Part & rhs )
const 161 inline bool operator()(
const Part * lhs ,
const Part * rhs )
const 169 void order( OrdinalVector & v )
171 OrdinalVector::iterator ev = v.end();
172 OrdinalVector::iterator iv = v.begin();
173 std::sort( iv , ev );
174 iv = std::unique( iv , ev );
184 bool insert_ordinal( OrdinalVector & v ,
unsigned part_ordinal )
186 for(OrdinalVector::iterator i=v.begin(), e=v.end(); i!=e; ++i) {
187 if (*i == part_ordinal)
return false;
188 if (*i > part_ordinal) {
189 v.insert(i, part_ordinal);
194 v.push_back(part_ordinal);
207 template<
class Iterator>
209 bool contains_ordinal( Iterator beg, Iterator end,
unsigned part_ordinal )
211 for(Iterator i=beg; i!=end; ++i) {
212 if (*i == part_ordinal)
return true;
230 bool intersect(
const Part & ,
const Part & );
236 std::ostream &
print( std::ostream & ,
const char *
const ,
const Part & );
std::ostream & print(std::ostream &os, const std::string &indent, const Bucket &bucket)
Print the parts and entities of this bucket.
bool operator==(const Part &rhs) const
Equality comparison.
void order(PartVector &v)
Order a collection of parts: invoke sort and then unique.
unsigned primary_entity_rank() const
The primary entity type for this part.
size_t intersect(const PartVector &v, const PartVector &p)
Query cardinality of intersection of two PartVectors.
An application-defined subset of a problem domain.
bool contain(const PartVector &v, const Part &part)
Query containment within properly ordered PartVector.
const PartVector & intersection_of() const
Parts for which this part is defined as the intersection.
MetaData & mesh_meta_data() const
The meta data manager that owns the PartRepository which created this part.
const std::string & name() const
Application-defined text name of this part.
unsigned mesh_meta_data_ordinal() const
Internally generated ordinal of this part that is unique within the owning meta data manager...
const PartVector & supersets() const
Parts that are supersets of this part.
const A * attribute() const
Query attribute that has been attached to this part.
const std::vector< PartRelation > & relations() const
PartRelations for which this part is a member, root or target.
Ordering operator for parts.
const PartVector & subsets() const
Parts that are subsets of this part.
bool operator!=(const Part &rhs) const
Inequality comparison.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
Part * find(const PartVector &parts, const std::string &name)
Find a part by name in a collection of parts.
bool insert(PartVector &v, Part &part)
Insert a part into a properly ordered collection of parts. Returns true if this is a new insertion...