OpenMPCD
CUDA/MPCFluid/Instrumentation/Base.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines the OpenMPCD::CUDA::MPCFluid::Instrumentation::Base class.
4  */
5 
6 #ifndef OPENMPCD_CUDA_MPCFLUID_INSTRUMENTATION_BASE_HPP
7 #define OPENMPCD_CUDA_MPCFLUID_INSTRUMENTATION_BASE_HPP
8 
14 
15 #include <string>
16 
17 namespace OpenMPCD
18 {
19 namespace CUDA
20 {
21 namespace MPCFluid
22 {
23 
24 class Base;
25 
26 /**
27  * Namespace for instrumentation classes for MPC fluids.
28  */
29 namespace Instrumentation
30 {
31  /**
32  * Base class for MPC fluids instrumentation.
33  */
34  class Base
35  {
36  protected:
37  /**
38  * The constructor.
39  *
40  * @param[in] config
41  * The simulation configuration.
42  *
43  * @param[in] mpcFluid
44  * The fluid to measure.
45  */
47  const Configuration& config,
48  const CUDA::MPCFluid::Base* const mpcFluid)
53  {
55  {
58  config, mpcFluid);
59  }
61  {
63  new NormalModeAutocorrelation(config, mpcFluid);
64  }
65  }
66 
67  private:
68  Base(const Base&); ///< The copy constructor.
69 
70  public:
71  /**
72  * The destructor.
73  */
74  virtual ~Base()
75  {
80  }
81 
82  public:
83  /**
84  * Performs measurements.
85  */
86  void measure()
87  {
90 
93 
96 
99 
100  measureSpecific();
101  }
102 
103  /**
104  * Saves the data to the given run directory.
105  * @param[in] rundir The path to the run directory.
106  */
107  void save(const std::string& rundir) const
108  {
111 
114 
117 
119  velocityAutocorrelation->save(rundir);
120 
121  saveSpecific(rundir);
122  }
123 
124  /**
125  * Returns the `LogicalEntityMeanSquareDisplacement` instance, or
126  * `nullptr` if none was configured.
127  */
130  {
132  }
133 
134  /**
135  * Returns the `NormalModeAutocorrelation` instance, or `nullptr` if
136  * none was configured.
137  */
140  {
142  }
143 
144  protected:
145  /**
146  * Performs measurements specific to the fluid type.
147  */
148  virtual void measureSpecific() = 0;
149 
150  /**
151  * Saves measurements specific to the fluid type.
152  * @param[in] rundir The path to the run directory.
153  */
154  virtual void saveSpecific(const std::string& rundir) const = 0;
155 
156  private:
157  Base& operator=(const Base&); ///< The assignment operator.
158 
159  protected:
160  FourierTransformedVelocity::Base* fourierTransformedVelocity; ///< Measures Fourier-transformed velocities.
161 
164  /**< Measures the mean square displacement of the centers of
165  mass of the logical entities of the fluid.*/
166 
168  ///< Measures the autocorrelation of normal mode coordinates.
169  VelocityAutocorrelation::Base* velocityAutocorrelation; ///< Measures velocity autocorrelation.
170  };
171 } //namespace Instrumentation
172 } //namespace MPCFluid
173 } //namespace CUDA
174 } //namespace OpenMPCD
175 
176 #endif
Base.hpp
OpenMPCD::CUDA::MPCFluid::Base
Base class for MPC fluids.
Definition: CUDA/MPCFluid/Base.hpp:40
OpenMPCD::Configuration
Represents the configuration of the simulation.
Definition: Configuration.hpp:28
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::measure
void measure()
Performs measurements.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:86
Base.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::NormalModeAutocorrelation::measure
void measure()
Takes measurement data.
Definition: NormalModeAutocorrelation.cpp:106
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::save
void save(const std::string &rundir) const
Saves the data to the given run directory.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:107
OpenMPCD::CUDA::MPCFluid::Instrumentation::NormalModeAutocorrelation
Measures the autocorrelation of normal coordinates in linear polymers.
Definition: NormalModeAutocorrelation.hpp:97
NormalModeAutocorrelation.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::fourierTransformedVelocity
FourierTransformedVelocity::Base * fourierTransformedVelocity
Measures Fourier-transformed velocities.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:160
OpenMPCD::CUDA::MPCFluid::Instrumentation::LogicalEntityMeanSquareDisplacement::isConfigured
static bool isConfigured(const Configuration &config)
Returns whether the an attempt has been made to configure this class, i.e.
OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::save
void save(const std::string &rundir) const
Saves the data to the given run directory.
OpenMPCD::CUDA::MPCFluid::Instrumentation::LogicalEntityMeanSquareDisplacement::measure
void measure()
Takes measurement data.
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::getLogicalEntityMeanSquareDisplacement
const LogicalEntityMeanSquareDisplacement * getLogicalEntityMeanSquareDisplacement() const
Returns the LogicalEntityMeanSquareDisplacement instance, or nullptr if none was configured.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:129
OpenMPCD::CUDA::MPCFluid::Instrumentation::NormalModeAutocorrelation::isConfigured
static bool isConfigured(const Configuration &config)
Returns whether the an attempt has been made to configure this class, i.e.
Definition: NormalModeAutocorrelation.cpp:68
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::logicalEntityMeanSquareDisplacement
LogicalEntityMeanSquareDisplacement * logicalEntityMeanSquareDisplacement
Measures the mean square displacement of the centers of mass of the logical entities of the fluid.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:163
OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base::measure
void measure()
Performs measurements.
LogicalEntityMeanSquareDisplacement.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::FourierTransformedVelocity::Base::save
virtual void save(const std::string &rundir) const
Saves the data to the given run directory.
Definition: Base.cpp:31
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::measureSpecific
virtual void measureSpecific()=0
Performs measurements specific to the fluid type.
OpenMPCD::CUDA::Instrumentation
Class doing measurements in a CUDA simulation.
Definition: Instrumentation.hpp:26
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::normalModeAutocorrelation
NormalModeAutocorrelation * normalModeAutocorrelation
Measures the autocorrelation of normal mode coordinates.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:167
OpenMPCD::CUDA::MPCFluid::Instrumentation::FourierTransformedVelocity::Base
Base class for measurements of Fourier-transformed velocities in MPC fluids.
Definition: CUDA/MPCFluid/Instrumentation/FourierTransformedVelocity/Base.hpp:40
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base
Base class for MPC fluids instrumentation.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:34
OpenMPCD::CUDA::MPCFluid::Instrumentation::FourierTransformedVelocity::Base::measure
virtual void measure()=0
Performs measurements.
OpenMPCD::CUDA::MPCFluid::Instrumentation::NormalModeAutocorrelation::save
void save(std::ostream &stream)
Saves the result to the given stream.
Definition: NormalModeAutocorrelation.cpp:201
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::Base
Base(const Configuration &config, const CUDA::MPCFluid::Base *const mpcFluid)
The constructor.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:46
OpenMPCD::CUDA::MPCFluid::Instrumentation::VelocityAutocorrelation::Base
Base class for measurements of velocity autocorrelation in MPC fluids.
Definition: CUDA/MPCFluid/Instrumentation/VelocityAutocorrelation/Base.hpp:110
Configuration.hpp
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::saveSpecific
virtual void saveSpecific(const std::string &rundir) const =0
Saves measurements specific to the fluid type.
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::~Base
virtual ~Base()
The destructor.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:74
OpenMPCD::CUDA::MPCFluid::Instrumentation::LogicalEntityMeanSquareDisplacement
Measures the mean square displacement of logical entities in an MPC fluid.
Definition: LogicalEntityMeanSquareDisplacement.hpp:86
OpenMPCD::CUDA::MPCFluid::Instrumentation::LogicalEntityMeanSquareDisplacement::save
void save(std::ostream &stream)
Saves the result to the given stream.
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::getNormalModeAutocorrelation
const NormalModeAutocorrelation * getNormalModeAutocorrelation() const
Returns the NormalModeAutocorrelation instance, or nullptr if none was configured.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:139
OpenMPCD::CUDA::MPCFluid::Instrumentation::Base::velocityAutocorrelation
VelocityAutocorrelation::Base * velocityAutocorrelation
Measures velocity autocorrelation.
Definition: CUDA/MPCFluid/Instrumentation/Base.hpp:169