8#ifndef SRC_DECOMPOSITION_NN_PROCESSOR_UNIT_TEST_HPP_
9#define SRC_DECOMPOSITION_NN_PROCESSOR_UNIT_TEST_HPP_
11#include "VCluster/VCluster.hpp"
17 box_nn_processor.add();
21 box_nn_processor.get(0).add(1);
22 box_nn_processor.get(0).add(2);
23 box_nn_processor.get(0).add(3);
29 box_nn_processor.get(0).add(0);
30 box_nn_processor.get(0).add(2);
31 box_nn_processor.get(0).add(3);
37 box_nn_processor.get(0).add(1);
38 box_nn_processor.get(0).add(0);
39 box_nn_processor.get(0).add(3);
45 box_nn_processor.get(0).add(1);
46 box_nn_processor.get(0).add(2);
47 box_nn_processor.get(0).add(0);
53BOOST_AUTO_TEST_SUITE( nn_processor_test )
55BOOST_AUTO_TEST_CASE( nn_processor_np_test)
87 create_decomposition2x2(box_nn_processor,sub_domains);
90 nnp.create(box_nn_processor, sub_domains);
92 BOOST_REQUIRE_EQUAL(nnp.getNNProcessors(),3ul);
96 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(1),1ul);
97 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(2),1ul);
98 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(3),1ul);
113 bool ret1 = b1_a == b1_b;
114 bool ret2 = b2_a == b2_b;
115 bool ret3 = b3_a == b3_b;
117 BOOST_REQUIRE_EQUAL(ret1,
true);
118 BOOST_REQUIRE_EQUAL(ret2,
true);
119 BOOST_REQUIRE_EQUAL(ret3,
true);
123 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(0),1ul);
124 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(2),1ul);
125 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(3),1ul);
140 bool ret1 = b1_a == b1_b;
141 bool ret2 = b2_a == b2_b;
142 bool ret3 = b3_a == b3_b;
144 BOOST_REQUIRE_EQUAL(ret1,
true);
145 BOOST_REQUIRE_EQUAL(ret2,
true);
146 BOOST_REQUIRE_EQUAL(ret3,
true);
150 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(1),1ul);
151 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(0),1ul);
152 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(3),1ul);
166 bool ret1 = b1_a == b1_b;
167 bool ret2 = b2_a == b2_b;
168 bool ret3 = b3_a == b3_b;
170 BOOST_REQUIRE_EQUAL(ret1,
true);
171 BOOST_REQUIRE_EQUAL(ret2,
true);
172 BOOST_REQUIRE_EQUAL(ret3,
true);
176 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(0),1ul);
177 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(1),1ul);
178 BOOST_REQUIRE_EQUAL(nnp.getNRealSubdomains(2),1ul);
192 bool ret1 = b1_a == b1_b;
193 bool ret2 = b2_a == b2_b;
194 bool ret3 = b3_a == b3_b;
196 BOOST_REQUIRE_EQUAL(ret1,
true);
197 BOOST_REQUIRE_EQUAL(ret2,
true);
198 BOOST_REQUIRE_EQUAL(ret3,
true);
202BOOST_AUTO_TEST_CASE( nn_processor_box_periodic_test)
233 const size_t bc[2] = {PERIODIC,PERIODIC};
240 create_decomposition2x2(box_nn_processor,sub_domains);
245 nnp.create(box_nn_processor, sub_domains);
249 nnp.applyBC(domain,ghost,bc);
253 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(1).size(),4ul);
254 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(2).size(),4ul);
255 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(3).size(),4ul);
264 bool ret = nnp.getNearSubdomains(1) == bv;
265 BOOST_REQUIRE_EQUAL(ret,
true);
274 ret = nnp.getNearSubdomains(2) == bv;
275 BOOST_REQUIRE_EQUAL(ret,
true);
284 ret = nnp.getNearSubdomains(3) == bv;
285 BOOST_REQUIRE_EQUAL(ret,
true);
289 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(0).size(),4ul);
290 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(2).size(),4ul);
291 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(3).size(),4ul);
300 bool ret = nnp.getNearSubdomains(0) == bv;
301 BOOST_REQUIRE_EQUAL(ret,
true);
310 ret = nnp.getNearSubdomains(2) == bv;
311 BOOST_REQUIRE_EQUAL(ret,
true);
320 ret = nnp.getNearSubdomains(3) == bv;
321 BOOST_REQUIRE_EQUAL(ret,
true);
325 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(0).size(),4ul);
326 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(1).size(),4ul);
327 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(3).size(),4ul);
336 bool ret = nnp.getNearSubdomains(0) == bv;
337 BOOST_REQUIRE_EQUAL(ret,
true);
346 ret = nnp.getNearSubdomains(1) == bv;
347 BOOST_REQUIRE_EQUAL(ret,
true);
356 ret = nnp.getNearSubdomains(3) == bv;
357 BOOST_REQUIRE_EQUAL(ret,
true);
361 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(0).size(),4ul);
362 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(1).size(),4ul);
363 BOOST_REQUIRE_EQUAL(nnp.getNearSubdomains(2).size(),4ul);
372 bool ret = nnp.getNearSubdomains(0) == bv;
373 BOOST_REQUIRE_EQUAL(ret,
true);
382 ret = nnp.getNearSubdomains(1) == bv;
383 BOOST_REQUIRE_EQUAL(ret,
true);
392 ret = nnp.getNearSubdomains(2) == bv;
393 BOOST_REQUIRE_EQUAL(ret,
true);
397BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
This class represent an N-dimensional box.
size_t getProcessUnitID()
Get the process unit id.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
This class store the adjacent processors and the adjacent sub_domains.
Implementation of 1-D std::vector like structure.