AutoPas  3.0.0
Loading...
Searching...
No Matches
LCC08CellHandlerUtility.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <array>
10#include <tuple>
11#include <type_traits>
12#include <utility>
13#include <vector>
14
18#include "autopas/utils/Math.h"
20
22
33using OffsetPairSorting = std::tuple<unsigned long, unsigned long, std::array<double, 3>>;
34
41using OffsetPair = std::pair<unsigned long, unsigned long>;
42
46using OffsetPairVector = std::vector<OffsetPair>;
47
54enum class C08OffsetMode {
56 c08CellPairs = 0,
60 c04CellPairs = 2,
61};
62
67template <C08OffsetMode Mode>
68using OffsetPairType = std::vector<
69 std::conditional_t<Mode == C08OffsetMode::c08CellPairsSorting, OffsetPairSorting,
70 std::conditional_t<Mode == C08OffsetMode::c04CellPairs, OffsetPairVector, OffsetPair>>>;
71
72namespace internal {
73
77enum class C08CellDirection : int {
86};
87
91constexpr inline std::array<C08CellDirection, 4> ALL_DIRECTIONS{
94
99constexpr inline char ENUM_EXTENSION_EXCEPTION[]{
100 "Enum C08CellDirection was extended, but its assciated switch-case statements was not!"};
101
113constexpr std::pair<int, int> toMaskXY(const C08CellDirection &direction);
114
127constexpr bool includeCellPair(const C08CellDirection &direction, const std::array<int, 3> &overlap, int x, int y,
128 int z);
129
138std::array<double, 3> computeSortingDirection(const std::array<double, 3> &offset1Vector,
139 const std::array<double, 3> &offset2Vector,
140 const std::array<double, 3> &cellLength);
141
142} // namespace internal
143
156template <C08OffsetMode Mode>
157OffsetPairType<Mode> computePairwiseCellOffsetsC08(const std::array<unsigned long, 3> &cellsPerDimension,
158 const std::array<double, 3> &cellLength, double interactionLength);
159
160} // namespace autopas::LCC08CellHandlerUtility
constexpr std::array< C08CellDirection, 4 > ALL_DIRECTIONS
Array containing all four enum values of C08CellDirection.
Definition: LCC08CellHandlerUtility.h:91
constexpr char ENUM_EXTENSION_EXCEPTION[]
Error message thrown in case C08CellDirection was extended but the extension was not included in the ...
Definition: LCC08CellHandlerUtility.h:99
C08CellDirection
Represents the interaction directions between cell pairs in the C08 base step.
Definition: LCC08CellHandlerUtility.h:77
@ frontRight
The cell to the right from the origin.
@ backLeft
The cell to the back from the origin.
@ frontLeft
The origin or the base cell in the four-cell-square.
constexpr std::pair< int, int > toMaskXY(const C08CellDirection &direction)
Helper function for autopas::LCC08CellHandlerUtility::computePairwiseCellOffsetsC08.
Definition: LCC08CellHandlerUtility.cpp:13
constexpr bool includeCellPair(const C08CellDirection &direction, const std::array< int, 3 > &overlap, int x, int y, int z)
Returns true if the cell-interaction in the given direction, with the given base cell coordinates (x,...
Definition: LCC08CellHandlerUtility.cpp:27
std::array< double, 3 > computeSortingDirection(const std::array< double, 3 > &offset1Vector, const std::array< double, 3 > &offset2Vector, const std::array< double, 3 > &cellLength)
Computes the sorting direction between two cells from center of cell1 to center of cell2 using the 3D...
Definition: LCC08CellHandlerUtility.cpp:42
Helper function and type aliases for the C08 base step traversal.
Definition: LCC08CellHandlerUtility.cpp:9
std::pair< unsigned long, unsigned long > OffsetPair
An offset is the distance from a base cell to another cell in one dimensional coordinates.
Definition: LCC08CellHandlerUtility.h:41
std::vector< std::conditional_t< Mode==C08OffsetMode::c08CellPairsSorting, OffsetPairSorting, std::conditional_t< Mode==C08OffsetMode::c04CellPairs, OffsetPairVector, OffsetPair > > > OffsetPairType
Template Magic Parameter Alias which links the types OffsetPairSorting, OffsetPair and OffsetPairVect...
Definition: LCC08CellHandlerUtility.h:70
OffsetPairType< Mode > computePairwiseCellOffsetsC08(const std::array< unsigned long, 3 > &cellsPerDimension, const std::array< double, 3 > &cellLength, double interactionLength)
Computes the cell pair offsets for the C08 base step and the normalized vector between pair of cell-c...
Definition: LCC08CellHandlerUtility.cpp:59
std::tuple< unsigned long, unsigned long, std::array< double, 3 > > OffsetPairSorting
Type Alias for the C08 base step containg cell offsets.
Definition: LCC08CellHandlerUtility.h:33
std::vector< OffsetPair > OffsetPairVector
A vector of OffsetPairs.
Definition: LCC08CellHandlerUtility.h:46
C08OffsetMode
Compile Time Modes for the function autopas::LCC08CellHandlerUtility::computePairwiseCellOffsetsC08.
Definition: LCC08CellHandlerUtility.h:54
@ c04CellPairs
Returns the C08 base step cell pairs adapted to C04, i.e.
@ c08CellPairsSorting
Returns the C08 base step cell pairs with sorting directions (for SortedView projection)
@ c08CellPairs
Returns the C08 base step cell pairs without sorting.