8#define BOOST_TEST_DYN_LINK
9#include <boost/test/unit_test.hpp>
10#include "Space/Shape/Box.hpp"
12#include "Vector/map_vector.hpp"
13#include "Decomposition/shift_vect_converter.hpp"
15BOOST_AUTO_TEST_SUITE( shift_vect_converter_tests_suite )
17BOOST_AUTO_TEST_CASE( shift_vect_converter_tests_use )
22 size_t bc[3] = {PERIODIC,PERIODIC,PERIODIC};
26 svc.generateShiftVectors(domain,bc,sv);
28 BOOST_REQUIRE_EQUAL(sv.
size(),27ul);
31 comb<3> cmb1({(char)-1,(
char)-1,(char)1});
32 comb<3> cmb2({(char)-1,(
char)0,(char)1});
33 comb<3> cmb3({(char)0,(
char)0,(char)1});
35 size_t i = svc.linId(cmb1);
37 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[0],-1.0);
38 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[1],1.0);
39 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[2],1.0);
43 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[0],-1.0);
44 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[1],0.0);
45 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[2],1.0);
49 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[0],-1.0);
50 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[1],0.0);
51 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[2],0.0);
60 for (
size_t i = 0 ; i < 50 ; i++)
63 domain.setHigh(i,1.0);
75 BOOST_REQUIRE_EQUAL(sv.
size(),27ul);
94 size_t i = svc.
linId(cmb1);
96 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[5],-1.0);
97 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[6],0.0);
98 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[17],1.0);
99 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[23],1.0);
100 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[24],0.0);
104 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[5],-1.0);
105 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[6],0.0);
106 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[17],0.0);
107 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[23],1.0);
108 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[24],0.0);
112 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[5],-1.0);
113 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[6],0.0);
114 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[17],0.0);
115 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[23],0.0);
116 BOOST_REQUIRE_EQUAL(sv.get<0>(i)[24],0.0);
122BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
Implementation of 1-D std::vector like structure.
in case of high dimensions shift vector converter
void generateShiftVectors(const Box< dim, T > &domain, size_t(&bc)[dim], openfpm::vector< Point< dim, T >, Memory, layout_base > &shifts)
Here we generare the shift vectors for the low dimension case.
size_t linId(const comb< dim > &cmb)
linearize the combination in case of high dimensions
Position of the element of dimension d in the hyper-cube of dimension dim.
signed char c[dim]
Array that store the combination.