Skip to content
Snippets Groups Projects
Commit 01c9bdb5 authored by Rebecca Neumann's avatar Rebecca Neumann
Browse files

make computation of bordercontribution faster by storing pointers to the RemoteIndexSet

[[Imported from SVN: r1480]]
parent 6bd8bb80
No related branches found
No related tags found
No related merge requests found
...@@ -79,6 +79,8 @@ namespace Dune { ...@@ -79,6 +79,8 @@ namespace Dune {
typedef typename M::ConstColIterator ColIterator; typedef typename M::ConstColIterator ColIterator;
typedef typename M::ConstRowIterator RowIterator; typedef typename M::ConstRowIterator RowIterator;
typedef std::multimap<int,int> MM; typedef std::multimap<int,int> MM;
typedef std::multimap<int,std::pair<int,RILIterator> > RIMap;
typedef typename RIMap::iterator RIMapit;
enum { enum {
//! \brief The solver category. //! \brief The solver category.
...@@ -148,42 +150,48 @@ namespace Dune { ...@@ -148,42 +150,48 @@ namespace Dune {
for (MM::iterator iter = bordercontribution.begin(); for (MM::iterator iter = bordercontribution.begin();
iter != bordercontribution.end(); ++iter) iter != bordercontribution.end(); ++iter)
bordercontribution.erase(iter); bordercontribution.erase(iter);
for (RowIterator i = _A_.begin(); i != _A_.end(); ++i) { std::map<int,int> owner; //key: local index i, value: process, that owns i
if (mask[i.index()] == 0) { RIMap rimap;
std::set<int> neighbours; //processes have i as interior/border dof
int iowner; //process which owns i // for each local index make multimap rimap:
// key: local index i, data: pair of process that knows i and pointer to RI entry
for (RowIterator i = _A_.begin(); i != _A_.end(); ++i)
if (mask[i.index()] == 0)
for (RIIterator remote = ri.begin(); remote != ri.end(); ++remote) { for (RIIterator remote = ri.begin(); remote != ri.end(); ++remote) {
RIL& ril = *(remote->second.first); RIL& ril = *(remote->second.first);
for (RILIterator rindex = ril.begin(); rindex != ril.end(); ++rindex) { for (RILIterator rindex = ril.begin(); rindex != ril.end(); ++rindex)
if (rindex->attribute() != OwnerOverlapCopyAttributeSet::overlap) { if (rindex->attribute() != OwnerOverlapCopyAttributeSet::overlap)
if (rindex->localIndexPair().local().local() == i.index()) { if (rindex->localIndexPair().local().local() == i.index()) {
neighbours.insert(remote->first); rimap.insert
(std::make_pair(i.index(),
std::pair<int,RILIterator>(remote->first, rindex)));
if(rindex->attribute()==OwnerOverlapCopyAttributeSet::owner) if(rindex->attribute()==OwnerOverlapCopyAttributeSet::owner)
iowner = remote->first; owner.insert(std::make_pair(i.index(),remote->first));
} }
}
}
} }
int iowner = 0;
for (RowIterator i = _A_.begin(); i != _A_.end(); ++i) {
if (mask[i.index()] == 0) {
std::map<int,int>::iterator it = owner.find(i.index());
iowner = it->second;
std::pair<RIMapit, RIMapit> foundiit = rimap.equal_range(i.index());
for (ColIterator j = _A_[i.index()].begin(); j != _A_[i.index()].end(); ++j) { for (ColIterator j = _A_[i.index()].begin(); j != _A_[i.index()].end(); ++j) {
if (mask[j.index()] == 0) { if (mask[j.index()] == 0) {
bool flag = true; bool flag = true;
for (RIIterator remote = ri.begin(); remote != ri.end(); ++remote) for (RIMapit foundi = foundiit.first; foundi != foundiit.second; ++foundi) {
if (neighbours.find(remote->first) != neighbours.end()) { std::pair<RIMapit, RIMapit> foundjit = rimap.equal_range(j.index());
RIL& ril = *(remote->second.first); for (RIMapit foundj = foundjit.first; foundj != foundjit.second; ++foundj)
for (RILIterator rindex = ril.begin(); rindex != ril.end(); if (foundj->second.first == foundi->second.first)
++rindex) if (foundj->second.second->attribute() == OwnerOverlapCopyAttributeSet::owner
if (rindex->attribute() != OwnerOverlapCopyAttributeSet::overlap || foundj->second.first == iowner
&& rindex->localIndexPair().local().local()==j.index()) { || foundj->second.first < communication.communicator().rank()) {
if (rindex->attribute() == OwnerOverlapCopyAttributeSet::owner flag = false;
|| remote->first == iowner continue;
|| remote->first < communication.communicator().rank()) {
flag = false;
continue;
}
} }
if (flag == false) if (flag == false)
continue; continue;
} }
// don´t contribute to Ax if // don´t contribute to Ax if
// 1. the owner of j has i as interior/border dof // 1. the owner of j has i as interior/border dof
// 2. iowner has j as interior/border dof // 2. iowner has j as interior/border dof
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment