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 &sortingThreshold = containerInfo.sortingThreshold;
54
55 std::unique_ptr<ParticleContainerInterface<Particle_T>> container;
56 switch (containerChoice) {
57 case ContainerOption::directSum: {
58 container = std::make_unique<DirectSum<Particle_T>>(boxMin, boxMax, cutoff, verletSkin, sortingThreshold);
59 break;
60 }
61
62 case ContainerOption::linkedCells: {
63 container = std::make_unique<LinkedCells<Particle_T>>(boxMin, boxMax, cutoff, verletSkin, cellSizeFactor,
64 sortingThreshold, loadEstimator);
65 break;
66 }
67 case ContainerOption::linkedCellsReferences: {
68 container = std::make_unique<LinkedCellsReferences<Particle_T>>(boxMin, boxMax, cutoff, verletSkin,
69 cellSizeFactor, sortingThreshold);
70 break;
71 }
72 case ContainerOption::verletLists: {
73 container = std::make_unique<VerletLists<Particle_T>>(
74 boxMin, boxMax, cutoff, verletSkin, VerletLists<Particle_T>::BuildVerletListType::VerletSoA, cellSizeFactor);
75 break;
76 }
77 case ContainerOption::verletListsCells: {
78 container = std::make_unique<VerletListsCells<Particle_T, VLCAllCellsNeighborList<Particle_T>>>(
79 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, loadEstimator,
80 VerletListsCellsHelpers::VLCBuildType::soaBuild);
81 break;
82 }
83 case ContainerOption::verletClusterLists: {
84 container = std::make_unique<VerletClusterLists<Particle_T>>(boxMin, boxMax, cutoff, verletSkin,
85 verletClusterSize, loadEstimator);
86 break;
87 }
88 case ContainerOption::varVerletListsAsBuild: {
89 container = std::make_unique<VarVerletLists<Particle_T, VerletNeighborListAsBuild<Particle_T>>>(
90 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor);
91 break;
92 }
93
94 case ContainerOption::pairwiseVerletLists: {
95 container = std::make_unique<VerletListsCells<Particle_T, VLCCellPairNeighborList<Particle_T>>>(
96 boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, loadEstimator,
97 VerletListsCellsHelpers::VLCBuildType::soaBuild);
98 break;
99 }
100 case ContainerOption::octree: {
101 container =
102 std::make_unique<Octree<Particle_T>>(boxMin, boxMax, cutoff, verletSkin, cellSizeFactor, sortingThreshold);
103 break;
104 }
105 default: {
106 utils::ExceptionHandler::exception("ContainerSelector: Container type {} is not a known type!",
107 containerChoice.to_string());
108 }
109 }
110
111 return container;
112}
113} // namespace autopas
Info to generate a container.
Definition: ContainerSelectorInfo.h:17
std::array< double, 3 > boxMin
Lower corner of the container.
Definition: ContainerSelectorInfo.h:93
double cellSizeFactor
cellSizeFactor Cell size factor to be used in this container (only relevant for LinkedCells)
Definition: ContainerSelectorInfo.h:108
double cutoff
Cutoff radius to be used in this container.
Definition: ContainerSelectorInfo.h:103
std::array< double, 3 > boxMax
Upper corner of the container.
Definition: ContainerSelectorInfo.h:98
LoadEstimatorOption loadEstimator
Load estimator for balanced sliced traversals.
Definition: ContainerSelectorInfo.h:124
double verletSkin
Length added to the cutoff for the verlet lists' skin inbetween rebuilding lists.
Definition: ContainerSelectorInfo.h:112
unsigned int verletClusterSize
Size of Verlet Clusters.
Definition: ContainerSelectorInfo.h:116
size_t sortingThreshold
Threshold beyond which, if the sum of the number of particles in two cells is greater,...
Definition: ContainerSelectorInfo.h:120
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:32
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32