From 63c8a09dd36367f0b972ab83e15ba6c0988f28ed Mon Sep 17 00:00:00 2001 From: Rebecca Neumann <rebecca@dune-project.org> Date: Thu, 20 Jan 2011 18:15:10 +0000 Subject: [PATCH] optimize computation of 'bordercontribution'. [[Imported from SVN: r1440]] --- dune/istl/novlpschwarz.hh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/dune/istl/novlpschwarz.hh b/dune/istl/novlpschwarz.hh index d4a76cf76..5abd0c8e2 100644 --- a/dune/istl/novlpschwarz.hh +++ b/dune/istl/novlpschwarz.hh @@ -128,22 +128,23 @@ namespace Dune { const PIS& pis=communication.indexSet(); const RI& ri = communication.remoteIndices(); - // set up mask vector - if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) { - mask.resize(x.size()); - for (typename std::vector<double>::size_type i=0; i<mask.size(); i++) - mask[i] = 1; - for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i) - if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner) - mask[i->local().local()] = 0; - else if (i->local().attribute()==OwnerOverlapCopyAttributeSet::overlap) - mask[i->local().local()] = 2; - } - // at the beginning make a multimap "bordercontribution". // process has i and j as border dofs but is not the owner // => only contribute to Ax if i,j is in bordercontribution if (buildcomm == true) { + + // set up mask vector + if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) { + mask.resize(x.size()); + for (typename std::vector<double>::size_type i=0; i<mask.size(); i++) + mask[i] = 1; + for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i) + if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy) + mask[i->local().local()] = 0; + else if (i->local().attribute()==OwnerOverlapCopyAttributeSet::overlap) + mask[i->local().local()] = 2; + } + for (MM::iterator iter = bordercontribution.begin(); iter != bordercontribution.end(); ++iter) bordercontribution.erase(iter); @@ -175,9 +176,13 @@ namespace Dune { && rindex->localIndexPair().local().local()==j.index()) { if (rindex->attribute() == OwnerOverlapCopyAttributeSet::owner || remote->first == iowner - || remote->first < communication.communicator().rank()) + || remote->first < communication.communicator().rank()) { flag = false; + continue; + } } + if (flag == false) + continue; } //don´t contribute to Ax if //1. the owner of j has i as interior/border dof -- GitLab