14 #include <stk_mesh/base/MetaData.hpp> 15 #include <stk_mesh/base/BulkData.hpp> 16 #include <stk_mesh/base/Entity.hpp> 17 #include <stk_mesh/base/Bucket.hpp> 18 #include <stk_mesh/base/Relation.hpp> 19 #include <stk_mesh/base/FieldData.hpp> 27 operator << ( std::ostream & s ,
const Relation & rel )
32 const MetaData & meta_data = MetaData::get(*e);
34 print_entity_key( s , meta_data , e->
key() );
47 m_target_entity( & entity )
49 #ifdef SIERRA_MIGRATION 50 setRelationType(INVALID);
58 #ifdef SIERRA_MIGRATION 62 else if (getRelationType() != rhs.getRelationType()) {
63 result = getRelationType() < rhs.getRelationType();
69 if ( m_raw_relation.value != rhs.m_raw_relation.value ) {
70 result = m_raw_relation.value < rhs.m_raw_relation.value ;
76 result = lhs_key < rhs_key ;
83 #ifdef SIERRA_MIGRATION 88 m_attribute( (relation_type << fmwk_orientation_digits) | orient ),
91 ThrowAssertMsg( orient <= fmwk_orientation_mask,
92 "orientation " << orient <<
" exceeds maximum allowed value");
95 void Relation::setMeshObj(Entity *
object)
100 m_target_entity = object;
108 PairIterRelation rel ,
109 const std::vector<Entity*>::const_iterator i_beg ,
110 const std::vector<Entity*>::const_iterator i_end ,
111 std::vector<Entity*> & entities_related )
113 for ( ; rel.first != rel.second ; ++rel.first ) {
117 Entity *
const e = rel.first->entity();
119 std::vector<Entity*>::const_iterator i = i_beg ;
121 for ( ; i != i_end ; ++i ) {
122 PairIterRelation r = (*i)->relations();
123 while ( r.first != r.second && e != r.first->entity() ) {
126 if ( r.first == r.second ) { break ; }
130 entities_related.push_back( e );
136 void insert_part_and_supersets(OrdinalVector& induced_parts,
138 bool include_supersets)
140 insert_ordinal( induced_parts , part.mesh_meta_data_ordinal() );
146 if (include_supersets) {
147 const PartVector & supersets = part.supersets();
148 for (PartVector::const_iterator itr = supersets.begin(), end = supersets.end(); itr != end; ++itr) {
149 insert_ordinal( induced_parts, (*itr)->mesh_meta_data_ordinal() );
157 const std::vector<Entity*> & entities ,
158 std::vector<Entity*> & entities_related )
160 entities_related.clear();
162 if ( ! entities.empty() ) {
163 std::vector<Entity*>::const_iterator i = entities.begin();
164 const std::vector<Entity*>::const_iterator j = entities.end();
173 const std::vector<Entity*> & entities ,
174 unsigned entities_related_rank ,
175 std::vector<Entity*> & entities_related )
177 entities_related.clear();
179 if ( ! entities.empty() ) {
180 std::vector<Entity*>::const_iterator i = entities.begin();
181 const std::vector<Entity*>::const_iterator j = entities.end();
196 const MetaData & meta = MetaData::get(part);
198 const bool induced_by_type =
202 const bool induced_by_stencil =
204 part.
relations().begin()->m_target == & part ;
206 return induced_by_type || induced_by_stencil ;
212 unsigned entity_rank_from ,
213 unsigned entity_rank_to ,
214 RelationIdentifier relation_identifier ,
215 OrdinalVector & induced_parts,
216 bool include_supersets)
218 if ( entity_rank_to < entity_rank_from &&
223 insert_part_and_supersets( induced_parts , part, include_supersets );
228 const std::vector<PartRelation> & part_rel = part.
relations();
230 for ( std::vector<PartRelation>::const_iterator
231 j = part_rel.begin() ; j != part_rel.end() ; ++j ) {
233 if ( & part == j->m_root &&
234 0 <= (* j->m_function)( entity_rank_from , entity_rank_to ,
235 relation_identifier ) ) {
236 insert_part_and_supersets( induced_parts , * j->m_target, include_supersets );
248 const OrdinalVector & omit ,
249 unsigned entity_rank_to ,
250 RelationIdentifier relation_identifier ,
251 OrdinalVector & induced_parts,
252 bool include_supersets)
255 const BulkData & mesh = BulkData::get(bucket_from);
257 const unsigned entity_rank_from = entity_from.
entity_rank();
261 if ( entity_rank_to < entity_rank_from &&
262 local_proc_rank == entity_from.
owner_rank() ) {
265 const std::pair<const unsigned *, const unsigned *>
268 OrdinalVector::const_iterator omit_begin = omit.begin(),
269 omit_end = omit.end();
272 for (
const unsigned * i = bucket_superset_ordinals.first ;
273 i != bucket_superset_ordinals.second ; ++i ) {
274 ThrowAssertMsg( *i < all_parts.size(),
"Index " << *i <<
" out of bounds" );
275 Part & part = * all_parts[*i] ;
277 if ( part.primary_entity_rank() == entity_rank_from && ! contains_ordinal( omit_begin, omit_end , *i )) {
281 relation_identifier ,
292 const OrdinalVector & omit ,
293 OrdinalVector & induced_parts,
294 bool include_supersets)
297 rel = entity.
relations() ; ! rel.empty() ; ++rel ) {
Entity * entity() const
The referenced entity.
bool operator<(const Relation &r) const
Ordering operator.
void induced_part_membership(const Entity &entity, const OrdinalVector &omit, OrdinalVector &induced_parts, bool include_supersets)
Induce an entity's part membership based upon relationships from other entities. Do not include and p...
bool membership_is_induced(const Part &part, unsigned entity_rank)
Query if a member entity of the given entity type has an induced membership.
Bucket & bucket() const
The bucket which holds this mesh entity's field data.
const EntityKey & key() const
The globally unique key ( entity type + identifier ) of this entity.
unsigned primary_entity_rank() const
The primary entity type for this part.
std::pair< const unsigned *, const unsigned * > superset_part_ordinals() const
Integer type for the entity keys, which is an encoding of the entity type and entity identifier...
An application-defined subset of a problem domain.
PairIterRelation relations() const
All Entity relations for which this entity is a member. The relations are ordered from lowest entity-...
void get_entities_through_relations(const std::vector< Entity *> &entities, unsigned entities_related_rank, std::vector< Entity *> &entities_related)
Query which mesh entities have a relation to all of the input mesh entities of the given mesh rank...
raw_relation_id_type raw_relation_id() const
The encoded relation raw_relation_id.
RelationIdentifier identifier() const
The local relation identifier.
A relation between two mesh entities with a relation identifier and kind .
const std::vector< PartRelation > & relations() const
PartRelations for which this part is a member, root or target.
Manager for an integrated collection of entities, entity relations, and buckets of field data...
const MetaData & mesh_meta_data() const
The meta data manager for this bulk data manager.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
unsigned entity_rank() const
The rank of the referenced entity.
unsigned parallel_rank() const
Rank of the parallel machine's local processor.
EntityRank entity_rank() const
The rank of this entity.
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.
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).
unsigned owner_rank() const
Parallel processor rank of the processor which owns this entity.