10 #ifndef SRC_INCLUDE_SMASH_GRID_H_
11 #define SRC_INCLUDE_SMASH_GRID_H_
79 static std::pair<std::array<double, 3>, std::array<double, 3>>
95 template <Gr
idOptions Options = Gr
idOptions::Normal>
115 const bool include_unformed_particles =
false,
118 std::move(particles),
122 include_unformed_particles,
141 Grid(
const std::pair<std::array<double, 3>, std::array<double, 3>>
143 const Particles &particles,
double min_cell_length,
145 const bool include_unformed_particles =
false,
165 const std::function<
void(
const ParticleList &)> &search_cell_callback,
166 const std::function<
void(
const ParticleList &,
const ParticleList &)>
167 &neighbor_cell_callback)
const;
Base class for Grid to host common functions that do not depend on the GridOptions parameter.
int SizeType
A type to store the sizes.
static std::pair< std::array< double, 3 >, std::array< double, 3 > > find_min_and_length(const Particles &particles)
Abstracts a list of cells that partition the particles in the experiment into regions of space that c...
const std::array< double, 3 > length_
The 3 lengths of the complete grid. Used for periodic boundary wrapping.
std::array< int, 3 > number_of_cells_
The number of cells in x, y, and z direction.
double cell_volume() const
double cell_volume_
The volume of a single cell.
std::vector< ParticleList > cells_
The cell storage.
SizeType make_index(std::array< SizeType, 3 > idx) const
Grid(const Particles &particles, double min_cell_length, double timestep_duration, CellNumberLimitation limit, const bool include_unformed_particles=false, CellSizeStrategy strategy=CellSizeStrategy::Optimal)
Constructs a grid from the given particle list particles.
void iterate_cells(const std::function< void(const ParticleList &)> &search_cell_callback, const std::function< void(const ParticleList &, const ParticleList &)> &neighbor_cell_callback) const
Iterates over all cells in the grid and calls the callback arguments with a search cell and 0 to 13 n...
SizeType make_index(SizeType x, SizeType y, SizeType z) const
The Particles class abstracts the storage and manipulation of particles.
CellNumberLimitation
Identifies whether the number of cells should be limited.
@ ParticleNumber
Limit the number of cells to the number of particles.
@ None
No cell number limitation.
GridOptions
Identifies the mode of the Grid.
@ Normal
Without ghost cells.
@ PeriodicBoundaries
With ghost cells for periodic boundaries.
CellSizeStrategy
Indentifies the strategy of determining the cell size.
@ Optimal
Look for optimal cell size.
@ Largest
Make cells as large as possible.