#include <algorithm>#include <array>#include <cmath>#include <random>#include <vector>#include "autopas/particles/OwnershipState.h"#include "autopas/utils/ExceptionHandler.h"

Go to the source code of this file.
Functions | |
| template<class Container_T , class Particle_T > | |
| void | autopasTools::generators::TwoCellsInteractionHitrateGenerator::fillWithParticles (Container_T &cell1, Container_T &cell2, const std::array< double, 3 > &boxMin1, const std::array< double, 3 > &boxMax1, const std::array< double, 3 > &boxMin2, const std::array< double, 3 > &boxMax2, std::size_t n, double hitrate, double cutoff, const Particle_T &defaultParticle=Particle_T{}, unsigned int seed=42) |
| Fills two cells adjacent in x with n particles each such that exactly round(n * hitrate) particles per cell have a guaranteed in-range partner in the other cell (3D distance < cutoff), and the remaining particles are placed far enough that no cross-cell interaction is possible. | |
| void autopasTools::generators::TwoCellsInteractionHitrateGenerator::fillWithParticles | ( | Container_T & | cell1, |
| Container_T & | cell2, | ||
| const std::array< double, 3 > & | boxMin1, | ||
| const std::array< double, 3 > & | boxMax1, | ||
| const std::array< double, 3 > & | boxMin2, | ||
| const std::array< double, 3 > & | boxMax2, | ||
| std::size_t | n, | ||
| double | hitrate, | ||
| double | cutoff, | ||
| const Particle_T & | defaultParticle = Particle_T{}, |
||
| unsigned int | seed = 42 |
||
| ) |
Fills two cells adjacent in x with n particles each such that exactly round(n * hitrate) particles per cell have a guaranteed in-range partner in the other cell (3D distance < cutoff), and the remaining particles are placed far enough that no cross-cell interaction is possible.
Preconditions (checked via ExceptionHandler):
Particle IDs are assigned sequentially starting from defaultParticle.getID(): cell1 particles: [id0, id0 + n) cell2 particles: [id0 + n, id0 + 2n)
Interaction guarantees:
| Container_T | Any container supporting addParticle(). |
| Particle_T | Particle type; must support setR(), setID(), setOwnershipState(), and getID(). |
| cell1 | First cell (x < boundary). |
| cell2 | Second cell (x >= boundary). |
| boxMin1 | Minimum coordinates of cell1. |
| boxMax1 | Maximum coordinates of cell1. boxMax1[0] must equal boxMin2[0]. |
| boxMin2 | Minimum coordinates of cell2. boxMin2[0] must equal boxMax1[0]. |
| boxMax2 | Maximum coordinates of cell2. |
| n | Number of particles per cell. |
| hitrate | Fraction of particles per cell with a guaranteed in-range cross-cell partner. Must be in [0, 1]. |
| cutoff | Interaction cutoff radius. |
| defaultParticle | Template particle; IDs are assigned sequentially starting from defaultParticle.getID(). |
| seed | Random seed for reproducibility. |