11#include <unordered_map>
29template <
class Particle_T>
39template <
class Particle_T>
41 std::vector<std::vector<std::vector<std::pair<Particle_T *, std::vector<Particle_T *>>>>>;
100std::vector<BaseStepOffsets>
buildBaseStep(
const std::array<int, 3> &cellsPerDim,
const TraversalOption traversal);
112size_t estimateListLength(
size_t numParticles,
const std::array<double, 3> &boxSize,
double interactionLength,
113 double correctionFactor);
126template <
class Cells>
128 const std::vector<BaseStepOffsets> &offsetsC08,
const std::array<size_t, 3> cellsPerDim) {
131 std::unordered_map<int, double> offsetFactors{};
132 std::unordered_map<int, double> offsetFactorsNoN3{};
133 for (
const auto [offsetA, offsetB, factor] : offsetsC08) {
134 offsetFactors[offsetA] = std::max(offsetFactors[offsetA], factor);
135 offsetFactorsNoN3[offsetB] = std::max(offsetFactors[offsetB], factor);
139 for (
const auto &[offset, factor] : offsetFactors) {
141 if (otherCellCoords[0] < cellsPerDim[0] and otherCellCoords[1] < cellsPerDim[1] and
142 otherCellCoords[2] < cellsPerDim[2]) {
143 estimate += cells[baseCellIndex + offset].size() * factor;
147 if (not useNewton3) {
148 for (
const auto &[offset, factor] : offsetFactorsNoN3) {
150 if (otherCellCoords[0] < cellsPerDim[0] and otherCellCoords[1] < cellsPerDim[1] and
151 otherCellCoords[2] < cellsPerDim[2]) {
152 estimate += cells[baseCellIndex + offset].size() * factor;
Helper functions and type aliases for verlet lists cells.
Definition: VerletListsCellsHelpers.cpp:14
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:30
VLCBuildType
Indicates which build functor should be used for the generation of the neighbor list.
Definition: VerletListsCellsHelpers.h:47
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:41
size_t estimateNumLists(size_t baseCellIndex, bool useNewton3, const Cells &cells, const std::vector< BaseStepOffsets > &offsetsC08, const std::array< size_t, 3 > cellsPerDim)
Function to estimate the number of neighbor lists for one base step.
Definition: VerletListsCellsHelpers.h:127
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
std::vector< BaseStepOffsets > buildBaseStep(const std::array< int, 3 > &cellsPerDim, const TraversalOption traversal)
Builds the list of offsets from the base cell for the c01, c08, and c18 base step.
Definition: VerletListsCellsHelpers.cpp:26
constexpr std::array< T, 3 > oneToThreeD(T ind, const std::array< T, 3 > &dims)
Convert a 1d index to a 3d index.
Definition: ThreeDimensionalMapping.h:55
Helper Struct to bundle all information about base step offsets.
Definition: VerletListsCellsHelpers.h:55
bool operator!=(const BaseStepOffsets &rhs) const
Inequality operator.
Definition: VerletListsCellsHelpers.cpp:156
int offset1
Offset from the base cell for cell 1.
Definition: VerletListsCellsHelpers.h:59
int offset2
Offset from the base cell for cell 2.
Definition: VerletListsCellsHelpers.h:63
double listSizeEstimateFactor
Estimation factor on the fraction of particles that will end up needing a neighbor list in the base c...
Definition: VerletListsCellsHelpers.h:67
bool operator==(const BaseStepOffsets &rhs) const
Equality operator.
Definition: VerletListsCellsHelpers.cpp:152