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
16
27using OffsetPairSorting = std::tuple<unsigned long, unsigned long, std::array<double, 3>>;
28
39using OffsetTripletSorting = std::tuple<unsigned long, unsigned long, unsigned long, std::array<double, 3>>;
40
47using OffsetPair = std::pair<unsigned long, unsigned long>;
48
56using OffsetTriplet = std::tuple<unsigned long, unsigned long, unsigned long>;
57
61using OffsetPairVector = std::vector<OffsetPair>;
62
66using OffsetTripletVector = std::vector<OffsetTriplet>;
67
74enum class C08OffsetMode {
76 noSorting = 0,
78 sorting = 1,
80 c04NoSorting = 2,
81};
82
87template <C08OffsetMode Mode>
88using OffsetPairType = std::vector<
89 std::conditional_t<Mode == C08OffsetMode::sorting, OffsetPairSorting,
90 std::conditional_t<Mode == C08OffsetMode::c04NoSorting, OffsetPairVector, OffsetPair>>>;
91
96template <C08OffsetMode Mode>
97using OffsetTripletType = std::vector<
98 std::conditional_t<Mode == C08OffsetMode::sorting, OffsetTripletSorting,
99 std::conditional_t<Mode == C08OffsetMode::c04NoSorting, OffsetTripletVector, OffsetTriplet>>>;
100
101namespace internal {
102
106enum class C08CellDirection : int {
108 frontLeft,
110 backLeft,
114 backRight,
115};
116
120constexpr inline std::array<C08CellDirection, 4> ALL_DIRECTIONS{
123
128constexpr inline char ENUM_EXTENSION_EXCEPTION[]{
129 "Enum C08CellDirection was extended, but its associated switch-case statements was not!"};
130
142constexpr std::pair<int, int> toMaskXY(const C08CellDirection &direction);
143
156constexpr bool includeCellPair(const C08CellDirection &direction, const std::array<int, 3> &overlap, int x, int y,
157 int z);
158
167std::array<double, 3> computeSortingDirection(const std::array<double, 3> &offset1Vector,
168 const std::array<double, 3> &offset2Vector,
169 const std::array<double, 3> &cellLength);
170
171} // namespace internal
172
185template <C08OffsetMode Mode>
186OffsetPairType<Mode> computePairwiseCellOffsetsC08(const std::array<unsigned long, 3> &cellsPerDimension,
187 const std::array<double, 3> &cellLength, double interactionLength);
188
202template <C08OffsetMode Mode>
203OffsetTripletType<Mode> computeTriwiseCellOffsetsC08(const std::array<unsigned long, 3> &cellsPerDimension,
204 const std::array<double, 3> &cellLength, double interactionLength);
205
206} // namespace autopas::LCC08CellHandlerUtility
constexpr std::array< C08CellDirection, 4 > ALL_DIRECTIONS
Array containing all four enum values of C08CellDirection.
Definition: LCC08CellHandlerUtility.h:120
constexpr char ENUM_EXTENSION_EXCEPTION[]
Error message thrown in case C08CellDirection was extended but the extension was not included in the ...
Definition: LCC08CellHandlerUtility.h:128
C08CellDirection
Represents the interaction directions between cell pairs in the C08 base step.
Definition: LCC08CellHandlerUtility.h:106
@ 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:21
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:35
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:50
Helper function and type aliases for the C08 base step traversal.
Definition: LCC08CellHandlerUtility.cpp:17
std::vector< std::conditional_t< Mode==C08OffsetMode::sorting, OffsetPairSorting, std::conditional_t< Mode==C08OffsetMode::c04NoSorting, OffsetPairVector, OffsetPair > > > OffsetPairType
Template Magic Parameter Alias, which links the types OffsetPairSorting, OffsetPair and OffsetPairVec...
Definition: LCC08CellHandlerUtility.h:90
std::tuple< unsigned long, unsigned long, unsigned long > OffsetTriplet
An offset is the distance from a base cell to another cell in one-dimensional coordinates.
Definition: LCC08CellHandlerUtility.h:56
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:47
std::vector< std::conditional_t< Mode==C08OffsetMode::sorting, OffsetTripletSorting, std::conditional_t< Mode==C08OffsetMode::c04NoSorting, OffsetTripletVector, OffsetTriplet > > > OffsetTripletType
Template Magic Parameter Alias, which links the types OffsetTripletSorting, OffsetTriplet and OffsetT...
Definition: LCC08CellHandlerUtility.h:99
OffsetTripletType< Mode > computeTriwiseCellOffsetsC08(const std::array< unsigned long, 3 > &cellsPerDimension, const std::array< double, 3 > &cellLength, const double interactionLength)
Computes the cell triplet offsets for the C08 base step.
Definition: LCC08CellHandlerUtility.cpp:161
OffsetPairType< Mode > computePairwiseCellOffsetsC08(const std::array< unsigned long, 3 > &cellsPerDimension, const std::array< double, 3 > &cellLength, const double interactionLength)
Computes the cell pair offsets for the C08 base step and the normalized vector between the pair of ce...
Definition: LCC08CellHandlerUtility.cpp:67
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::vector< OffsetTriplet > OffsetTripletVector
A vector of OffsetTriplets.
Definition: LCC08CellHandlerUtility.h:66
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
std::vector< OffsetPair > OffsetPairVector
A vector of OffsetPairs.
Definition: LCC08CellHandlerUtility.h:61
C08OffsetMode
Compile Time Modes for the function autopas::LCC08CellHandlerUtility::computePairwiseCellOffsetsC08.
Definition: LCC08CellHandlerUtility.h:74
@ noSorting
Returns the C08 base step cell pairs without sorting.
@ sorting
Returns the C08 base step cell pairs with sorting directions (for SortedView projection)
@ c04NoSorting
Returns the C08 base step cell pairs adapted to C04, i.e.