std::ostream & print_entity_key( std::ostream & os , const MetaData & meta_data , const EntityKey & key ) { const unsigned type = entity_rank(key); const EntityId id = entity_id(key); return print_entity_id( os , meta_data , type , id ); }
Entity * EntityRepository::get_entity(const EntityKey &key) const { ThrowErrorMsgIf( ! entity_key_valid( key ), "Invalid key: " << entity_rank(key) << " " << entity_id(key)); const EntityMap::const_iterator i = m_entities.find( key ); return i != m_entities.end() ? i->second : NULL ; }
void unpack_entity_info( CommBuffer & buf, const BulkData & mesh , EntityKey & key , unsigned & owner , PartVector & parts , std::vector<Relation> & relations ) { unsigned nparts = 0 ; unsigned nrel = 0 ; buf.unpack<EntityKey>( key ); buf.unpack<unsigned>( owner ); buf.unpack<unsigned>( nparts ); parts.resize( nparts ); for ( unsigned i = 0 ; i < nparts ; ++i ) { unsigned part_ordinal = ~0u ; buf.unpack<unsigned>( part_ordinal ); parts[i] = & MetaData::get(mesh).get_part( part_ordinal ); } buf.unpack( nrel ); relations.clear(); relations.reserve( nrel ); for ( unsigned i = 0 ; i < nrel ; ++i ) { EntityKey rel_key ; unsigned rel_id = 0 ; unsigned rel_attr = 0 ; buf.unpack<EntityKey>( rel_key ); buf.unpack<unsigned>( rel_id ); buf.unpack<unsigned>( rel_attr ); Entity * const entity = mesh.get_entity( entity_rank(rel_key), entity_id(rel_key) ); if ( entity && EntityLogDeleted != entity->log_query() ) { Relation rel( * entity, rel_id ); rel.set_attribute(rel_attr); relations.push_back( rel ); } } }
void EntityRepository::internal_expunge_entity( EntityMap::iterator i ) { TraceIfWatching("stk::mesh::impl::EntityRepository::internal_expunge_entity", LOG_ENTITY, i->first); ThrowErrorMsgIf( i->second == NULL, "For key " << entity_rank(i->first) << " " << entity_id(i->first) << ", value was NULL"); ThrowErrorMsgIf( i->first != i->second->key(), "Key " << print_entity_key(MetaData::get( *i->second ), i->first) << " != " << print_entity_key(i->second)); Entity* deleted_entity = i->second; #ifdef SIERRA_MIGRATION destroy_fmwk_attr(deleted_entity->m_fmwk_attrs, m_use_pool); #endif destroy_entity(deleted_entity, m_use_pool); i->second = NULL; m_entities.erase( i ); }
inline stk::diag::Writer &operator<<(stk::diag::Writer &dout, const EntityKey &entity_key) { return dout << entity_rank(entity_key) << ":" << entity_id(entity_key); }
void setOrdinal(RelationIdentifier ordinal) { m_raw_relation = Relation::raw_relation_id( entity_rank(), ordinal ); }
entity_property(entity_rank r = entity_rank(), entity_id id = entity_id(), int proc=0) : m_rank(r), m_id(id), m_proc(proc) {}