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 setSortingThreshold(
size_t sortingThreshold) { _cellFunctor.setSortingThreshold(sortingThreshold); }
94 std::conditional_t<decltype(utils::isPairwiseFunctor<Functor_T>())::value,
120 using CellFunctorType =
121 std::conditional_t<decltype(utils::isPairwiseFunctor<Functor_T>())::value,
128 CellFunctorType _cellFunctor;
133 const double _interactionLength;
138 const std::array<double, 3> _cellLength;
141template <
class ParticleCell_T,
class Functor_T>
143 unsigned long baseIndex) {
145 processBaseCellPairwise(cells, baseIndex);
147 processBaseCellTriwise(cells, baseIndex);
150 "LCC08CellHandler::processBaseCell(): Given Functor type is not of type PairwiseFunctor or TriwiseFunctor.");
154template <
class ParticleCell_T,
class Functor_T>
156 unsigned long baseIndex) {
157 for (
auto const &[offset1, offset2, r] : _cellOffsets) {
158 const unsigned long cellIndex1 = baseIndex + offset1;
159 const unsigned long cellIndex2 = baseIndex + offset2;
161 ParticleCell_T &cell1 = cells[cellIndex1];
162 ParticleCell_T &cell2 = cells[cellIndex2];
164 if (cellIndex1 == cellIndex2) {
165 this->_cellFunctor.processCell(cell1);
167 this->_cellFunctor.processCellPair(cell1, cell2, r);
172template <
class ParticleCell_T,
class Functor_T>
174 unsigned long baseIndex) {
175 for (
auto const &[offset1, offset2, offset3, r] : _cellOffsets) {
176 const unsigned long index1 = baseIndex + offset1;
177 const unsigned long index2 = baseIndex + offset2;
178 const unsigned long index3 = baseIndex + offset3;
180 ParticleCell_T &cell1 = cells[index1];
181 ParticleCell_T &cell2 = cells[index2];
182 ParticleCell_T &cell3 = cells[index3];
184 if (index1 == index2 and index1 == index3) {
185 this->_cellFunctor.processCell(cell1);
186 }
else if (index1 == index2 and index1 != index3) {
187 this->_cellFunctor.processCellPair(cell1, cell3, r);
188 }
else if (index1 != index2 and (index1 == index3 or index2 == index3)) {
189 this->_cellFunctor.processCellPair(cell1, cell2, r);
191 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:95
const std::array< unsigned long, 3 > _overlap
Overlap of interacting cells.
Definition: LCC08CellHandler.h:106
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:111
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:142
void processBaseCellPairwise(std::vector< ParticleCell_T > &cells, unsigned long baseIndex)
Pairwise implementation of processBaseCell().
Definition: LCC08CellHandler.h:155
void setSortingThreshold(size_t sortingThreshold)
Set the sorting-threshold for traversals that use the CellFunctor If the sum of the number of particl...
Definition: LCC08CellHandler.h:87
bool _useNewton3
If newton3 should be used or not.
Definition: LCC08CellHandler.h:116
void processBaseCellTriwise(std::vector< ParticleCell_T > &cells, unsigned long baseIndex)
Triwise implementation of processBaseCell().
Definition: LCC08CellHandler.h:173
std::vector< CellOffsetType > _cellOffsets
Pair sets for processBaseCell().
Definition: LCC08CellHandler.h:101
A cell functor.
Definition: CellFunctor3B.h:24
A cell functor.
Definition: CellFunctor.h:25
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