ls1-MarDyn
ls1-MarDyn molecular dynamics code
MaxCheck.h
1/*
2 * MaxCheck.h
3 *
4 * Created on: 28.05.2018
5 * Author: mheinen
6 */
7
8#ifndef MAXCHECK_H_
9#define MAXCHECK_H_
10
11#include "PluginBase.h"
12
13#include <string>
14#include <map>
15#include <unordered_map>
16#include <list>
17#include <cstdint>
18#include <vector>
19#include <array>
20
21#include "molecules/MoleculeForwardDeclaration.h"
22
23class MaxCheck : public PluginBase
24{
25private:
26 enum MaxCheckMethods
27 {
28 MCM_UNKNOWN = 0,
29 MCM_LIMIT_TO_MAX_VALUE = 1,
30 MCM_LIMIT_TO_MAX_VALUE_OVERLAPS = 2,
31 MCM_DELETE_PARTICLES = 3
32 };
33
34 struct TimestepControl
35 {
36 uint64_t start;
37 uint64_t freq;
38 uint64_t stop;
39 };
40
41 struct MaxVals
42 {
43 double F;
44 double F2;
45 double v;
46 double v2;
47 double M;
48 double M2;
49 double L;
50 double L2;
51 uint32_t method;
52 };
53 typedef std::unordered_map<uint32_t, MaxVals> maxvals_map;
54
55public:
56 // constructor and destructor
57 MaxCheck();
58 ~~MaxCheck();
59
86 void readXML(XMLfileUnits& xmlconfig) override;
87
88 void init(ParticleContainer *particleContainer,
89 DomainDecompBase *domainDecomp, Domain *domain) override;
90
93 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
94 unsigned long simstep
95 ) override;
96
102 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
103 unsigned long simstep
104 ) override {}
105
110 void afterForces(
111 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
112 unsigned long simstep
113 ) override;
114
116 ParticleContainer *particleContainer,
117 DomainDecompBase *domainDecomp, Domain *domain,
118 unsigned long simstep
119 ) override {}
120
121 void finish(ParticleContainer *particleContainer,
122 DomainDecompBase *domainDecomp, Domain *domain) override {}
123
124 std::string getPluginName() override {return std::string("MaxCheck");}
125 static PluginBase* createInstance() {return new MaxCheck();}
126
127private:
128 double calcSquaredVectorLength(std::array<double,3>& vec) {return (vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);}
129 void checkMaxVals(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, unsigned long simstep);
130 bool moleculeInsideRange(std::array<double,3>& r);
131
132private:
133 TimestepControl _control;
134 maxvals_map _maxVals;
135 std::vector<Molecule*> _deletions;
136 struct Range {double xmin, xmax, ymin, ymax, zmin, zmax; bool inclusive;} _range;
137};
138
139#endif /*MAXCHECK_H_*/
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
Definition: MaxCheck.h:24
void readXML(XMLfileUnits &xmlconfig) override
Read in XML configuration for MaxCheck and all its included objects.
Definition: MaxCheck.cpp:30
std::string getPluginName() override
return the name of the plugin
Definition: MaxCheck.h:124
void beforeEventNewTimestep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep) override
Method will be called first thing in a new timestep.
Definition: MaxCheck.cpp:116
void afterForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep) override
Method afterForces will be called after forcefields have been applied.
Definition: MaxCheck.cpp:127
void siteWiseForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep) override
Method siteWiseForces will be called before forcefields have been applied alterations to sitewise for...
Definition: MaxCheck.h:101
void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method finish will be called at the end of the simulation.
Definition: MaxCheck.h:121
void endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) override
Method endStep will be called at the end of each time step.
Definition: MaxCheck.h:115
void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method init will be called at the begin of the simulation.
Definition: MaxCheck.cpp:25
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
The PluginBase class provides the interface for any kind of output/plugin classes - called "(output) ...
Definition: PluginBase.h:47
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270