ls1-MarDyn
ls1-MarDyn molecular dynamics code
FullParticleCell.h
1/*
2 * FullParticleCell.h
3 *
4 * Created on: 6 Feb 2017
5 * Author: tchipevn
6 */
7
8#ifndef SRC_PARTICLECONTAINER_FULLPARTICLECELL_H_
9#define SRC_PARTICLECONTAINER_FULLPARTICLECELL_H_
10
11#include <vector>
12
13#include "Cell.h"
14#include "particleContainer/ParticleCellBase.h"
15#include "particleContainer/adapter/CellDataSoA.h"
16#include "SingleCellIterator.h"
17
37
50 /*private:
51 FullParticleCell(const ParticleCell& that);*/
52public:
63
66 }
67
69 void deallocateAllParticles() override;
70
72 bool addParticle(Molecule& particle, bool checkWhetherDuplicate = false) override;
73
74 bool isEmpty() const override;
75
76 bool deleteMoleculeByIndex(size_t index) override;
77
79 int getMoleculeCount() const override;
80
86 return _cellDataSoA;
87 }
88
89 void preUpdateLeavingMolecules() override;
90
91 void updateLeavingMoleculesBase(ParticleCellBase& otherCell) override;
92
93 void postUpdateLeavingMolecules() override;
94
95 void getRegion(double lowCorner[3], double highCorner[3],
96 std::vector<Molecule*> &particlePtrs, bool removeFromContainer = false) override;
97
98 void buildSoACaches() override;
99
100 void increaseMoleculeStorage(size_t numExtraMols) override;
101
102 virtual size_t getMoleculeVectorDynamicSize() const override {
103 return _molecules.capacity() * sizeof(Molecule) + _leavingMolecules.capacity() * sizeof(Molecule);
104 }
105
106//protected: do not use!
107 void moleculesAtNew(size_t i, Molecule *& multipurposePointer) override {
108 multipurposePointer = & _molecules.at(i);
109 }
110
111 void moleculesAtConstNew(size_t i, Molecule *& multipurposePointer) const override {
112 multipurposePointer = const_cast<Molecule*>(& _molecules.at(i));
113 }
114
115 bool findMoleculeByID(size_t& index, unsigned long molid) const override;
116
117private:
118
119 void updateLeavingMolecules(FullParticleCell& otherCell);
120
124 std::vector<Molecule> _molecules;
125
129 std::vector<Molecule> _leavingMolecules;
130
135 CellDataSoA _cellDataSoA;
136};
137
138#endif /* SRC_PARTICLECONTAINER_FULLPARTICLECELL_H_ */
Structure of Arrays for vectorized force calculation.
Definition: CellDataSoA.h:22
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
FullParticleCell data structure. Renamed from ParticleCell.
Definition: FullParticleCell.h:49
void deallocateAllParticles() override
removes and deallocates all elements
Definition: FullParticleCell.cpp:29
bool addParticle(Molecule &particle, bool checkWhetherDuplicate=false) override
insert a single molecule into this cell
Definition: FullParticleCell.cpp:50
int getMoleculeCount() const override
return the number of molecules contained in this cell
Definition: FullParticleCell.cpp:77
bool findMoleculeByID(size_t &index, unsigned long molid) const override
Find the index of a molecule in a cell based on its molecule ID.
Definition: FullParticleCell.cpp:33
CellDataSoA & getCellDataSoA()
Get the structure of arrays for VectorizedCellProcessor.
Definition: FullParticleCell.h:85
FullParticleCell()
Initialize data pointers to 0.
Definition: FullParticleCell.cpp:19
bool isEmpty() const override
Check if current cell contains no molecules.
Definition: FullParticleCell.cpp:73
~FullParticleCell()
Destructor.
Definition: FullParticleCell.cpp:23
ParticleCellBase defines the interface for cells used by the LinkedCells data structure to store mole...
Definition: ParticleCellBase.h:23
Definition: SingleCellIterator.h:14