forked from Mantevo/miniFE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.hpp
More file actions
22 lines (19 loc) · 658 Bytes
/
Copy pathBox.hpp
File metadata and controls
22 lines (19 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef _Box_hpp_
#define _Box_hpp_
/**
* a 'Box' is 3 pairs of ints, where each pair specifies a lower
* and upper bound for one of the 3 spatial dimensions.
*
* This struct stores the 3 pairs as a simple array of 6 ints,
* but defines the bracket operator so that it can be referenced
* using 2-dimensional array notation like this:
* int xmin = box[0][0]; int xmax = box[0][1];
* int ymin = box[1][0]; int ymax = box[1][1];
* int zmin = box[2][0]; int zmax = box[2][1];
*/
struct Box {
int ranges[6];
int* operator[](int xyz) { return &ranges[xyz*2]; }
const int* operator[](int xyz) const { return &ranges[xyz*2]; }
};
#endif