9 #ifndef stk_mesh_SetOwners_hpp 10 #define stk_mesh_SetOwners_hpp 15 #include <stk_mesh/base/BulkData.hpp> 20 typedef std::less<unsigned> LowestRankSharingProcOwns;
21 typedef std::greater<unsigned> HighestRankSharingProcOwns;
27 template<
class OwnershipRule>
28 void set_owners(BulkData& mesh_bulk_data)
30 typedef std::set<unsigned,OwnershipRule> ProcSet ;
32 const unsigned local_proc = mesh_bulk_data.parallel_rank();
34 std::vector<EntityProc> entity_new_owners;
36 const std::vector<Entity*>& entity_comm = mesh_bulk_data.entity_comm();
38 for (
size_t i=0; i<entity_comm.size(); ++i) {
39 Entity *
const entity = entity_comm[i] ;
43 if ( ! sharing.empty() && entity->
owner_rank() == local_proc ) {
46 proc_set.insert( local_proc );
48 for (
size_t j = 0 ; j < sharing.size() ; ++j ) {
49 proc_set.insert( sharing[j].proc );
52 const unsigned new_owner_proc = *proc_set.begin();
54 entity_new_owners.push_back(std::make_pair( entity, new_owner_proc ) );
58 mesh_bulk_data.modification_begin();
60 mesh_bulk_data.change_entity_owner( entity_new_owners );
62 mesh_bulk_data.modification_end();
68 #endif // stk_mesh_SetOwner_hpp PairIterEntityComm sharing() const
Parallel processes which share this entity.
PairIter< std::vector< EntityCommInfo >::const_iterator > PairIterEntityComm
Span of ( communication-subset-ordinal , process-rank ) pairs for the communication of an entity...
unsigned owner_rank() const
Parallel processor rank of the processor which owns this entity.