8 #ifndef OPENFPM_DATA_SRC_GRID_GRID_SM_UNIT_TESTS_HPP_
9 #define OPENFPM_DATA_SRC_GRID_GRID_SM_UNIT_TESTS_HPP_
11 #include "iterators/grid_key_dx_iterator_sub_bc.hpp"
13 BOOST_AUTO_TEST_SUITE( grid_sm_test )
16 BOOST_AUTO_TEST_CASE( grid_sm_linearization )
22 size_t sz[3] = {8,8,8};
25 size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
28 BOOST_REQUIRE_EQUAL(lin,146);
30 BOOST_REQUIRE_EQUAL(lin,-1);
32 BOOST_REQUIRE_EQUAL(lin,-1);
34 for (
size_t i = 0 ; i < 3 ; i++)
38 BOOST_REQUIRE_EQUAL(lin,146);
40 BOOST_REQUIRE_EQUAL(lin,71);
42 BOOST_REQUIRE_EQUAL(lin,62);
46 BOOST_AUTO_TEST_CASE( grid_iterator_sub_p )
51 size_t sz[3] = {8,8,8};
63 for (
size_t i = 0 ; i < 3 ; i++)
65 BOOST_REQUIRE_EQUAL(
key.get(i) >= (
long int)0,
true);
66 BOOST_REQUIRE_EQUAL(
key.get(i) < (
long int)sz[i],
true);
74 BOOST_REQUIRE_EQUAL(cnt,216ul);
84 for (
size_t i = 0 ; i < 3 ; i++)
86 BOOST_REQUIRE_EQUAL(
key.get(i) >= (
long int)0,
true);
87 BOOST_REQUIRE_EQUAL(
key.get(i) < (
long int)sz[i],
true);
95 BOOST_REQUIRE_EQUAL(cnt,1331ul);
106 auto key = it3.get();
108 for (
size_t i = 0 ; i < 3 ; i++)
110 BOOST_REQUIRE_EQUAL(
key.get(i) >= (
long int)0,
true);
111 BOOST_REQUIRE_EQUAL(
key.get(i) < (
long int)sz[i],
true);
119 BOOST_REQUIRE_EQUAL(cnt,36ul);
129 auto key = it4.get();
131 for (
size_t i = 0 ; i < 3 ; i++)
133 BOOST_REQUIRE_EQUAL(
key.get(i) >= (
long int)0,
true);
134 BOOST_REQUIRE_EQUAL(
key.get(i) < (
long int)sz[i],
true);
142 BOOST_REQUIRE_EQUAL(cnt,27ul);
155 auto key = it5.get();
157 for (
size_t i = 0 ; i < 3 ; i++)
159 BOOST_REQUIRE_EQUAL(
key.get(i) >= 0,
true);
160 BOOST_REQUIRE_EQUAL(
key.get(i) < (
long int)sz[i],
true);
168 BOOST_REQUIRE_EQUAL(cnt,0ul);
171 BOOST_AUTO_TEST_SUITE_END()
grid_key_dx is the key to access any element in the grid
Position of the element of dimension d in the hyper-cube of dimension dim.
The same as grid_key_dx_iterator_sub_p but with periodic boundary.
This class is a trick to indicate the compiler a specific specialization pattern. ...
class that store the information of the grid like number of point on each direction and define the in...
Class to check if the edge can be created or not.