Version: SMASH-3.1
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 67 of file grid.h.

Inheritance diagram for smash::GridBase:
smash::Grid< GridOptions::PeriodicBoundaries > smash::Grid< Options >

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 70 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 87 of file grid.cc.

87  {
88  std::pair<std::array<double, 3>, std::array<double, 3>> r;
89  auto &min_position = r.first;
90  auto &length = r.second;
91 
92  // intialize min and max position arrays with the position of the first
93  // particle in the list
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]);
105  }
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];
109  return r;
110 }
constexpr int p
Proton.

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