Changeset 418:cfb70bb62bed
- Timestamp:
- 11/03/2012 01:56:16 AM (7 months ago)
- Author:
- Andreas Schaefer <gentryx@…>
- Branch:
- default
- Children:
- 419:79940a8687ac, 423:06105dbc4269
- Message:
-
Steerer interface for HiParSimulator? now operational and tested
- Location:
- src
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r357
|
r418
|
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | | |
| | 38 | |
| 39 | 39 | for (typename Region<DIM>::Iterator i = validRegion.begin(); |
| 40 | 40 | i != validRegion.end(); |
-
|
r417
|
r418
|
|
| 22 | 22 | class UpdateGroup |
| 23 | 23 | { |
| | 24 | friend class HiParSimulatorTest; |
| 24 | 25 | friend class UpdateGroupPrototypeTest; |
| 25 | 26 | friend class UpdateGroupTest; |
| … |
… |
|
| 121 | 122 | } |
| 122 | 123 | |
| | 124 | // add external PatchProviders last to allow them to override |
| | 125 | // the local ghost zone providers (a.k.a. PatchLink::Source). |
| 123 | 126 | for (typename PatchProviderVec::iterator i = patchProvidersGhost.begin(); |
| 124 | 127 | i != patchProvidersGhost.end(); |
-
|
r417
|
r418
|
|
| 5 | 5 | #include <libgeodecomp/io/mocksteerer.h> |
| 6 | 6 | #include <libgeodecomp/io/mockwriter.h> |
| | 7 | #include <libgeodecomp/io/teststeerer.h> |
| 7 | 8 | #include <libgeodecomp/io/parallelmemorywriter.h> |
| 8 | 9 | #include <libgeodecomp/io/testinitializer.h> |
| … |
… |
|
| 22 | 23 | { |
| 23 | 24 | public: |
| | 25 | typedef GridBase<TestCell<2>, 2> GridBaseType; |
| 24 | 26 | // fixme: rename types a la "MyFoobar" to "FoobarType" |
| 25 | 27 | typedef HiParSimulator<TestCell<2>, StripingPartition<2> > SimulatorType; |
| 26 | 28 | typedef ParallelMemoryWriter<TestCell<2> > MemoryWriterType; |
| 27 | | typedef MockSteerer<TestCell<2> > SteererType; |
| | 29 | typedef MockSteerer<TestCell<2> > MockSteererType; |
| | 30 | typedef TestSteerer<2 > TestSteererType; |
| 28 | 31 | |
| 29 | 32 | void setUp() |
| … |
… |
|
| 101 | 104 | { |
| 102 | 105 | std::stringstream events; |
| 103 | | s->addSteerer(new SteererType(5, &events)); |
| | 106 | s->addSteerer(new MockSteererType(5, &events)); |
| 104 | 107 | s->run(); |
| 105 | 108 | s.reset(); |
| … |
… |
|
| 107 | 110 | std::stringstream expected; |
| 108 | 111 | expected << "created, period = 5\n"; |
| 109 | | for (int i = 20; i <= 200; i += 5) { |
| | 112 | for (int i = 25; i <= 200; i += 5) { |
| | 113 | expected << "nextStep(" << i << ")\n"; |
| 110 | 114 | expected << "nextStep(" << i << ")\n"; |
| 111 | 115 | } |
| … |
… |
|
| 113 | 117 | |
| 114 | 118 | TS_ASSERT_EQUALS(events.str(), expected.str()); |
| | 119 | } |
| | 120 | |
| | 121 | void testSteererFunctionality() |
| | 122 | { |
| | 123 | s->addSteerer(new TestSteererType(5, 25, 4711 * 27)); |
| | 124 | s->run(); |
| | 125 | |
| | 126 | const Region<2> *region = &s->updateGroup->partitionManager->ownRegion(); |
| | 127 | const GridBaseType *grid = &s->updateGroup->grid(); |
| | 128 | int cycle = 200 * 27 + 4711 * 27; |
| | 129 | |
| | 130 | TS_ASSERT_TEST_GRID_REGION( |
| | 131 | GridBaseType, |
| | 132 | *grid, |
| | 133 | *region, |
| | 134 | cycle); |
| 115 | 135 | } |
| 116 | 136 | |
-
|
r376
|
r418
|
|
| 2 | 2 | #include <cxxtest/TestSuite.h> |
| 3 | 3 | #include <sstream> |
| | 4 | #include <libgeodecomp/io/mocksteerer.h> |
| 4 | 5 | #include <libgeodecomp/io/mockwriter.h> |
| | 6 | #include <libgeodecomp/io/teststeerer.h> |
| 5 | 7 | #include <libgeodecomp/io/parallelmemorywriter.h> |
| 6 | 8 | #include <libgeodecomp/io/testinitializer.h> |
| … |
… |
|
| 20 | 22 | { |
| 21 | 23 | public: |
| | 24 | typedef GridBase<TestCell<2>, 2> GridBaseType; |
| 22 | 25 | typedef HiParSimulator<TestCell<2>, ZCurvePartition<2> > SimulatorType; |
| 23 | 26 | typedef ParallelMemoryWriter<TestCell<2> > MemoryWriterType; |
| | 27 | typedef MockSteerer<TestCell<2> > MockSteererType; |
| | 28 | typedef TestSteerer<2 > TestSteererType; |
| 24 | 29 | |
| 25 | 30 | void setUp() |
| … |
… |
|
| 106 | 111 | } |
| 107 | 112 | |
| | 113 | void testSteererCallback() |
| | 114 | { |
| | 115 | std::stringstream events; |
| | 116 | s->addSteerer(new MockSteererType(5, &events)); |
| | 117 | s->run(); |
| | 118 | s.reset(); |
| | 119 | |
| | 120 | std::stringstream expected; |
| | 121 | expected << "created, period = 5\n"; |
| | 122 | for (int i = 25; i <= 100; i += 5) { |
| | 123 | expected << "nextStep(" << i << ")\n"; |
| | 124 | expected << "nextStep(" << i << ")\n"; |
| | 125 | } |
| | 126 | expected << "deleted\n"; |
| | 127 | |
| | 128 | TS_ASSERT_EQUALS(events.str(), expected.str()); |
| | 129 | } |
| | 130 | |
| | 131 | void testSteererFunctionality() |
| | 132 | { |
| | 133 | s->addSteerer(new TestSteererType(5, 25, 4711 * 27)); |
| | 134 | s->run(); |
| | 135 | |
| | 136 | const Region<2> *region = &s->updateGroup->partitionManager->ownRegion(); |
| | 137 | const GridBaseType *grid = &s->updateGroup->grid(); |
| | 138 | int cycle = 100 * 27 + 4711 * 27; |
| | 139 | |
| | 140 | TS_ASSERT_TEST_GRID_REGION( |
| | 141 | GridBaseType, |
| | 142 | *grid, |
| | 143 | *region, |
| | 144 | cycle); |
| | 145 | } |
| | 146 | |
| 108 | 147 | private: |
| 109 | 148 | boost::shared_ptr<SimulatorType> s; |
| … |
… |
|
| 119 | 158 | }; |
| 120 | 159 | |
| 121 | | }; |
| 122 | | }; |
| | 160 | } |
| | 161 | } |