OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
util_num_unit_tests.hpp
1 /*
2  * util_num_unit_tests.hpp
3  *
4  * Created on: Oct 23, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_NUMERICS_SRC_UTIL_UTIL_NUM_UNIT_TESTS_HPP_
9 #define OPENFPM_NUMERICS_SRC_UTIL_UTIL_NUM_UNIT_TESTS_HPP_
10 
11 #include "util_num.hpp"
12 
14 
17 {
19  typedef void const_field;
20 
22  float val() {return 1.0;}
23 };
24 
27 {
29  typedef void const_field;
30 
32  typedef void with_position;
33 
35  float val_pos(grid_key_dx<2> & pos) {return 1.0;}
36 };
37 
39 struct no_field
40 {
41 };
42 
44 
46 
48 struct on_test
49 {
51  typedef void testing;
52 };
53 
56 {
57 };
58 
60 
61 BOOST_AUTO_TEST_SUITE( util_num_suite )
62 
63 BOOST_AUTO_TEST_CASE( util_num )
64 {
66 
68  BOOST_REQUIRE_EQUAL(ret,true);
69 
71  BOOST_REQUIRE_EQUAL(ret,false);
72 
74 
76 
78  BOOST_REQUIRE_EQUAL(ret,true);
79 
81  BOOST_REQUIRE_EQUAL(ret,false);
82 
84 
86 
88  BOOST_REQUIRE_EQUAL(ret,true);
89 
91  BOOST_REQUIRE_EQUAL(ret,false);
92 
94 
96 
97  ret = std::is_same<stub_or_real<on_test,2,float,CartDecomposition<2,float>>::type, grid_dist_testing<2>>::value ;
98  BOOST_REQUIRE_EQUAL(ret,true);
99 
100  ret = std::is_same<stub_or_real<not_on_test,2,float,CartDecomposition<2,float>>::type, grid_dist_id<2,float,aggregate<size_t>,CartDecomposition<2,float>> >::value;
101  BOOST_REQUIRE_EQUAL(ret,true);
102 
104 }
105 
106 BOOST_AUTO_TEST_SUITE_END()
107 
108 #endif /* OPENFPM_NUMERICS_SRC_UTIL_UTIL_NUM_UNIT_TESTS_HPP_ */
float val_pos(grid_key_dx< 2 > &pos)
Evaluate the field in one point.
Not on testing mode.
grid_key_dx is the key to access any element in the grid
Definition: grid_key.hpp:18
[Constant fields struct definition]
void const_field
It define that is a constant field.
stub field
[Constant fields struct definition]
float val()
Evaluate the constant field (in this case always return 1.0)
void testing
specify testing mode
This class decompose a space into sub-sub-domains and distribute them across processors.
This is a distributed grid.
void with_position
It define that is not constant in space.
void const_field
define that is a constant field
define a non-constant (in space) field