OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
DLB_unit_test.hpp
1/*
2 * DLB_unit_test.hpp
3 *
4 * Created on: Nov 24, 2015
5 * Author: Antonio Leo
6 */
7
8#ifndef DLB_UNIT_TEST_HPP_
9#define DLB_UNIT_TEST_HPP_
10
11#include "DLB.hpp"
12
13BOOST_AUTO_TEST_SUITE (DLB_test)
14
15BOOST_AUTO_TEST_CASE( DLB_test_use)
16{
17 // Vcluster
18 Vcluster & vcl = *global_v_cluster;
19
20 // Initialize the global VCluster
21 init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv);
22
23 // Init DLB tool
24 DLB dlb(vcl);
25
26 // Init dlb parameters
27 dlb.setComputationCost(5);
28 dlb.setSimulationStartTime(0);
29 dlb.setSimulationEndTime(10);
30
31 // Time value of the "unbalanced" process
32 float t_high = 1;
33
34 for(float t = dlb.getSimulationStartTime();
35 t < dlb.getSimulationEndTime();
36 t++)
37 {
38 dlb.startIteration(0);
39
40 if(vcl.getProcessUnitID() == 0)
41 dlb.endIteration(1);
42 else{
43 dlb.endIteration(t_high++);
44 }
45
46
47 bool rebalance = dlb.rebalanceNeeded();
48
49 if(rebalance) {t_high = 1;}
50
51 if(t == 6)
52 BOOST_REQUIRE_EQUAL(rebalance,true);
53 }
54
55}
56
57BOOST_AUTO_TEST_SUITE_END()
58
59#endif /* DLB_UNIT_TEST_HPP_ */
Definition DLB.hpp:54
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Definition VCluster.hpp:59