18template <
class ParticleCell,
class PairwiseFunctor>
29 const std::array<double, 3> &cellLength)
30 : _cellPairOffsets{LCC08CellHandlerUtility::computePairwiseCellOffsetsC08<
31 LCC08CellHandlerUtility::C08OffsetMode::c08CellPairs>(dims, cellLength, interactionLength)},
45 unsigned long cellIndex,
PairwiseFunctor *pairwiseFunctor, DataLayoutOption layout,
47 using namespace utils::ArrayMath::literals;
52 auto relIdx = [&](
auto cellIndex1,
auto cellIndex2) {
55 const auto offset = threeDPosCell2 - threeDPosCell1;
56 return (offset[0] + 1) * 9 + (offset[1] + 1) * 3 + (offset[2] + 1);
60 for (
const auto &[offsetA, offsetB] : this->_cellPairOffsets) {
64 const auto offsetCellA = cellIndex + offsetA;
65 const auto offsetCellB = cellIndex + offsetB;
66 const auto [offsetCell1, offsetCell2] = std::minmax(offsetCellA, offsetCellB);
68 const auto cell2Local = relIdx(offsetCell1, offsetCell2);
71 if (layout == DataLayoutOption::aos) {
73 const auto ¤tList = aosNeighborList[offsetCell1][cell2Local];
74 for (
auto &[particleBasePtr, particleList] : currentList) {
75 for (
auto *particlePartnerPtr : particleList) {
76 pairwiseFunctor->
AoSFunctor(*particleBasePtr, *particlePartnerPtr, useNewton3);
82 else if (layout == DataLayoutOption::soa) {
84 const auto ¤tList = soaNeighborList[offsetCell1][cell2Local];
85 for (
const auto &[particleIndex, particleList] : currentList) {
86 if (not particleList.empty()) {
87 pairwiseFunctor->
SoAFunctorVerlet(*soa, particleIndex, particleList, useNewton3);
95 const auto cell2LocalNoN3 = relIdx(offsetCell2, offsetCell1);
97 if (offsetCell1 != offsetCell2) {
99 if (layout == DataLayoutOption::aos) {
101 const auto ¤tList = aosNeighborList[offsetCell2][cell2LocalNoN3];
102 for (
auto &[particleBasePtr, particleList] : currentList) {
103 for (
auto *particlePartnerPtr : particleList) {
104 pairwiseFunctor->
AoSFunctor(*particleBasePtr, *particlePartnerPtr, useNewton3);
110 else if (layout == DataLayoutOption::soa) {
112 const auto ¤tList = soaNeighborList[offsetCell2][cell2LocalNoN3];
113 for (
const auto &[particleIndex, particleList] : currentList) {
114 if (not particleList.empty()) {
115 pairwiseFunctor->
SoAFunctorVerlet(*soa, particleIndex, particleList, useNewton3);
128 std::vector<LCC08CellHandlerUtility::OffsetPair> _cellPairOffsets;
130 std::array<unsigned long, 3> _dims;
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3)
PairwiseFunctor for arrays of structures (AoS).
Definition: PairwiseFunctor.h:56
virtual void SoAFunctorVerlet(SoAView< SoAArraysType > soa, const size_t indexFirst, const std::vector< size_t, AlignedAllocator< size_t > > &neighborList, bool newton3)
PairwiseFunctor for structure of arrays (SoA) for neighbor lists.
Definition: PairwiseFunctor.h:86
Structur of the array class.
Definition: SoA.h:28
This class provides the base logic for the c08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08CellHandler.h:19
void processCellListsC08(VLCCellPairNeighborList< typename ParticleCell::ParticleType > &neighborList, unsigned long cellIndex, PairwiseFunctor *pairwiseFunctor, DataLayoutOption layout, SoA< typename ParticleCell::ParticleType::SoAArraysType > *soa, bool useNewton3)
Executes a c08 base step for the cell at cellIndex.
Definition: VLCCellPairC08CellHandler.h:44
VLCCellPairC08CellHandler(const std::array< unsigned long, 3 > &dims, double interactionLength, const std::array< double, 3 > &cellLength)
Constructor of the VLCCellPairC08CellHandler.
Definition: VLCCellPairC08CellHandler.h:28
Neighbor list to be used with VerletListsCells container.
Definition: VLCCellPairNeighborList.h:23
auto & getSoANeighborList()
Returns the neighbor list in SoA layout.
Definition: VLCCellPairNeighborList.h:81
VerletListsCellsHelpers::PairwiseNeighborListsType< Particle_T > & getAoSNeighborList()
Returns the neighbor list in AoS layout.
Definition: VLCCellPairNeighborList.h:73
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
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32