Version: SMASH-1.5
smash::GridBase Class Reference

#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.

Inheritance diagram for smash::GridBase:
[legend]

Public Types

typedef int SizeType
 A type to store the sizes. More...
 

Static Protected Member Functions

static std::pair< std::array< double, 3 >, std::array< double, 3 > > find_min_and_length (const Particles &particles)
 

Member Typedef Documentation

◆ SizeType

A type to store the sizes.

Definition at line 53 of file grid.h.

Member Function Documentation

◆ 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
[in]particlesParticles in the system

Definition at line 71 of file grid.cc.

71  {
72  std::pair<std::array<double, 3>, std::array<double, 3>> r;
73  auto &min_position = r.first;
74  auto &length = r.second;
75 
76  // intialize min and max position arrays with the position of the first
77  // particle in the list
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]);
89  }
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];
93  return r;
94 }
constexpr int p
Proton.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: