OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
se_grid.hpp
1 /*
2  * se_grid.hpp
3  *
4  * Created on: Aug 13, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_GRID_SE_GRID_HPP_
9 #define SRC_GRID_SE_GRID_HPP_
10 
11 #include "util/se_util.hpp"
12 
17 #define GRID_ERROR 1000lu
18 
19 // Macro for security enhancement
20 /*#define CHECK_INIT() if (is_mem_init == false)\
21  {\
22  std::cerr << "Error " << __FILE__ << ":" << __LINE__ << " you must call SetMemory before access the grid\n";\
23  size_t * err_code_pointer = (size_t *)&this->err_code;\
24  *err_code_pointer = 1001;\
25  ACTION_ON_ERROR(GRID_ERROR);\
26  }
27 
28 #define GRID_OVERFLOW(v1) for (long int i = 0 ; i < dim ; i++)\
29  {\
30  if (v1.get(i) >= (long int)getGrid().size(i))\
31  {\
32  std::cerr << "Error " __FILE__ << ":" << __LINE__ <<" grid overflow " << "x=[" << i << "]=" << v1.get(i) << " >= " << getGrid().size(i) << "\n";\
33  size_t * err_code_pointer = (size_t *)&this->err_code;\
34  *err_code_pointer = 1002;\
35  ACTION_ON_ERROR(GRID_ERROR);\
36  }\
37  else if (v1.get(i) < 0)\
38  {\
39  std::cerr << "Error " __FILE__ << ":" << __LINE__ <<" grid overflow " << "x=[" << i << "]=" << v1.get(i) << " is negative " << "\n";\
40  size_t * err_code_pointer = (size_t *)&this->err_code;\
41  *err_code_pointer = 1003;\
42  ACTION_ON_ERROR(GRID_ERROR);\
43  }\
44  }
45 
46 #define GRID_OVERFLOW_EXT(g,key2) for (size_t i = 0 ; i < dim ; i++)\
47  {\
48  if (key2.get(i) >= (long int)g.g1.size(i))\
49  {\
50  std::cerr << "Error " __FILE__ << ":" << __LINE__ <<" grid overflow " << "x=[" << i << "]=" << key2.get(i) << " >= " << g.g1.size(i) << "\n";\
51  size_t * err_code_pointer = (size_t *)&this->err_code;\
52  *err_code_pointer = 1004;\
53  ACTION_ON_ERROR(GRID_ERROR);\
54  }\
55  else if (key2.get(i) < 0)\
56  {\
57  std::cerr << "Error " __FILE__ << ":" << __LINE__ <<" grid overflow " << "x=[" << i << "]=" << key2.get(i) << " is negative " << "\n";\
58  size_t * err_code_pointer = (size_t *)&this->err_code;\
59  *err_code_pointer = 1005;\
60  ACTION_ON_ERROR(GRID_ERROR);\
61  }\
62  }*/
63 
64 #endif /* SRC_GRID_SE_GRID_HPP_ */