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 ) {