#include <grid.h>
Base class for Grid to host common functions that do not depend on the GridOptions parameter.
Definition at line 67 of file grid.h.
◆ SizeType
A type to store the sizes.
Definition at line 70 of file grid.h.
◆ find_min_and_length()
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 87 of file grid.cc.
88 std::pair<std::array<double, 3>, std::array<double, 3>> r;
89 auto &min_position = r.first;
90 auto &length = r.second;
94 const auto &first_position = particles.front().position();
95 min_position = {{first_position[1], first_position[2], first_position[3]}};
96 auto max_position = min_position;
97 for (
const auto &
p : particles) {
98 const auto &pos =
p.position();
99 min_position[0] = std::min(min_position[0], pos[1]);
100 min_position[1] = std::min(min_position[1], pos[2]);
101 min_position[2] = std::min(min_position[2], pos[3]);
102 max_position[0] = std::max(max_position[0], pos[1]);
103 max_position[1] = std::max(max_position[1], pos[2]);
104 max_position[2] = std::max(max_position[2], pos[3]);
106 length[0] = max_position[0] - min_position[0];
107 length[1] = max_position[1] - min_position[1];
108 length[2] = max_position[2] - min_position[2];
The documentation for this class was generated from the following files: