29template <
class ParticleCell,
class PairwiseFunctor>
43 const double interactionLength,
const std::array<double, 3> &cellLength,
44 DataLayoutOption dataLayout,
bool useNewton3)
46 dataLayout, useNewton3),
48 dataLayout, useNewton3),
49 _end(utils::ArrayMath::subScalar(utils::ArrayUtils::static_cast_copy_array<long>(this->
_cellsPerDimension),
54 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::lc_c04_HCP; }
59 const double minLength = *std::min_element(this->
_cellLength.cbegin(), this->_cellLength.cend());
67 void setSortingThreshold(
size_t sortingThreshold)
override { _cellHandler.setSortingThreshold(sortingThreshold); }
70 void traverseSingleColor(std::vector<ParticleCell> &cells,
int color);
72 void processBasePack6(std::vector<ParticleCell> &cells,
const std::array<long, 3> &base3DIndex);
76 const std::array<long, 3> _end;
79template <
class ParticleCell,
class PairwiseFunctor>
80void LCC04HCPTraversal<ParticleCell, PairwiseFunctor>::processBasePack6(std::vector<ParticleCell> &cells,
81 const std::array<long, 3> &base3DIndex) {
83 std::array<long, 3> index{};
84 const std::array<long, 3> signedDims = utils::ArrayUtils::static_cast_copy_array<long>(this->_cellsPerDimension);
87 for (
long z = 0; z < 3; ++z) {
88 for (
long x = 0; x < 2; ++x) {
89 index[0] = base3DIndex[0] + x;
90 index[1] = base3DIndex[1];
91 index[2] = base3DIndex[2] + z;
94 for (
int d = 0; d < 3; ++d) {
96 isIn &= (index[d] >= 0l) and (index[d] <= (_end[d] - this->_overlap[d]));
101 const unsigned long ulIndex =
threeToOneD(index, signedDims);
102 _cellHandler.processBaseCell(cells, ulIndex);
108template <
class ParticleCell,
class PairwiseFunctor>
110 auto &cells = *(this->_cells);
112 for (
int color = 0; color < 4; ++color) {
113 traverseSingleColor(cells, color);
131template <
class ParticleCell,
class PairwiseFunctor>
135 std::array<long, 3> startOfThisColor{};
142 startOfThisColor = {0l, 0l, 0l};
145 startOfThisColor = {-4l, 0l, 1l};
148 startOfThisColor = {-4l, 0l, -2l};
151 startOfThisColor = {-2l, 0l, -1l};
158 const long startX = startOfThisColor[0], endX = _end[0];
159 const long startY = startOfThisColor[1], endY = _end[1];
160 const long startZ = startOfThisColor[2], endZ = _end[2];
164 for (
long z = startZ; z < endZ; z += 4) {
165 for (
long y = startY; y < endY; y++) {
168 for (
long x = startX; x < (endX + 4); x += 6) {
178 switch ((z - startZ) % 12 / 4) {
191 if ((y - startY) % 2 != 0) {
194 processBasePack6(cells, {x_index, y, z});
#define AUTOPAS_OPENMP(args)
Empty macro to throw away any arguments.
Definition: WrapOpenMP.h:126
This class provides the base for traversals using the c08 base step.
Definition: C08BasedTraversal.h:24
std::array< unsigned long, 3 > _cellsPerDimension
The dimensions of the cellblock.
Definition: CellTraversal.h:55
const double _interactionLength
Interaction length (cutoff + skin).
Definition: ColorBasedTraversal.h:111
std::array< unsigned long, 3 > _overlap
overlap of interacting cells.
Definition: ColorBasedTraversal.h:121
const std::array< double, 3 > _cellLength
cell length in CellBlock3D.
Definition: ColorBasedTraversal.h:116
This class provides the c04 hcp traversal.
Definition: LCC04HCPTraversal.h:30
LCC04HCPTraversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor *pairwiseFunctor, const double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of c04hcp.
Definition: LCC04HCPTraversal.h:42
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: LCC04HCPTraversal.h:109
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: LCC04HCPTraversal.h:54
void setSortingThreshold(size_t sortingThreshold) override
Set the sorting-threshold for traversals that use the CellFunctor If the sum of the number of particl...
Definition: LCC04HCPTraversal.h:67
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: LCC04HCPTraversal.h:56
This class provides the base for traversals using the c08 base step.
Definition: LCC08CellHandler.h:28
Interface for traversals used by the LinkedCell class.
Definition: LCTraversalInterface.h:18
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
constexpr T threeToOneD(T x, T y, T z, const std::array< T, 3 > &dims)
Convert a 3d index to a 1d index.
Definition: ThreeDimensionalMapping.h:29
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32