7#define BOOST_TEST_DYN_LINK
8#include <boost/test/unit_test.hpp>
10#include "Vector/vector_dist.hpp"
11#include "Packer_Unpacker/Pack_selector.hpp"
12#include "Packer_Unpacker/Packer.hpp"
13#include "Packer_Unpacker/Unpacker.hpp"
14#include "Vector/performance/vector_dist_performance_util.hpp"
15#include "NN/CellList/CellList_util.hpp"
19BOOST_AUTO_TEST_SUITE( vd_hdf5_chckpnt_rstrt_test )
24BOOST_AUTO_TEST_CASE( vector_dist_hdf5_save_test )
28 for (
size_t i = 0; i < dim; i++)
40 size_t sz[dim] = {Ng,Ng,Ng};
42 for (
size_t i = 0; i < dim; i++)
43 {bc[i] = NON_PERIODIC;}
52 auto it = vd.getGridIterator(sz);
60 vd.getLastPos()[0] = key.get(0) * it.getSpacing(0);
61 vd.getLastPos()[1] = key.get(1) * it.getSpacing(1);
62 vd.getLastPos()[2] = key.get(2) * it.getSpacing(2);
71 auto it2 = vd.getDomainIterator();
78 for (
size_t i = 0; i < dim; i++)
79 vd.template getProp<0>(key)[i] = 0.51234 + vd.getPos(key)[0] + vd.getPos(key)[1]+ vd.getPos(key)[2];
85 vd.save(
"vector_dist" + std::to_string(create_vcluster().size()) +
".h5");
89 vd2.load(
"vector_dist" + std::to_string(create_vcluster().size()) +
".h5");
93 auto it3 = vd.getDomainIterator();
95 BOOST_REQUIRE_EQUAL(vd.size_local(),vd2.size_local());
107 check &= (vd.template getProp<0>(p)[0] == vd2.template getProp<0>(p)[0]);
108 check &= (vd.template getProp<0>(p)[1] == vd2.template getProp<0>(p)[1]);
109 check &= (vd.template getProp<0>(p)[2] == vd2.template getProp<0>(p)[2]);
114 BOOST_REQUIRE_EQUAL(check,
true);
119BOOST_AUTO_TEST_CASE( vector_dist_hdf5_load_test )
127 for (
size_t i = 0; i < dim; i++)
136 for (
size_t i = 0; i < dim; i++)
137 bc[i] = NON_PERIODIC;
140 const size_t Ng = 32;
148 vd.load(
"test_data/vector_dist_24.h5");
153 size_t n_part = vd.size_local();
157 BOOST_REQUIRE_EQUAL(n_part,Ng*Ng*Ng);
161 auto it2 = vd.getDomainIterator();
165 auto key = it2.get();
168 for (
size_t i = 0; i < dim; i++)
169 BOOST_REQUIRE_EQUAL(vd.template getProp<0>(key)[i],(
float)(0.51234 + vd.getPos(key)[0] + vd.getPos(key)[1]+ vd.getPos(key)[2]));
177BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
This class implement the point shape in an N-dimensional space.
void execute()
Execute all the requests.
void sum(T &num)
Sum the numbers across all processors and get the result.
Implementation of VCluster class.