forked from hxmhuang/OpenArray_Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrid.hpp
More file actions
52 lines (39 loc) · 1.1 KB
/
Copy pathGrid.hpp
File metadata and controls
52 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Grid.hpp
* currently, OpenArray only support C grid
*
=======================================================*/
#ifndef __GRID_HPP__
#define __GRID_HPP__
#include "Array.hpp"
#include <unordered_map>
class Grid {
private:
char grid_type;
// grid map
std::unordered_map<int, ArrayPtr> x_d;
std::unordered_map<int, ArrayPtr> y_d;
std::unordered_map<int, ArrayPtr> z_d;
//
vector<int> x_map;
vector<int> y_map;
vector<int> z_map;
public:
// dx, dy, dz are two dimensional arrays
void init_grid(char type, const ArrayPtr& dx,
const ArrayPtr& dy, const ArrayPtr& dz);
// get x/y/z dimension grid based on grid position
ArrayPtr get_grid_dx(int pos);
ArrayPtr get_grid_dy(int pos);
ArrayPtr get_grid_dz(int pos);
// get grid based on grid position and Operator type
ArrayPtr get_grid(int pos, NodeType t);
// get grid position based on grid position and Operator type
int get_pos(int pos, NodeType t);
int get_pos_x(int pos);
int get_pos_y(int pos);
int get_pos_z(int pos);
static Grid* global();
};
typedef std::shared_ptr<Grid> GridPtr;
#endif