OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
NNc_array_tests.hpp
1 /*
2  * NNc_array_tests.hpp
3  *
4  * Created on: Feb 6, 2018
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_NN_CELLLIST_TESTS_NNC_ARRAY_TESTS_HPP_
9 #define OPENFPM_DATA_SRC_NN_CELLLIST_TESTS_NNC_ARRAY_TESTS_HPP_
10 
11 #include "NN/CellList/NNc_array.hpp"
12 
13 BOOST_AUTO_TEST_SUITE( NNc_array_tests )
14 
15 BOOST_AUTO_TEST_CASE( NNc_array_tests_use )
16 {
17  {
20 
21  size_t sz[2] = {13,17};
22 
23  nnc.set_size(sz);
24  nnc2.set_size(sz);
25  nnc.init_full();
26  nnc2.init_full();
27 
28  for (size_t i = 0 ; i < 9 ; i++)
29  {
30  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
31  }
32  }
33 
34  {
37 
38  size_t sz[3] = {13,17,11};
39 
40  nnc.set_size(sz);
41  nnc2.set_size(sz);
42  nnc.init_full();
43  nnc2.init_full();
44 
45  for (size_t i = 0 ; i < 27 ; i++)
46  {
47  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
48  }
49  }
50 
51  {
54 
55  size_t sz[5] = {13,17,11,7,7};
56 
57  nnc.set_size(sz);
58  nnc2.set_size(sz);
59  nnc.init_full();
60  nnc2.init_full();
61 
62  for (size_t i = 0 ; i < 243 ; i++)
63  {
64  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
65  }
66  }
67 
68 
69  {
72 
73  size_t sz[2] = {13,17};
74 
75  nnc.set_size(sz);
76  nnc2.set_size(sz);
77  nnc.init_sym();
78  nnc2.init_sym();
79 
80  for (size_t i = 0 ; i < 5 ; i++)
81  {
82  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
83  }
84  }
85 
86  {
89 
90  size_t sz[3] = {13,17,11};
91 
92  nnc.set_size(sz);
93  nnc2.set_size(sz);
94  nnc.init_full();
95  nnc2.init_full();
96 
97  for (size_t i = 0 ; i < 27 ; i++)
98  {
99  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
100  }
101  }
102 
103  {
106 
107  size_t sz[5] = {13,17,11,7,7};
108 
109  nnc.set_size(sz);
110  nnc2.set_size(sz);
111  nnc.init_full();
112  nnc2.init_full();
113 
114  for (size_t i = 0 ; i < 243 ; i++)
115  {
116  BOOST_REQUIRE_EQUAL(nnc[i],nnc2[i]);
117  }
118  }
119 }
120 
121 BOOST_AUTO_TEST_SUITE_END()
122 
123 
124 #endif /* OPENFPM_DATA_SRC_NN_CELLLIST_TESTS_NNC_ARRAY_TESTS_HPP_ */
void set_size(const size_t(&sz)[dim])
Set the size in each.
Definition: NNc_array.hpp:47
void init_sym()
Initialize the NNc array with symmetric neighborhood cells indexes.
Definition: NNc_array.hpp:104
void init_full()
Initialize the NNc array with full neighborhood cells indexes.
Definition: NNc_array.hpp:76