ls1-MarDyn
ls1-MarDyn molecular dynamics code
SpatialProfile.h
1//
2// Created by Kruegener on 8/19/2018.
3//
4
5#ifndef MARDYN_TRUNK_SPATIALPROFILE_H
6#define MARDYN_TRUNK_SPATIALPROFILE_H
7
8#include <functional>
9#include <optional>
10#include <vector>
11
12#include <plugins/profiles/ProfileBase.h>
13#include "PluginBase.h"
14#include "Domain.h"
15#include "parallel/DomainDecompBase.h"
16#include "particleContainer/ParticleContainer.h"
17
18
19class ProfileBase;
20
21class DensityProfile;
22
24
26
27class KineticProfile;
28
29class DOFProfile;
30
32
33class VirialProfile;
34
35class Virial2DProfile;
36
37
73class SpatialProfile : public PluginBase {
74
75public:
76
77 void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override;
78
79 void readXML(XMLfileUnits& xmlconfig) override;
80
81 void endStep(
82 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
83 Domain* domain, unsigned long simstep) override;
84
85 void finish(ParticleContainer* particleContainer,
86 DomainDecompBase* domainDecomp, Domain* domain) override {};
87
88 unsigned long getCartesianUID(ParticleIterator& thismol);
89
90 long getCylUID(ParticleIterator& thismol);
91
92 std::string getPluginName() override { return std::string("SpatialProfile"); }
93
94 static PluginBase* createInstance() { return new SpatialProfile(); }
95
96 SamplingInformation samplInfo;
97
98 void accessAllCallbacks(const std::map<std::string, FunctionWrapper>& callbackMap) override {
99 // Accesses a callback registered by FixRegion. It returns the number of molecules in the fixregion.
100 std::string name{"FixRegion::getMoleculesInRegion"};
101 if(callbackMap.find(name) != callbackMap.end()) {
102 getNumFixRegion = callbackMap.at(name).get<unsigned long>();
103 }
104 }
105
106private:
107
108 // Profile pointers for data reuse
109 DensityProfile* _densProfile;
110 VelocityAbsProfile* _velAbsProfile;
111 Velocity3dProfile* _vel3dProfile;
112 TemperatureProfile* _tempProfile;
113 DOFProfile* _dofProfile;
114 KineticProfile* _kineticProfile;
115 VirialProfile* _virialProfile;
116 Virial2DProfile* _virial2DProfile;
117
118 unsigned long _writeFrequency; // Write frequency for all profiles -> Length of recording frame before output
119 unsigned long _initStatistics; // Timesteps to skip at start of the simulation
120 unsigned long _profileRecordingTimesteps; // Record every Nth timestep during recording frame
121 long _accumulatedDatasets; // Number of Datasets between output writes / profile resets
122 std::string _outputPrefix; // File prefix for all profiles
123 std::string _mode;
124 std::string _profiledCompString;
125 unsigned int _profiledComp;
126
127
128 unsigned long _uIDs;
129
130 std::vector<ProfileBase*> _profiles; // vector holding all enabled profiles
131 int _comms = 0; // total number of communications per bin needed by all profiles.
132
133 // Needed for XML check for enabled profiles.
134 bool _ALL = false;
135 bool _DENSITY = false;
136 bool _VELOCITY = false;
137 bool _VELOCITY3D = false;
138 bool _TEMPERATURE = false;
139 bool _VIRIAL = false;
140 bool _VIRIAL2D = false;
141
142 void addProfile(ProfileBase* profile);
143
144 std::optional<std::function<unsigned long(void)>> getNumFixRegion;
145
146};
147
148
149#endif //MARDYN_TRUNK_SPATIALPROFILE_H
Records (NO OUTPUT) the DOF of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: DOFProfile.h:15
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
This class is used to read in the phasespace and to handle macroscopic values.
Definition: Domain.h:47
Records (NO OUTPUT) the 2xKinetic Profile of molecules per bin specified by Sampling grid in Kartesia...
Definition: KineticProfile.h:14
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
Definition: ParticleIterator.h:50
The PluginBase class provides the interface for any kind of output/plugin classes - called "(output) ...
Definition: PluginBase.h:47
Base class for all Profile outputs used by KartesianProfile.
Definition: ProfileBase.h:34
SpatialProfile is a Plugin that is called like any other plugin derived from PluginBase....
Definition: SpatialProfile.h:73
std::string getPluginName() override
return the name of the plugin
Definition: SpatialProfile.h:92
long getCylUID(ParticleIterator &thismol)
getCylUID samples the domain in cylinder coordinate bins.
Definition: SpatialProfile.cpp:364
void accessAllCallbacks(const std::map< std::string, FunctionWrapper > &callbackMap) override
Definition: SpatialProfile.h:98
void endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) override
Iterates over all molecules and passes them together with their Bin ID to the profiles for further pr...
Definition: SpatialProfile.cpp:233
unsigned long getCartesianUID(ParticleIterator &thismol)
getCartesianUID samples the domain cartesian coordinate bins.
Definition: SpatialProfile.cpp:339
void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Initialize Arrays needed for calculating the profiles. Also get reference to domain for specific quan...
Definition: SpatialProfile.cpp:146
void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method finish will be called at the end of the simulation.
Definition: SpatialProfile.h:85
void readXML(XMLfileUnits &xmlconfig) override
Read in Information about write/record frequencies, Sampling Grid and which profiles are enabled....
Definition: SpatialProfile.cpp:22
Outputs the temperature of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: TemperatureProfile.h:17
Outputs the XYZ velocity components per bin specified by Sampling grid in KartesianProfile.
Definition: Velocity3dProfile.h:18
Outputs the magnitude of the velocity per bin specified by Sampling grid in KartesianProfile.
Definition: VelocityAbsProfile.h:16
Definition: Virial2DProfile.h:17
Definition: VirialProfile.h:20
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::name< char, token > name
C++ type corresponding to the Name XML Schema built-in type.
Definition: vtk-punstructured.h:288
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
Definition: ProfileBase.h:13