AutoPas  3.0.0
Loading...
Searching...
No Matches
ContainerSelector.h
Go to the documentation of this file.
1
7#pragma once
8
11#include "autopas/containers/linkedCells/LinkedCellsReferences.h"
22
23namespace autopas {
24
30template <class Particle_T>
32 public:
39 static std::unique_ptr<ParticleContainerInterface<Particle_T>> generateContainer(
40 ContainerOption containerChoice, const ContainerSelectorInfo &containerInfo);
41};
42
43template <class Particle_T>
44std::unique_ptr<ParticleContainerInterface<Particle_T>> ContainerSelector<Particle_T>::generateContainer(
45 ContainerOption containerChoice, const ContainerSelectorInfo &containerInfo) {
46 const auto &boxMin = containerInfo.boxMin;
47 const auto &boxMax = containerInfo.boxMax;
48 const auto &cutoff = containerInfo.cutoff;
49 const auto &verletSkin = containerInfo.verletSkin;
50 const auto &verletClusterSize = containerInfo.verletClusterSize;
51 const auto &cellSizeFactor = containerInfo.cellSizeFactor;
52 const auto &loadEstimator = containerInfo.loadEstimator;
53 const auto &aosSortingThresholdFallback = containerInfo.aosSortingThresholdFallback;
54 const auto &soaSortingThresholdFallback = containerInfo.soaSortingThresholdFallback;
55
56 std::unique_ptr<ParticleContainerInterface<Particle_T>> container;
57 switch (containerChoice) {
58 case ContainerOption::directSum: {
59 container = std::make_unique<DirectSum<Particle_T>>(boxMin, boxMax, cutoff, verletSkin,
60 aosSortingThresholdFallback, soaSortingThresholdFallback);
61 break;
62 }
63
64 case ContainerOption::linkedCells: {
65 container = std::make_unique<LinkedCells<Particle_T>>(boxMin, boxMax, cutoff, verletSkin, cellSizeFactor,
66 aosSortingThresholdFallback, soaSortingThresholdFallback,
67 loadEstimator);
68 break;
69 }
70 case ContainerOption::linkedCellsReferences: {
71 container = std::make_unique<LinkedCellsReferences<Particle_T>>(
72 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, aosSortingThresholdFallback, soaSortingThresholdFallback);
73 break;
74 }
75 case ContainerOption::verletLists: {
76 container = std::make_unique<VerletLists<Particle_T>>(
77 boxMin, boxMax, cutoff, verletSkin, VerletLists<Particle_T>::BuildVerletListType::VerletSoA, cellSizeFactor);
78 break;
79 }
80 case ContainerOption::verletListsCells: {
81 container = std::make_unique<VerletListsCells<Particle_T, VLCAllCellsNeighborList<Particle_T>>>(
82 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, loadEstimator,
83 VerletListsCellsHelpers::VLCBuildType::soaBuild);
84 break;
85 }
86 case ContainerOption::verletClusterLists: {
87 container = std::make_unique<VerletClusterLists<Particle_T>>(boxMin, boxMax, cutoff, verletSkin,
88 verletClusterSize, loadEstimator);
89 break;
90 }
91 case ContainerOption::varVerletListsAsBuild: {
92 container = std::make_unique<VarVerletLists<Particle_T, VerletNeighborListAsBuild<Particle_T>>>(
93 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor);
94 break;
95 }
96
97 case ContainerOption::pairwiseVerletLists: {
98 container = std::make_unique<VerletListsCells<Particle_T, VLCCellPairNeighborList<Particle_T>>>(
99 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, loadEstimator,
100 VerletListsCellsHelpers::VLCBuildType::soaBuild);
101 break;
102 }
103 case ContainerOption::octree: {
104 container = std::make_unique<Octree<Particle_T>>(boxMin, boxMax, cutoff, verletSkin, cellSizeFactor,
105 aosSortingThresholdFallback, soaSortingThresholdFallback);
106 break;
107 }
108 default: {
109 utils::ExceptionHandler::exception("ContainerSelector: Container type {} is not a known type!",
110 containerChoice.to_string());
111 }
112 }
113
114 return container;
115}
116} // namespace autopas
Info to generate a container.
Definition: ContainerSelectorInfo.h:17
size_t aosSortingThresholdFallback
Threshold beyond which, if the sum of the number of particles in two cells is greater,...
Definition: ContainerSelectorInfo.h:128
std::array< double, 3 > boxMin
Lower corner of the container.
Definition: ContainerSelectorInfo.h:100
double cellSizeFactor
cellSizeFactor Cell size factor to be used in this container (only relevant for LinkedCells)
Definition: ContainerSelectorInfo.h:115
double cutoff
Cutoff radius to be used in this container.
Definition: ContainerSelectorInfo.h:110
std::array< double, 3 > boxMax
Upper corner of the container.
Definition: ContainerSelectorInfo.h:105
LoadEstimatorOption loadEstimator
Load estimator for balanced sliced traversals.
Definition: ContainerSelectorInfo.h:137
size_t soaSortingThresholdFallback
Threshold beyond which, if the sum of the SoA buffer sizes of two cells is greater,...
Definition: ContainerSelectorInfo.h:133
double verletSkin
Length added to the cutoff for the verlet lists' skin inbetween rebuilding lists.
Definition: ContainerSelectorInfo.h:119
unsigned int verletClusterSize
Size of Verlet Clusters.
Definition: ContainerSelectorInfo.h:123
Selector for a particle container.
Definition: ContainerSelector.h:31
static std::unique_ptr< ParticleContainerInterface< Particle_T > > generateContainer(ContainerOption containerChoice, const ContainerSelectorInfo &containerInfo)
Container factory method.
Definition: ContainerSelector.h:44
Verlet Lists container.
Definition: VerletLists.h:31
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34