11#include <unordered_map>
26template <
class Particle_T>
36template <
class Particle_T>
38 std::vector<std::vector<std::vector<std::pair<Particle_T *, std::vector<Particle_T *>>>>>;
96std::vector<BaseStepOffsets>
buildC08BaseStep(
const std::array<int, 3> &cellsPerDim);
108size_t estimateListLength(
size_t numParticles,
const std::array<double, 3> &boxSize,
double interactionLength,
109 double correctionFactor);
121template <
class Cells>
123 const std::vector<BaseStepOffsets> &offsetsC08) {
126 std::unordered_map<int, double> offsetFactors{};
127 std::unordered_map<int, double> offsetFactorsNoN3{};
128 for (
const auto [offsetA, offsetB, factor] : offsetsC08) {
129 offsetFactors[offsetA] = std::max(offsetFactors[offsetA], factor);
130 offsetFactorsNoN3[offsetB] = std::max(offsetFactors[offsetB], factor);
134 for (
const auto &[offset, factor] : offsetFactors) {
135 estimate += cells[baseCellIndex + offset].size() * factor;
138 if (not useNewton3) {
139 for (
const auto &[offset, factor] : offsetFactorsNoN3) {
140 estimate += cells[baseCellIndex + offset].size() * factor;
Helper functions and type aliases for verlet lists cells.
Definition: VerletListsCellsHelpers.cpp:14
size_t estimateNumLists(size_t baseCellIndex, bool useNewton3, const Cells &cells, const std::vector< BaseStepOffsets > &offsetsC08)
Function to estimate the number of neighbor lists for one base step.
Definition: VerletListsCellsHelpers.h:122
std::vector< std::vector< std::pair< Particle_T *, std::vector< Particle_T * > > > > AllCellsNeighborListsType
Cell wise verlet lists for neighbors from all adjacent cells: For every cell, a vector of pairs.
Definition: VerletListsCellsHelpers.h:27
std::vector< BaseStepOffsets > buildC08BaseStep(const std::array< int, 3 > &cellsPerDim)
Builds the list of offsets from the base cell for the c08 base step.
Definition: VerletListsCellsHelpers.cpp:26
VLCBuildType
Indicates which build functor should be used for the generation of the neighbor list.
Definition: VerletListsCellsHelpers.h:44
std::vector< std::vector< std::vector< std::pair< Particle_T *, std::vector< Particle_T * > > > > > PairwiseNeighborListsType
Pairwise verlet lists: For every cell a vector, for every neighboring cell a vector of particle-neigh...
Definition: VerletListsCellsHelpers.h:38
size_t estimateListLength(size_t numParticles, const std::array< double, 3 > &boxSize, double interactionLength, double correctionFactor)
Simple heuristic to calculate the average number of particles per verlet list assuming particles are ...
Definition: VerletListsCellsHelpers.cpp:16
Helper Struct to bundle all information about base step offsets.
Definition: VerletListsCellsHelpers.h:52
bool operator!=(const BaseStepOffsets &rhs) const
Inequality operator.
Definition: VerletListsCellsHelpers.cpp:93
int offset1
Offset from the base cell for cell 1.
Definition: VerletListsCellsHelpers.h:56
int offset2
Offset from the base cell for cell 2.
Definition: VerletListsCellsHelpers.h:60
double listSizeEstimateFactor
Estimation factor on the fraction of particles that will end up needing a neighbor list in the base c...
Definition: VerletListsCellsHelpers.h:64
bool operator==(const BaseStepOffsets &rhs) const
Equality operator.
Definition: VerletListsCellsHelpers.cpp:89