OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
debug_test.cpp
1#include "config.h"
2#define BOOST_TEST_DYN_LINK
3#include <boost/test/unit_test.hpp>
4#include "Vector/vector_dist.hpp"
5#include "debug.hpp"
6
7BOOST_AUTO_TEST_SUITE( debug_util_test )
8
9BOOST_AUTO_TEST_CASE( debug_dist_util_test_use )
10{
11 Vcluster<> & v_cl = create_vcluster();
12
13 if (v_cl.getProcessingUnits() != 1)
14 {return;}
15
16 // Boundary conditions
17 size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
18
19 // Box
20 Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
21
22 // ghost
23 Ghost<3,float> ghost(0.1);
24
25 // first phase
27
28 vd.getPos(0)[0] = 0.1;
29 vd.getPos(0)[1] = 0.2;
30 vd.getPos(0)[2] = 0.3;
31
32 vd.getPos(1)[0] = 0.2;
33 vd.getPos(1)[1] = 0.3;
34 vd.getPos(1)[2] = 0.4;
35
36 vd.getPos(2)[0] = 0.3;
37 vd.getPos(2)[1] = 0.4;
38 vd.getPos(2)[2] = 0.5;
39
40 vd.getPos(3)[0] = 0.4;
41 vd.getPos(3)[1] = 0.5;
42 vd.getPos(3)[2] = 0.6;
43
44 Box<3,float> box1({0.0,0.0,0.0},{0.01,0.01,0.01});
45 Box<3,float> box2({0.0,0.0,0.0},{0.5,0.5,0.5});
46
47 bool test = debug_is_in_box(vd,box1);
48 BOOST_REQUIRE_EQUAL(test,false);
49
50 test = debug_is_in_box(vd,box2,debug_iterator::DOMAIN_IT,debug_run::HOST,false);
51 BOOST_REQUIRE_EQUAL(test,true);
52}
53
54BOOST_AUTO_TEST_CASE( debug_util_test_use )
55{
56 Vcluster<> & v_cl = create_vcluster();
57
58 if (v_cl.getProcessingUnits() != 1)
59 {return;}
60
61 // Boundary conditions
62 size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
63
64 // Box
65 Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
66
67 // ghost
68 Ghost<3,float> ghost(0.1);
69
70 // first phase
72
73 vd.get<0>(0)[0] = 0.1;
74 vd.get<0>(0)[1] = 0.2;
75 vd.get<0>(0)[2] = 0.3;
76
77 vd.get<0>(1)[0] = 0.2;
78 vd.get<0>(1)[1] = 0.3;
79 vd.get<0>(1)[2] = 0.4;
80
81 vd.get<0>(2)[0] = 0.3;
82 vd.get<0>(2)[1] = 0.4;
83 vd.get<0>(2)[2] = 0.5;
84
85 vd.get<0>(3)[0] = 0.4;
86 vd.get<0>(3)[1] = 0.5;
87 vd.get<0>(3)[2] = 0.6;
88
89 Box<3,float> box1({0.0,0.0,0.0},{0.01,0.01,0.01});
90 Box<3,float> box2({0.0,0.0,0.0},{0.5,0.5,0.5});
91
92 bool test = debug_is_in_box_single(vd,box1,vd.size());
93 BOOST_REQUIRE_EQUAL(test,false);
94
95 test = debug_is_in_box_single(vd,box2,vd.size(),"",debug_iterator::DOMAIN_IT,debug_run::HOST,false);
96 BOOST_REQUIRE_EQUAL(test,true);
97}
98
99BOOST_AUTO_TEST_SUITE_END()
100
This class represent an N-dimensional box.
Definition Box.hpp:61
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
Definition VCluster.hpp:59
Implementation of 1-D std::vector like structure.
Distributed vector.