Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dtk
dtk
Commits
6b5383d9
Commit
6b5383d9
authored
Feb 08, 2013
by
KLOCZKO Thibaud
Browse files
Update global test adding global directive.
parent
aec5aca9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/dtkDistributed/dtkDistributedContainer.h
View file @
6b5383d9
...
...
@@ -3,9 +3,9 @@
* Author: Thibaud Kloczko
* Created: Tue Feb 5 14:08:23 2013 (+0100)
* Version:
* Last-Updated: 2013 Fri Feb 8 16:1
0:23
(+0100)
* Last-Updated: 2013 Fri Feb 8 16:1
8:41
(+0100)
* By: Thibaud Kloczko
* Update #: 12
2
* Update #: 12
3
*/
/* Change Log:
...
...
@@ -74,7 +74,7 @@ public:
};
// ///////////////////////////////////////////////////////////////////
// dtkDistributed
Loc
alIterator
// dtkDistributed
Glob
alIterator
// ///////////////////////////////////////////////////////////////////
template
<
typename
T
>
class
dtkDistributedGlobalIterator
...
...
test/dtkDistributed/dtkDistributedContainerTest.cpp
View file @
6b5383d9
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment