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