#include <grid.h>
Base class for Grid to host common functions that do not depend on the GridOptions parameter.
Definition at line 50 of file grid.h.
A type to store the sizes.
Definition at line 53 of file grid.h.
std::pair< std::array< double, 3 >, std::array< double, 3 > > smash::GridBase::find_min_and_length |
( |
const Particles & |
particles | ) |
|
|
staticprotected |
- Returns
- the minimum x,y,z coordinates and the largest dx,dy,dz distances of the particles in
particles
.
- Parameters
-
Definition at line 71 of file grid.cc.
72 std::pair<std::array<double, 3>, std::array<double, 3>> r;
73 auto &min_position = r.first;
74 auto &length = r.second;
78 const auto &first_position = particles.front().position();
79 min_position = {{first_position[1], first_position[2], first_position[3]}};
80 auto max_position = min_position;
81 for (
const auto &
p : particles) {
82 const auto &pos =
p.position();
83 min_position[0] = std::min(min_position[0], pos[1]);
84 min_position[1] = std::min(min_position[1], pos[2]);
85 min_position[2] = std::min(min_position[2], pos[3]);
86 max_position[0] = std::max(max_position[0], pos[1]);
87 max_position[1] = std::max(max_position[1], pos[2]);
88 max_position[2] = std::max(max_position[2], pos[3]);
90 length[0] = max_position[0] - min_position[0];
91 length[1] = max_position[1] - min_position[1];
92 length[2] = max_position[2] - min_position[2];
The documentation for this class was generated from the following files: