Commit 6b5383d9 authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud
Browse files

Update global test adding global directive.

parent aec5aca9
......@@ -3,9 +3,9 @@
* Author: Thibaud Kloczko
* Created: Tue Feb 5 14:08:23 2013 (+0100)
* Version:
* Last-Updated: 2013 Fri Feb 8 16:10:23 (+0100)
* Last-Updated: 2013 Fri Feb 8 16:18:41 (+0100)
* By: Thibaud Kloczko
* Update #: 122
* Update #: 123
*/
/* Change Log:
......@@ -74,7 +74,7 @@ public:
};
// ///////////////////////////////////////////////////////////////////
// dtkDistributedLocalIterator
// dtkDistributedGlobalIterator
// ///////////////////////////////////////////////////////////////////
template<typename T> class dtkDistributedGlobalIterator
......
......@@ -72,51 +72,32 @@ void dtkDistributedContainerTestCase::testGlobal(void)
QVERIFY(N == c.size());
dtkDistributedGlobalIterator<qlonglong>& g_it = c.globalIterator();
while(g_it.hasNext()) {
c.set(g_it.globalIndex(), g_it.globalIndex());
g_it.next();
}
qlonglong check_sum = 0;
g_it.toFront();
while(g_it.hasNext()) {
check_sum += c.at(g_it.globalIndex());
g_it.next();
if (comm.rank() == 0) {
dtkDistributedGlobalIterator<qlonglong>& g_it = c.globalIterator();
while(g_it.hasNext()) {
c.set(g_it.globalIndex(), g_it.globalIndex());
g_it.next();
}
qlonglong check_sum = 0;
g_it.toFront();
while(g_it.hasNext()) {
check_sum += c.at(g_it.globalIndex());
g_it.next();
}
QVERIFY(sum == check_sum);
} else {
qDebug() << "OUPS";
}
QVERIFY(sum == check_sum);
}
void dtkDistributedContainerTestCase::testGlobalLocal(void)
{
qlonglong N = 1001;
qlonglong sum = 0;
for (qlonglong i = 0; i < N; ++i)
sum += i;
dtkDistributedCommunicator comm;
dtkDistributedContainer<qlonglong> c = dtkDistributedContainer<qlonglong>(N, &comm);
QVERIFY(N == c.size());
dtkDistributedGlobalIterator<qlonglong>& g_it = c.globalIterator();
while(g_it.hasNext()) {
c.set(g_it.globalIndex(), g_it.globalIndex());
g_it.next();
}
// dtkDistributedLocalIterator<qlonglong>& it = c.localIterator();
// while(it.hasNext()) {
// c.setLocal(it.localIndex(), 2 * c.localAt(it.localIndex()));
// it.next();
// }
}
void dtkDistributedContainerTestCase::cleanupTestCase(void)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment