AutoPas  3.0.0
Loading...
Searching...
No Matches
CompatibleTraversals.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <set>
10
16
17namespace autopas::compatibleTraversals {
18
22namespace {
29std::set<TraversalOption> filterAllOptions(const std::string &prefix, const InteractionTypeOption &interactionType) {
30 const auto allOpts = TraversalOption::getAllOptionsOf(interactionType);
31 std::set<TraversalOption> retSet;
32 // If the lambda condition holds (=prefix matches) copy the option in the return set.
33 std::copy_if(allOpts.begin(), allOpts.end(), std::inserter(retSet, retSet.begin()),
34 [&](const auto &option) { return option.to_string().substr(0, prefix.length()) == prefix; });
35 return retSet;
36}
37} // namespace
38
43[[maybe_unused]] static const std::set<TraversalOption> &allDSCompatibleTraversals() {
44 static const auto s = filterAllOptions("ds_", InteractionTypeOption::pairwise);
45 return s;
46}
47
52[[maybe_unused]] static const std::set<TraversalOption> &allDSCompatibleTraversals3B() {
53 static const auto s = filterAllOptions("ds_", InteractionTypeOption::triwise);
54 return s;
55}
56
61[[maybe_unused]] static const std::set<TraversalOption> &allLCCompatibleTraversals() {
62 static const auto s = filterAllOptions("lc_", InteractionTypeOption::pairwise);
63 return s;
64}
65
70[[maybe_unused]] static const std::set<TraversalOption> &allLCCompatibleTraversals3B() {
71 static const auto s = filterAllOptions("lc_", InteractionTypeOption::triwise);
72 return s;
73}
74
80[[maybe_unused]] static const std::set<TraversalOption> &allRLCCompatibleTraversals() {
82}
83
88[[maybe_unused]] static const std::set<TraversalOption> &allVCLCompatibleTraversals() {
89 static const auto s = filterAllOptions("vcl_", InteractionTypeOption::pairwise);
90 return s;
91}
92
97[[maybe_unused]] static const std::set<TraversalOption> &allVLCompatibleTraversals() {
98 static const auto s = filterAllOptions("vl_", InteractionTypeOption::pairwise);
99 return s;
100}
101
106[[maybe_unused]] static const std::set<TraversalOption> &allVLCCompatibleTraversals() {
107 static const auto s = filterAllOptions("vlc_", InteractionTypeOption::pairwise);
108 return s;
109}
110
115[[maybe_unused]] static const std::set<TraversalOption> &allVarVLAsBuildCompatibleTraversals() {
116 static const auto s = filterAllOptions("vvl_", InteractionTypeOption::pairwise);
117 return s;
118}
119
124[[maybe_unused]] static const std::set<TraversalOption> &allVLPCompatibleTraversals() {
125 static const auto s = filterAllOptions("vlp_", InteractionTypeOption::pairwise);
126 return s;
127}
128
133[[maybe_unused]] static const std::set<TraversalOption> &allOTCompatibleTraversals() {
134 static const auto s = filterAllOptions("ot_", InteractionTypeOption::pairwise);
135 return s;
136}
137
142[[maybe_unused]] static std::set<TraversalOption> allTraversalsSupportingOnlyNewton3Disabled() {
143 return {TraversalOption::lc_c01,
144 TraversalOption::lc_c01_combined_SoA,
145 TraversalOption::ot_c01,
146 TraversalOption::vcl_c01_balanced,
147 TraversalOption::vcl_cluster_iteration,
148 TraversalOption::vl_list_iteration,
149 TraversalOption::vlc_c01,
150 TraversalOption::vlp_c01};
151};
156[[maybe_unused]] static std::set<TraversalOption> allTraversalsSupportingOnlyNewton3Enabled() {
157 return {
158 TraversalOption::ot_c18,
159 };
160};
165[[maybe_unused]] static std::set<TraversalOption> allTraversalsSupportingOnlyAoS() { return {}; };
170[[maybe_unused]] static std::set<TraversalOption> allTraversalsSupportingOnlySoA() {
171 return {
172 TraversalOption::lc_c01_combined_SoA,
173 TraversalOption::lc_c04_combined_SoA,
174 };
175};
176
183[[maybe_unused]] static const std::set<TraversalOption> &allCompatibleTraversals(
184 ContainerOption containerOption, const InteractionTypeOption interactionTypeOption) {
185 switch (interactionTypeOption) {
186 // Check compatible pairwise traversals
187 case InteractionTypeOption::pairwise: {
188 switch (containerOption) {
189 case ContainerOption::linkedCells: {
191 }
192 case ContainerOption::directSum: {
194 }
195 case ContainerOption::verletClusterLists: {
197 }
198 case ContainerOption::verletLists: {
200 }
201 case ContainerOption::verletListsCells: {
203 }
204 case ContainerOption::varVerletListsAsBuild: {
206 }
207 case ContainerOption::linkedCellsReferences: {
209 }
210 case ContainerOption::pairwiseVerletLists: {
212 }
213 case ContainerOption::octree: {
215 }
216 }
217 }
218 // Check compatible triwise traversals
219 case InteractionTypeOption::triwise: {
220 switch (containerOption) {
221 case ContainerOption::directSum: {
223 }
224 case ContainerOption::linkedCells: {
226 }
227 default: {
228 static const std::set<TraversalOption> s{};
229 return s;
230 }
231 }
232 }
233 case InteractionTypeOption::all: {
234 utils::ExceptionHandler::exception("CompatibleTraversals: Interaction type option {} is not supported!",
235 interactionTypeOption.to_string());
236 }
237 }
238
240 "CompatibleTraversals: Unknown container option {} or unsupported interaction type {}!",
241 containerOption.to_string(), interactionTypeOption.to_string());
242
243 static const std::set<TraversalOption> s{};
244 return s;
245}
246
252[[maybe_unused]] static std::set<ContainerOption> allCompatibleContainers(TraversalOption traversalOption) {
253 std::set<ContainerOption> result{};
254
255 for (const auto &container : ContainerOption::getAllOptions()) {
256 for (const auto &interactionType : InteractionTypeOption::getMostOptions()) {
257 auto allCompatible = compatibleTraversals::allCompatibleTraversals(container, interactionType);
258 if (allCompatible.find(traversalOption) != allCompatible.end()) {
259 result.insert(container);
260 }
261 }
262 }
263
264 return result;
265}
266
267} // namespace autopas::compatibleTraversals
static const std::set< TraversalOption > & allVLCCompatibleTraversals()
Lists all traversal options applicable for the Verlet Lists Cells container.
Definition: CompatibleTraversals.h:106
static const std::set< TraversalOption > & allDSCompatibleTraversals3B()
Lists all triwise traversal options applicable for the Direct Sum container.
Definition: CompatibleTraversals.h:52
static std::set< TraversalOption > allTraversalsSupportingOnlyAoS()
Provides a set of all traversals that only support DataLayout AoS.
Definition: CompatibleTraversals.h:165
static const std::set< TraversalOption > & allVLCompatibleTraversals()
Lists all traversal options applicable for the Verlet Lists container.
Definition: CompatibleTraversals.h:97
static const std::set< TraversalOption > & allDSCompatibleTraversals()
Lists all traversal options applicable for the Direct Sum container.
Definition: CompatibleTraversals.h:43
static const std::set< TraversalOption > & allRLCCompatibleTraversals()
Lists all traversal options applicable for the Reference Linked Cells container.
Definition: CompatibleTraversals.h:80
static const std::set< TraversalOption > & allLCCompatibleTraversals3B()
Lists all triwise traversal options applicable for the Linked Cells container.
Definition: CompatibleTraversals.h:70
static const std::set< TraversalOption > & allLCCompatibleTraversals()
Lists all traversal options applicable for the Linked Cells container.
Definition: CompatibleTraversals.h:61
static const std::set< TraversalOption > & allVLPCompatibleTraversals()
Lists all traversal options applicable for the Pairwise Verlet Lists container.
Definition: CompatibleTraversals.h:124
static std::set< ContainerOption > allCompatibleContainers(TraversalOption traversalOption)
Lists all container options which given traversal can be applied to.
Definition: CompatibleTraversals.h:252
static std::set< TraversalOption > allTraversalsSupportingOnlySoA()
Provides a set of all traversals that only support DataLayout SoA.
Definition: CompatibleTraversals.h:170
static const std::set< TraversalOption > & allOTCompatibleTraversals()
Lists all traversal options applicable for the Octree container.
Definition: CompatibleTraversals.h:133
static const std::set< TraversalOption > & allVarVLAsBuildCompatibleTraversals()
Lists all traversal options applicable for the Var Verlet Lists As Build container.
Definition: CompatibleTraversals.h:115
static std::set< TraversalOption > allTraversalsSupportingOnlyNewton3Enabled()
Provides a set of all traversals that only support Newton3 mode enabled.
Definition: CompatibleTraversals.h:156
static const std::set< TraversalOption > & allCompatibleTraversals(ContainerOption containerOption, const InteractionTypeOption interactionTypeOption)
Lists all traversal options applicable for the given container.
Definition: CompatibleTraversals.h:183
static const std::set< TraversalOption > & allVCLCompatibleTraversals()
Lists all traversal options applicable for the Verlet Cluster Lists container.
Definition: CompatibleTraversals.h:88
static std::set< TraversalOption > allTraversalsSupportingOnlyNewton3Disabled()
Provides a set of all traversals that only support Newton3 mode disabled.
Definition: CompatibleTraversals.h:142
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
std::set< TraversalOption > filterAllOptions(const std::string &prefix, const InteractionTypeOption &interactionType)
Helper function to filter all traversal options for a given prefix and interaction type.
Definition: CompatibleTraversals.h:29