Skip to content

Commit

Permalink
Merge Pull Request #7836 from alanw0/Trilinos/patch_stk_0813
Browse files Browse the repository at this point in the history
Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Patch an issue that seems unique to certain clang builds.
PR Author: alanw0
  • Loading branch information
trilinos-autotester authored Aug 13, 2020
2 parents 624f2d5 + 22fec7d commit a3a548a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 47 deletions.
52 changes: 38 additions & 14 deletions packages/stk/stk_mesh/stk_mesh/base/BulkData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1703,15 +1703,27 @@ void BulkData::comm_shared_procs(Entity entity, std::vector<int> & procs ) const
void BulkData::shared_procs_intersection(const std::vector<EntityKey> & keys, std::vector<int> & procs ) const
{
procs.clear();
const int num = keys.size();
int num = keys.size();
std::vector<int> procs_tmp;
std::vector<int> result;
for (int i = 0; i < num; ++i)
{
if (i == 0) {
comm_shared_procs(keys[i], procs);
}
else {
PairIterEntityComm sharedComm = internal_entity_comm_map_shared(keys[i]);
impl::intersect_with(procs, sharedComm);
comm_shared_procs(keys[i], procs_tmp);

if (i == 0)
procs.swap(procs_tmp);
else
{
// subsequent loops keep the intersection
result.clear();
std::back_insert_iterator<std::vector<int> > result_itr(result);
std::set_intersection(procs.begin(),
procs.end(),
procs_tmp.begin(),
procs_tmp.end(),
result_itr,
std::less<int>());
procs.swap(result);
}
}
}
Expand All @@ -1720,15 +1732,27 @@ void BulkData::shared_procs_intersection(const EntityVector& entities,
std::vector<int> & procs ) const
{
procs.clear();
const int num = entities.size();
int num = entities.size();
std::vector<int> procs_tmp;
std::vector<int> result;
for (int i = 0; i < num; ++i)
{
if (i == 0) {
comm_shared_procs(entities[i], procs);
}
else {
PairIterEntityComm sharedComm = internal_entity_comm_map_shared(entities[i]);
impl::intersect_with(procs, sharedComm);
comm_shared_procs(entities[i], procs_tmp);

if (i == 0)
procs.swap(procs_tmp);
else
{
// subsequent loops keep the intersection
result.clear();
std::back_insert_iterator<std::vector<int> > result_itr(result);
std::set_intersection(procs.begin(),
procs.end(),
procs_tmp.begin(),
procs_tmp.end(),
result_itr,
std::less<int>());
procs.swap(result);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/stk/stk_mesh/stk_mesh/base/FieldParallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ void communicate_field_data(const BulkData& mesh ,
{
const int parallel_size = mesh.parallel_size();
if ( fields.empty() || parallel_size == 1) {
std::cerr<<"P"<<mesh.parallel_rank()<<" returning early!"<<std::endl;
return;
}

Expand Down
29 changes: 0 additions & 29 deletions packages/stk/stk_mesh/stk_mesh/baseImpl/MeshCommImplUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,35 +414,6 @@ void comm_shared_procs(const EntityCommInfoVector& commInfoVec,
}
}

bool proc_is_found(int proc, PairIterEntityComm sharedComm)
{
const unsigned len = sharedComm.size();
unsigned i=0;
while(i<len) {
if (proc == sharedComm[i].proc) {
return true;
}
++i;
}
return false;
}

void intersect_with(std::vector<int>& sharingProcsIntersection,
const PairIterEntityComm& sharedComm)
{
const unsigned len = sharingProcsIntersection.size();
unsigned keep = 0;
for(unsigned ip=0; ip<len; ++ip) {
if (proc_is_found(sharingProcsIntersection[ip], sharedComm)) {
if (ip != keep) {
sharingProcsIntersection[keep] = sharingProcsIntersection[ip];
}
++keep;
}
}
sharingProcsIntersection.resize(keep);
}

void fill_sorted_procs(const PairIterEntityComm& ec, std::vector<int>& procs)
{
procs.clear();
Expand Down
3 changes: 0 additions & 3 deletions packages/stk/stk_mesh/stk_mesh/baseImpl/MeshCommImplUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ bool all_ghost_ids_are_found_in_comm_data(const PairIterEntityComm& comm_data,
void comm_shared_procs(const EntityCommInfoVector& commInfoVec,
std::vector<int>& sharingProcs);

void intersect_with(std::vector<int>& sharingProcsIntersection,
const PairIterEntityComm& sharedComm);

void fill_sorted_procs(const PairIterEntityComm& ec, std::vector<int>& procs);

void fill_ghosting_procs(const PairIterEntityComm& ec, unsigned ghost_id, std::vector<int>& procs);
Expand Down

0 comments on commit a3a548a

Please sign in to comment.