ls1-MarDyn
ls1-MarDyn molecular dynamics code
ResortCellProcessorSliced.h
1/*
2 * ResortCellProcessorSliced.h
3 *
4 * Created on: 10 Oct 2017
5 * Author: tchipevn
6 */
7
8#ifndef SRC_PARTICLECONTAINER_RESORTCELLPROCESSORSLICED_H_
9#define SRC_PARTICLECONTAINER_RESORTCELLPROCESSORSLICED_H_
10
11#include "adapter/CellProcessor.h"
12#include "LinkedCells.h"
13
14// special update cell processor for the REDUCED_MEMORY_MODE
15// to be used only when the SLICED traversal is being used.
16
18public:
20 CellProcessor(0.0, 0.0), _container(container) {
21 // allocate threadData
22 _threadData.resize(mardyn_get_max_threads());
23 #if defined(_OPENMP)
24 #pragma omp parallel
25 #endif
26 {
27 ThreadData * myown = new ThreadData();
28 const int myid = mardyn_get_thread_num();
29 _threadData[myid] = myown;
30 } // end pragma omp parallel
31
32 }
34 // free threadData
35 #if defined(_OPENMP)
36 #pragma omp parallel
37 #endif
38 {
39 const int myid = mardyn_get_thread_num();
40 delete _threadData[myid];
41 }
42 };
43 void initTraversal() {}
47 // get leaving molecules
48 std::vector<Molecule>& b = _threadData[mardyn_get_thread_num()]->_buffer;
49
50 cell.getLeavingMolecules(b);
51
52 // add leaving molecules
53 for (auto & mol : b) {
54 _container->addParticle(mol);
55 }
56 b.clear();
57 }
58 double processSingleMolecule(Molecule*, ParticleCell& ) { return 0.0;}
60 void endTraversal() {}
61private:
62 class ThreadData {
63 public:
64 ThreadData() {
65 _buffer.reserve(2);
66 }
67 std::vector<Molecule> _buffer;
68 };
69
70 std::vector<ThreadData * > _threadData;
71
72 LinkedCells * _container;
73
74};
75
76#endif /* SRC_PARTICLECONTAINER_RESORTCELLPROCESSORSLICED_H_ */
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
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
Definition: ResortCellProcessorSliced.h:17
void postprocessCell(ParticleCell &)
Definition: ResortCellProcessorSliced.h:59
void processCell(ParticleCell &cell)
Definition: ResortCellProcessorSliced.h:46
void endTraversal()
Definition: ResortCellProcessorSliced.h:60
void processCellPair(ParticleCell &, ParticleCell &, bool)
Definition: ResortCellProcessorSliced.h:45
void initTraversal()
Definition: ResortCellProcessorSliced.h:43
void preprocessCell(ParticleCell &)
Definition: ResortCellProcessorSliced.h:44
typedef::xsd::cxx::tree::type container
Alias for the anyType type.
Definition: vtk-punstructured.h:130