ls1-MarDyn
ls1-MarDyn molecular dynamics code
DensityProfile.h
1//
2// Created by Kruegener on 8/19/2018.
3//
4
5#ifndef MARDYN_TRUNK_DENSITYPROFILE_H
6#define MARDYN_TRUNK_DENSITYPROFILE_H
7
8#include "ProfileBase.h"
9#include "plugins/SpatialProfile.h"
10
14class DensityProfile final : public ProfileBase {
15public:
16 ~~DensityProfile() final = default;
17 void record(Molecule &mol, unsigned long uID) final {
18 _localProfile[uID] += 1;
19 }
20 void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final {
21 domainDecomp->collCommAppendInt(_localProfile[uID]);
22 }
23 void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final {
24 _globalProfile[uID] = domainDecomp->collCommGetInt();
25 }
26 void output(string prefix, long unsigned accumulatedDatasets) final;
27 void reset(unsigned long uID) final {
28 _localProfile[uID] = 0;
29 _globalProfile[uID] = 0;
30 }
31 int comms() final {return 1;}
32
33 int getGlobalNumber (unsigned long uid) const {
34 return _globalProfile.at(uid);
35 }
36
37private:
38 // Local 1D Profile
39 std::map<unsigned, int> _localProfile;
40 // Global 1D Profile
41 std::map<unsigned, int> _globalProfile;
42
43 void writeDataEntry(unsigned long uID, ofstream &outfile) const final;
44};
45
46
47#endif //MARDYN_TRUNK_DENSITYPROFILE_H
Outputs the number density of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: DensityProfile.h:14
void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final
Append all necessary communication per bin to the DomainDecomposition. Append from e....
Definition: DensityProfile.h:20
int comms() final
1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per b...
Definition: DensityProfile.h:31
void reset(unsigned long uID) final
Used to reset all array contents for a specific uID in order to start the next recording timeframe.
Definition: DensityProfile.h:27
void output(string prefix, long unsigned accumulatedDatasets) final
Whatever is necessary to output for this profile.
Definition: DensityProfile.cpp:8
void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final
Get global values after AllReduceSum per bin. Write to e.g. _globalProfile.
Definition: DensityProfile.h:23
void record(Molecule &mol, unsigned long uID) final
The recording step defines what kind of data needs to be recorded for a single molecule with a corres...
Definition: DensityProfile.h:17
handle boundary region and multiple processes
Definition: DomainDecompBase.h:51
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
Base class for all Profile outputs used by KartesianProfile.
Definition: ProfileBase.h:34