STORMM Source Documentation
Loading...
Searching...
No Matches
hilbert_sfc.h
1// -*-c++-*-
2#ifndef STORMM_HILBERT_SFC_H
3#define STORMM_HILBERT_SFC_H
4
5#include <vector>
6#include "copyright.h"
7#include "Constants/behavior.h"
8#include "DataTypes/stormm_vector_types.h"
9#include "math_enumerators.h"
10
11namespace stormm {
12namespace stmath {
13
14using constants::CartesianDimension;
15using constants::UnitCellAxis;
16
19const int3 hilbert_cube_hll[] = { { 0, 0, 0 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 0, 1 },
20 { 1, 0, 1 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 0, 0 } };
21
24const int3 hilbert_cube_hhh[] = { { 0, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 }, { 1, 0, 0 },
25 { 1, 0, 1 }, { 0, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 } };
26
30const int3 hilbert_square_hl[] = { { 0, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 }, { 1, 0, 0 } };
31const int3 peano_square[] = { { 0, 0, 0 }, { 0, 1, 0 }, { 0, 2, 0 },
32 { 1, 2, 0 }, { 1, 1, 0 }, { 1, 0, 0 },
33 { 2, 0, 0 }, { 2, 1, 0 }, { 2, 2, 0 } };
34const int3 hileano_square[] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 },
35 { 0, 1, 0 }, { 0, 2, 0 }, { 1, 2, 0 },
36 { 2, 2, 0 }, { 2, 1, 0 }, { 2, 0, 0 } };
37
39
42public:
43
47 HilbertSFC(int x_span_in, int y_span_in, int z_span_in,
48 HilbertCurveMode method = HilbertCurveMode::OVERSPAN);
49
51 int3 getDimensions() const;
52
61 int getDimension(CartesianDimension dim) const;
62
63 int getDimension(UnitCellAxis dim) const;
65
73 int getCurveIndex(int grid_x, int grid_y, int grid_z) const;
74
77 const std::vector<int3>& getCurve() const;
78
79private:
80
81 int x_span;
82 int y_span;
83 int z_span;
84 std::vector<int3> curve;
87 std::vector<int> curve_indices;
92};
93
111void propagateHilbertCurve(int s, std::vector<int3> *curve, int x = 0, int y = 0, int z = 0,
112 int dx = 1, int dy = 0, int dz = 0, int dx2 = 0, int dy2 = 1,
113 int dz2 = 0, int dx3 = 0, int dy3 = 0, int dz3 = 1);
114
119std::vector<int3> drawHilbertSpaceCurve(int order);
120
121
122} // namespace stmath
123} // namespace stormm
124
125#endif
int getCurveIndex(int grid_x, int grid_y, int grid_z) const
Get the curve index to which a particular grid element corresponds. The grid begins at (0,...
Definition hilbert_sfc.cpp:81
const std::vector< int3 > & getCurve() const
Get the Hilbert space filling curve, expressed in unitless integers with components for each Cartesia...
Definition hilbert_sfc.cpp:76
int getDimension(CartesianDimension dim) const
Get the dimension of the region filled by the curve along one axis.
Definition hilbert_sfc.cpp:50
int3 getDimensions() const
Get the dimensions of the region filled by the curve.
Definition hilbert_sfc.cpp:45
HilbertSFC(int x_span_in, int y_span_in, int z_span_in, HilbertCurveMode method=HilbertCurveMode::OVERSPAN)
The constructor takes as inputs a trio of integers indicating the overall unitless dimensions of the ...
Definition hilbert_sfc.cpp:13
Definition stormm_vector_types.h:27