26template <
class ParticleCell_T,
class Functor_T>
41 explicit LCC08CellHandler(Functor_T &functor,
const std::array<unsigned long, 3> &cellsPerDimension,
42 double interactionLength,
const std::array<double, 3> &cellLength,
43 const std::array<unsigned long, 3> &overlap, DataLayoutOption dataLayout,
bool useNewton3)
47 _cellFunctor(functor, interactionLength ,
48 dataLayout, useNewton3),
49 _interactionLength(interactionLength),
50 _cellLength(cellLength) {
53 LCC08CellHandlerUtility::computePairwiseCellOffsetsC08<LCC08CellHandlerUtility::C08OffsetMode::sorting>(
54 cellsPerDimension, cellLength, interactionLength);
57 LCC08CellHandlerUtility::computeTriwiseCellOffsetsC08<LCC08CellHandlerUtility::C08OffsetMode::sorting>(
58 cellsPerDimension, cellLength, interactionLength);
70 void processBaseCell(std::vector<ParticleCell_T> &cells,
unsigned long baseIndex);
87 void setAoSSortingThreshold(
size_t aosSortingThreshold) { _cellFunctor.setAoSSortingThreshold(aosSortingThreshold); }
91 void setSoASortingThreshold(
size_t soaSortingThreshold) { _cellFunctor.setSoASortingThreshold(soaSortingThreshold); }
98 std::conditional_t<decltype(utils::isPairwiseFunctor<Functor_T>())::value,
124 using CellFunctorType =
125 std::conditional_t<decltype(utils::isPairwiseFunctor<Functor_T>())::value,
132 CellFunctorType _cellFunctor;
137 const double _interactionLength;
142 const std::array<double, 3> _cellLength;
145template <
class ParticleCell_T,
class Functor_T>
147 unsigned long baseIndex) {
149 processBaseCellPairwise(cells, baseIndex);
151 processBaseCellTriwise(cells, baseIndex);
154 "LCC08CellHandler::processBaseCell(): Given Functor type is not of type PairwiseFunctor or TriwiseFunctor.");
158template <
class ParticleCell_T,
class Functor_T>
160 unsigned long baseIndex) {
161 for (
auto const &[offset1, offset2, r] : _cellOffsets) {
162 const unsigned long cellIndex1 = baseIndex + offset1;
163 const unsigned long cellIndex2 = baseIndex + offset2;
165 ParticleCell_T &cell1 = cells[cellIndex1];
166 ParticleCell_T &cell2 = cells[cellIndex2];
168 if (cellIndex1 == cellIndex2) {
169 this->_cellFunctor.processCell(cell1);
171 this->_cellFunctor.processCellPair(cell1, cell2, r);
176template <
class ParticleCell_T,
class Functor_T>
178 unsigned long baseIndex) {
179 for (
auto const &[offset1, offset2, offset3, r] : _cellOffsets) {
180 const unsigned long index1 = baseIndex + offset1;
181 const unsigned long index2 = baseIndex + offset2;
182 const unsigned long index3 = baseIndex + offset3;
184 ParticleCell_T &cell1 = cells[index1];
185 ParticleCell_T &cell2 = cells[index2];
186 ParticleCell_T &cell3 = cells[index3];
188 if (index1 == index2 and index1 == index3) {
189 this->_cellFunctor.processCell(cell1);
190 }
else if (index1 == index2 and index1 != index3) {
191 this->_cellFunctor.processCellPair(cell1, cell3, r);
192 }
else if (index1 != index2 and (index1 == index3 or index2 == index3)) {
193 this->_cellFunctor.processCellPair(cell1, cell2, r);
195 this->_cellFunctor.processCellTriple(cell1, cell2, cell3, r);
This class provides the base for traversals using the c08 base step.
Definition: LCC08CellHandler.h:27
std::conditional_t< decltype(utils::isPairwiseFunctor< Functor_T >())::value, LCC08CellHandlerUtility::OffsetPairSorting, LCC08CellHandlerUtility::OffsetTripletSorting > CellOffsetType
CellOffset needs to store interaction pairs or triplets depending on the Functor type.
Definition: LCC08CellHandler.h:99
void setAoSSortingThreshold(size_t aosSortingThreshold)
Set the aos-sorting-threshold for traversals that use the CellFunctor If the sum of the number of par...
Definition: LCC08CellHandler.h:87
const std::array< unsigned long, 3 > _overlap
Overlap of interacting cells.
Definition: LCC08CellHandler.h:110
void setSoASortingThreshold(size_t soaSortingThreshold)
Set the SoA sorting-threshold for traversals that use the CellFunctor.
Definition: LCC08CellHandler.h:91
LCC08CellHandler(Functor_T &functor, const std::array< unsigned long, 3 > &cellsPerDimension, double interactionLength, const std::array< double, 3 > &cellLength, const std::array< unsigned long, 3 > &overlap, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the LCC08CellHandler.
Definition: LCC08CellHandler.h:41
DataLayoutOption _dataLayout
The datalayout to be used.
Definition: LCC08CellHandler.h:115
void processBaseCell(std::vector< ParticleCell_T > &cells, unsigned long baseIndex)
Computes one interaction for each spacial direction based on the lower left frontal corner (=base ind...
Definition: LCC08CellHandler.h:146
void processBaseCellPairwise(std::vector< ParticleCell_T > &cells, unsigned long baseIndex)
Pairwise implementation of processBaseCell().
Definition: LCC08CellHandler.h:159
bool _useNewton3
If newton3 should be used or not.
Definition: LCC08CellHandler.h:120
void processBaseCellTriwise(std::vector< ParticleCell_T > &cells, unsigned long baseIndex)
Triwise implementation of processBaseCell().
Definition: LCC08CellHandler.h:177
std::vector< CellOffsetType > _cellOffsets
Pair sets for processBaseCell().
Definition: LCC08CellHandler.h:105
A cell functor.
Definition: CellFunctor3B.h:24
A cell functor.
Definition: CellFunctor.h:29
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
std::tuple< unsigned long, unsigned long, std::array< double, 3 > > OffsetPairSorting
Type Alias for the C08 base step containing cell offsets.
Definition: LCC08CellHandlerUtility.h:27
std::tuple< unsigned long, unsigned long, unsigned long, std::array< double, 3 > > OffsetTripletSorting
Type Alias for the C08 base step containing cell offsets for cell triplets.
Definition: LCC08CellHandlerUtility.h:39
decltype(isTriwiseFunctorImpl(std::declval< FunctorT >())) isTriwiseFunctor
Check whether a Functor Type is inheriting from TriwiseFunctor.
Definition: checkFunctorType.h:56
decltype(isPairwiseFunctorImpl(std::declval< FunctorT >())) isPairwiseFunctor
Check whether a Functor Type is inheriting from PairwiseFunctor.
Definition: checkFunctorType.h:49
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34