Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch an issue that seems unique to certain clang builds. #7836

Merged
merged 1 commit into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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