ls1-MarDyn
ls1-MarDyn molecular dynamics code
Velocity3dProfile.h
1//
2// Created by Kruegener on 8/27/2018.
3//
4
5#ifndef MARDYN_TRUNK_VELOCITYPROFILE_H
6#define MARDYN_TRUNK_VELOCITYPROFILE_H
7
8#include "ProfileBase.h"
9#include "plugins/SpatialProfile.h"
10
11#include <array>
12
13class DensityProfile;
14
18class Velocity3dProfile final : public ProfileBase {
19public:
21 _densityProfile(densProf), _local3dProfile(), _global3dProfile() {
22 }
23 ~~Velocity3dProfile() final = default;
24 void record(Molecule &mol, unsigned long uID) final {
25 for(unsigned short d = 0; d < 3; d++){
26 _local3dProfile[uID][d] += mol.v(d);
27 }
28 }
29 void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final {
30 for(unsigned short d = 0; d < 3; d++){
31 domainDecomp->collCommAppendDouble(_local3dProfile[uID][d]);
32 }
33 }
34 void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final {
35 for(unsigned short d = 0; d < 3; d++){
36 _global3dProfile[uID][d] = domainDecomp->collCommGetDouble();
37 }
38 }
39 void output(string prefix, long unsigned accumulatedDatasets) final;
40 void reset(unsigned long uID) final {
41 for(unsigned d = 0; d < 3; d++){
42 _local3dProfile[uID][d] = 0.0;
43 _global3dProfile[uID][d] = 0.0;
44 }
45 }
46 // set correct number of communications needed for this profile
47 int comms() final {return 3;}
48
49private:
50 DensityProfile * _densityProfile;
51
52 // Local 3D Profile
53 std::map<unsigned, std::array<double,3>> _local3dProfile;
54 // Global 3D Profile
55 std::map<unsigned, std::array<double,3>> _global3dProfile;
56
57 void writeDataEntry(unsigned long uID, ofstream &outfile) const final;
58};
59
60
61#endif //MARDYN_TRUNK_VELOCITYPROFILE_H
Outputs the number density of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: DensityProfile.h:14
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
Outputs the XYZ velocity components per bin specified by Sampling grid in KartesianProfile.
Definition: Velocity3dProfile.h:18
int comms() final
1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per b...
Definition: Velocity3dProfile.h:47
void output(string prefix, long unsigned accumulatedDatasets) final
Whatever is necessary to output for this profile.
Definition: Velocity3dProfile.cpp:9
void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final
Get global values after AllReduceSum per bin. Write to e.g. _globalProfile.
Definition: Velocity3dProfile.h:34
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: Velocity3dProfile.h:40
void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final
Append all necessary communication per bin to the DomainDecomposition. Append from e....
Definition: Velocity3dProfile.h:29
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: Velocity3dProfile.h:24