9#include "particleContainer/ParticleContainer.h"
10#include "particleContainer/ParticleIterator.h"
11#include "particleContainer/RegionParticleIterator.h"
12#include "particleContainer/ParticleCell.h"
14#include "WrapOpenMP.h"
16template<
class CellTemplate>
18template<
class CellTemplate>
53 friend class LinkedCellsTest;
93 double bBoxMin[3],
double bBoxMax[3],
double cutoffRadius
134 int getHaloWidthNumCells()
override {
135 return _haloWidthInNumCells[0];
139 bool rebuild(
double bBoxMin[3],
double bBoxMax[3])
override;
150 void update_via_copies();
151 void update_via_coloring();
152 void update_via_traversal();
153 void update_via_sliced_traversal();
155 bool addParticle(
Molecule& particle,
bool inBoxCheckedAlready =
false,
bool checkWhetherDuplicate =
false,
const bool& rebuildCaches=
false)
override;
157 void addParticles(std::vector<Molecule>& particles,
bool checkWhetherDuplicate=
false)
override;
175 void traverseNonInnermostCells(
CellProcessor& cellProcessor)
override;
177 void traversePartialInnermostCells(
CellProcessor& cellProcessor,
unsigned int stage,
int stageCount)
override;
183 void clear()
override;
193 double getCutoff()
const override {
return _cutoffRadius; }
194 void setCutoff(
double rc)
override { _cutoffRadius = rc; }
196 void deleteMolecule(
ParticleIterator &moleculeIter,
const bool& rebuildCaches)
override;
200 int* getBoxWidthInNumCells() {
201 return _boxWidthInNumCells;
204 double* getCellLength()
override {
214 std::variant<ParticleIterator, SingleCellIterator<ParticleCell>>
getMoleculeAtPosition(
const double pos[3])
override;
234 ParticleCell& getCellReference(
int idx){
return _cells[idx];}
246 ParticleIterator :: CellIndex_T offset = mardyn_get_thread_num();
247 ParticleIterator :: CellIndex_T stride = mardyn_get_num_threads();
252 ParticleIterator::Type
type)
override;
254 size_t getTotalSize()
override;
255 void printSubInfo(
int offset)
override;
258 bool requiresForceExchange()
const override;
260 unsigned long initCubicGrid(std::array<unsigned long, 3> numMoleculesPerDimension,
261 std::array<double, 3> simBoxLength,
size_t seed_offset)
override;
273 void check_molecules_in_box();
279 void initializeCells();
281 void initializeTraversal();
302 void calculateNeighbourIndices(std::vector<long>& forward, std::vector<long>& backward)
const;
305 std::array<std::pair<unsigned long, unsigned long>, 14> calculateCellPairOffsets()
const;
315 long int cellIndexOf3DIndex(
long int xIndex,
long int yIndex,
long int zIndex)
const;
318 void threeDIndexOfCellIndex(
int ind,
int r[3],
const int dim[3])
const;
325 void deleteParticlesOutsideBox(
double boxMin[3],
double boxMax[3]);
327 void getCellIndicesOfRegion(
const double startRegion[3],
const double endRegion[3],
unsigned int &startRegionCellIndex,
unsigned int &endRegionCellIndex);
330 const double startRegion[3],
const double endRegion[3],
331 const unsigned int startRegionCellIndex,
332 const unsigned int endRegionCellIndex, ParticleIterator::Type
type);
338 std::vector<ParticleCell> _cells;
340 std::vector<unsigned long> _haloCellIndices;
342 std::unique_ptr<TraversalTuner<ParticleCell>> _traversalTuner;
344 double _haloBoundingBoxMin[3];
345 double _haloBoundingBoxMax[3];
347 int _cellsPerDimension[3];
348 int _haloWidthInNumCells[3];
349 int _boxWidthInNumCells[3];
350 double _haloLength[3];
351 double _cellLength[3];
352 double _cellLengthReciprocal[3];
353 double _cutoffRadius;
354 unsigned _cellsInCutoff = 1;
Definition: CellPairTraversals.h:21
Definition: CellProcessor.h:29
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
FullParticleCell data structure. Renamed from ParticleCell.
Definition: FullParticleCell.h:49
Linked Cell Data Structure.
Definition: LinkedCells.h:51
void clear() override
Delete all molecules in container.
Definition: LinkedCells.cpp:590
unsigned long int getCellIndexOfMolecule(Molecule *molecule) const
Get the index in the cell vector to which this Molecule belongs.
Definition: LinkedCells.cpp:791
unsigned long getNumberOfParticles() override
Definition: LinkedCells.cpp:577
bool rebuild(double bBoxMin[3], double bBoxMax[3]) override
rebuild the datastructure
Definition: LinkedCells.cpp:136
~LinkedCells()
Destructor.
Definition: LinkedCells.cpp:111
void deleteOuterParticles() override
delete all Particles which are not within the bounding box
Definition: LinkedCells.cpp:611
void setCutoff(double rc) override
Definition: LinkedCells.h:194
virtual void updateMoleculeCaches() override
Update the caches of the molecules.
Definition: LinkedCells.cpp:1076
void traverseCells(CellProcessor &cellProcessor) override
calculate the forces between the molecules.
Definition: LinkedCells.cpp:564
void readXML(XMLfileUnits &xmlconfig) override
Read in XML configuration for LinkedCells and all its included objects.
Definition: LinkedCells.cpp:128
virtual void updateBoundaryAndHaloMoleculeCaches() override
Update the caches of the molecules, that lie in the boundary or halo cells. The caches of boundary an...
Definition: LinkedCells.cpp:1065
bool addParticle(Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
add a single Molecule to the ParticleContainer.
Definition: LinkedCells.cpp:445
LinkedCells()
Default constructor.
Definition: LinkedCells.cpp:39
virtual void updateInnerMoleculeCaches() override
Update the caches of the molecules, that lie in inner cells. The caches of boundary and halo cells is...
Definition: LinkedCells.cpp:1054
unsigned long int getCellIndexOfPoint(const double point[3]) const
Get the index in the cell vector to which the point belongs.
Definition: LinkedCells.cpp:830
std::variant< ParticleIterator, SingleCellIterator< ParticleCell > > getMoleculeAtPosition(const double pos[3]) override
Gets a molecule by its position.
Definition: LinkedCells.cpp:1123
void update() override
Definition: LinkedCells.cpp:243
std::vector< unsigned long > getParticleCellStatistics() override
Definition: LinkedCells.cpp:1146
void addParticles(std::vector< Molecule > &particles, bool checkWhetherDuplicate=false) override
adds a whole vector of particles
Definition: LinkedCells.cpp:458
double get_halo_L(int index) const override
gets the width of the halo region in dimension index
Definition: LinkedCells.cpp:630
std::string getConfigurationAsString() override
Definition: LinkedCells.cpp:1163
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
Definition: ParticleIterator.h:50
interface for defining the action performed when processing a pair
Definition: ParticlePairsHandler.h:38
Definition: RegionParticleIterator.h:33
Definition: ResortCellProcessorSliced.h:17
Definition: TraversalTuner.h:23
Definition: VTKGridWriter.h:24
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
Enumeration class corresponding to the type schema type.
Definition: vtk-unstructured.h:1746
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
Definition: FakedOptFFT.h:23