The Grid class¶
-
class Grid¶
A 3D grid class to handle input independent functionality.
Public Types
-
enum index_type¶
The indexing type required for an
Grid::index
function call.Values:
-
enumerator padded¶
-
enumerator real¶
-
enumerator complex_herm¶
-
enumerator padded¶
Public Functions
-
Grid(const std::array<int32_t, 3> n_cell_, const std::array<double, 3> box_size_)¶
Basic constructor. This will allocate the grid array, and store the corresponding size in various forms.
- Parameters
n_cell_ – The number of logical cells in each dimension
box_size_ – The size of the simulation volume in input units
-
~Grid(void)¶
Basic desctructor. This will free the fftw plans created during initialisation.
-
void update_properties(const std::array<int32_t, 3> n_cell_)¶
Update the “size” of the grid for a new logical size. Note that this does not alter the size of the memory allocation, just what this allocation represents.
- Parameters
n_cell_ – The new number of logical cells in each dimension
-
float *get()¶
Return the pointer to the grid data.
- Returns
Float pointer to the grid data.
-
std::complex<float> *get_complex()¶
Return the pointer to the grid data, cast as a complex array.
- Returns
Complex pointer to the grid data
-
int index(const int i, const int j, const int k, const index_type type, const std::array<int, 3> shape)¶
Indexing function for arbitrary grid of any 3D size.
- Parameters
i – Index in 1st dimension
j – Index in second dimension
k – Index in third dimension
shape – Shape of the 3D array
- Returns
The index
-
int index(const int i, const int j, const int k, const index_type type)¶
Indexing function for the current grid.
- Parameters
i – Index in 1st dimension
j – Index in second dimension
k – Index in third dimension
- Returns
The index
-
void real_to_padded_order(void)¶
Convert the grid from logical memory ordering to padded ordering.
-
void padded_to_real_order(void)¶
Convert the grid from padded memory ordering to logical ordering.
-
void forward_fft(void)¶
Do the forward FFT
-
void reverse_fft(void)¶
Do the reverse FFT
-
void filter(filter_type type, const double R)¶
Filter the grid using a given filter type and size.
- Parameters
type – The filter type to use
R – the size (typically radius) of the filter
-
enum index_type¶