OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
Kernels_unit_tests.hpp
1 /*
2  * Kernels_unit_tests.hpp
3  *
4  * Created on: Feb 17, 2016
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_NUMERICS_SRC_PSE_KERNELS_UNIT_TESTS_HPP_
9 #define OPENFPM_NUMERICS_SRC_PSE_KERNELS_UNIT_TESTS_HPP_
10 
11 #include "PSE/Kernels_test_util.hpp"
12 #ifdef HAVE_LIBQUADMATH
13 #include <boost/multiprecision/float128.hpp>
14 #endif
15 
16 BOOST_AUTO_TEST_SUITE( pse_kernels_unit_tests )
17 
18 /*
19 BOOST_AUTO_TEST_CASE( pse_ker )
20 {
21  Vcluster<> & v_cl = create_vcluster();
22 
23  // This test is not made to run in parallel
24  if (v_cl.getProcessingUnits() > 1)
25  return;
26 
27  openfpm::vector<openfpm::vector<double>> y;
28  openfpm::vector<openfpm::vector<double>> y_res;
29 
30  // Load the result of the test
31 
32 #ifdef HAVE_LIBQUADMATH
33  y_res.load("test/PSE_convergence");
34 #else
35  y_res.load("test/PSE_convergence_osx");
36 #endif
37 
38  // Every time increase the number of particles by 2
39  for (size_t i = 250 ; i <= 2097152000 ; i*=2)
40  {
41  y.add();
42 
43  PSEError err;
44 
46 
47 #ifdef HAVE_LIBQUADMATH
48 
49  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,2>>(i,2,err);
50  y.last().add(err.linf_error);
51 
52  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,2>>(i,4,err);
53  y.last().add(err.linf_error);
54 #endif
55 
56  PSE_test<double,Lap_PSE<1,double,2>>(i,2,err);
57  y.last().add(err.linf_error);
58 
59  PSE_test<double,Lap_PSE<1,double,2>>(i,4,err);
60  y.last().add(err.linf_error);
61 
62  PSE_test<float,Lap_PSE<1,float,2>>(i,2,err);
63  y.last().add(err.linf_error);
64 
65  PSE_test<float,Lap_PSE<1,float,2>>(i,4,err);
66  y.last().add(err.linf_error);
67 
69 
70 #ifdef HAVE_LIBQUADMATH
71 
72  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,4>>(i,2,err);
73  y.last().add(err.linf_error);
74 
75  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,4>>(i,4,err);
76  y.last().add(err.linf_error);
77 
79 
80 
81  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,6>>(i,2,err);
82  y.last().add(err.linf_error);
83 
84  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,6>>(i,4,err);
85  y.last().add(err.linf_error);
86 
87 
89 
90 
91  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,8>>(i,8,err);
92  y.last().add(err.linf_error);
93 
94  PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,8>>(i,16,err);
95  y.last().add(err.linf_error);
96 
97 #endif
98  }
99 
100  // Check the result
101  for (size_t i = 0 ; i < y.size(); i++)
102  {
103  for (size_t j = 0 ; j < y.get(i).size(); j++)
104  {
105  double c1 = y.get(i).get(j);
106  double c2 = y_res.get(i).get(j);
107 
108 #ifdef HAVE_LIBQUADMATH
109 
110  // In divergent mode the system is too sensitive
111  // to compiler/hardware differences disable them
112  if (j != 4 && j != 5)
113  {BOOST_REQUIRE_CLOSE(c1,c2,3.0);}
114 
115 #else
116 
117  // In divergent mode the system is too sensitive
118  // to compiler/hardware differences disable them
119  if (j != 2 && j != 3)
120  {BOOST_REQUIRE_CLOSE(c1,c2,3.0);}
121 
122 #endif
123  }
124  }
125 }
126 */
127 
128 BOOST_AUTO_TEST_SUITE_END()
129 
130 #endif /* OPENFPM_NUMERICS_SRC_PSE_KERNELS_UNIT_TESTS_HPP_ */