#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 72 of file grid.cc.
73 std::pair<std::array<double, 3>, std::array<double, 3>> r;
74 auto &min_position = r.first;
75 auto &length = r.second;
79 const auto &first_position = particles.front().position();
80 min_position = {{first_position[1], first_position[2], first_position[3]}};
81 auto max_position = min_position;
82 for (
const auto &
p : particles) {
83 const auto &pos =
p.position();
84 min_position[0] = std::min(min_position[0], pos[1]);
85 min_position[1] = std::min(min_position[1], pos[2]);
86 min_position[2] = std::min(min_position[2], pos[3]);
87 max_position[0] = std::max(max_position[0], pos[1]);
88 max_position[1] = std::max(max_position[1], pos[2]);
89 max_position[2] = std::max(max_position[2], pos[3]);
91 length[0] = max_position[0] - min_position[0];
92 length[1] = max_position[1] - min_position[1];
93 length[2] = max_position[2] - min_position[2];
The documentation for this class was generated from the following files: