ls1-MarDyn
ls1-MarDyn molecular dynamics code
LeafNodesContainer.h
1/*
2 * LeafNodesContainer.h
3 *
4 * Created on: Feb 6, 2015
5 * Author: tchipev
6 *
7 * A bare-bones secondary Linked-Cells structure to allow
8 * carrying out P2P, P2M, L2P operations when the tree is deeper
9 * than what would be allowed by the Lennard-Jones cutoff radius.
10 *
11 * Assumption: there is an LJ Linked-Cells structure with cells bigger or equal than these.
12 */
13
14#ifndef LEAFNODESCONTAINER_H_
15#define LEAFNODESCONTAINER_H_
16
17#include "bhfmm/containers/ParticleCellPointers.h"
18#include <vector>
19
20namespace bhfmm {
21
22class SimpleCellProcessor;
23class VectorizedChargeP2PCellProcessor;
24
26public:
27 LeafNodesContainer(double bBoxMin[3],
28 double bBoxMax[3],
29 double LJCellLength[3],
30 unsigned subdivisionFactor,
31 bool periodic = true
32#ifdef QUICKSCHED
33 , qsched* scheduler = nullptr
34#endif
35 );
36
38
39 double* getCellLength() {
40 return _cellLength;
41 }
42
43 void addParticle(Molecule& particle);
44 void clearParticles();
45 void traverseCells(SimpleCellProcessor& cellProcessor);
46 void traverseCellPairs(VectorizedChargeP2PCellProcessor& cellProcessor);
47 void traverseCellPairsOrig(VectorizedChargeP2PCellProcessor& cellProcessor);
48 void traverseCellPairsC08(VectorizedChargeP2PCellProcessor& cellProcessor);
49
50 const int *getNumCellsPerDimension() const;
51
52 std::vector<ParticleCellPointers> & getCells();
53
54 long int cellIndexOf3DIndex(int xIndex, int yIndex, int zIndex) const;
55
56 void c08Step(long int baseIndex, VectorizedChargeP2PCellProcessor &cellProcessor);
57
58private:
59 void initializeCells();
60 void calculateNeighbourIndices();
61 void calculateCellPairOffsets();
62 unsigned long int getCellIndexOfMolecule(Molecule* molecule) const;
64 void threeDIndexOfCellIndex(int ind, int r[3], int dim[3]) const;
65
66 bool _periodicBC;
67
68 double _boundingBoxMin[3];
69 double _boundingBoxMax[3];
70 double _haloBoundingBoxMin[3];
71 double _haloBoundingBoxMax[3];
72 double _cellLength[3];
73 int _numInnerCellsPerDimension[3];
74 int _numCellsPerDimension[3];
75 std::vector<ParticleCellPointers> _cells;
76 std::vector<unsigned long> _forwardNeighbourOffsets;
77 std::vector<unsigned long> _backwardNeighbourOffsets;
78 unsigned _maxNeighbourOffset;
79 unsigned _minNeighbourOffset;
80
81 // addition for compact SimpleMD-style traversal
82 std::vector<std::pair<unsigned long, unsigned long> > _cellPairOffsets;
83
84 unsigned int _numActiveColours;
85 std::vector<std::vector<long int> > _cellIndicesPerColour;
86
87#ifdef QUICKSCHED
88 struct qsched *_scheduler;
89#endif
90};
91
92} /* namespace bhfmm */
93
94#endif /* LEAFNODESCONTAINER_H_ */
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
Definition: LeafNodesContainer.h:25
Definition: SimpleCellProcessor.h:23
Vectorized calculation of the force.
Definition: VectorizedChargeP2PCellProcessor.h:32
Definition: L2PCellProcessor.cpp:15