OpenMPCD
Instrumentation.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines the OpenMPCD::CUDA::Instrumentation class.
4  */
5 
6 #ifndef OPENMPCD_CUDA_INSTRUMENTATION_HPP
7 #define OPENMPCD_CUDA_INSTRUMENTATION_HPP
8 
11 #include <OpenMPCD/FlowProfile.hpp>
12 #include <OpenMPCD/Graph.hpp>
13 #include <OpenMPCD/Histogram.hpp>
14 #include <OpenMPCD/Types.hpp>
15 
16 #include <boost/scoped_ptr.hpp>
17 
18 namespace OpenMPCD
19 {
20 namespace CUDA
21 {
22 
23 /**
24  * Class doing measurements in a CUDA simulation.
25  */
27 {
28  public:
29  /**
30  * The constructor.
31  * @param[in] sim The simulation to measure.
32  * @param[in] rngSeed_ The seed for the random number generator.
33  * @param[in] gitRevision_ A string containing the git revision, if available.
34  */
36  const Simulation* const sim, const unsigned int rngSeed_,
37  const std::string& gitRevision_);
38 
39  private:
40  Instrumentation(const Instrumentation&); ///< The copy constructor.
41 
42  public:
43  /**
44  * The destructor.
45  */
47 
48  public:
49  /**
50  * Performs measurements on MPC fluids and solutes.
51  */
52  void measure();
53 
54  /**
55  * Sets the autosave flag.
56  * @param[in] rundir The directory to save to.
57  */
58  void setAutosave(const std::string& rundir)
59  {
60  autosave=true;
61  autosave_rundir = rundir;
62  }
63 
64  /**
65  * Saves the data to the given run directory.
66  * @param[in] rundir The path to the run directory.
67  */
68  void save(const std::string& rundir) const;
69 
70  private:
71  /**
72  * Performs measurements on the MPC fluid, if there is one.
73  */
74  void measureMPCFluid();
75 
76  /**
77  * Performs measurements on the MPC solute, if there is one.
78  */
79  void measureMPCSolute();
80 
81  /**
82  * Saves static data to the given run directory.
83  * @param[in] rundir The path to the run directory.
84  */
85  void saveStaticData(const std::string& rundir) const;
86 
87  private:
88  const Instrumentation& operator=(const Instrumentation&); ///< The assignment operator.
89 
90  private:
91  const Simulation* const simulation; ///< The simulation to measure
92  const unsigned int rngSeed; ///< The seed for the random number generator.
93  const std::string gitRevision; ///< The string containing the git revision, if available.
94 
95  const std::string constructionTimeUTC;
96  /**< The UTC time this instance was constructed, as returned by
97  * `OpenMPCD::Utility::HostInformation::getCurrentUTCTimeAsString`.
98  */
99 
100  bool autosave; ///< Whether to save everything on destruction.
101  std::string autosave_rundir; ///< The run directory to save to in case of autosaving.
102 
103  unsigned int measurementCount; ///< The number of measurements that have been made.
104 
105  boost::scoped_ptr<Histogram> velocityMagnitudeHistogram;
106  ///< Histogram for the velocity magnitudes.
107 
108  boost::scoped_ptr<DensityProfile> densityProfile;
109  ///< The mass density profile.
110  boost::scoped_ptr<FlowProfile<MPCParticleVelocityType> > flowProfile;
111  ///< The flow profile.
112 
113  boost::scoped_ptr<Graph> totalFluidVelocityMagnitudeVSTime;
114  /**< Shows the magnitude of the total velocity as a function of
115  time.*/
116 }; //class Instrumentation
117 } //namespace CUDA
118 } //namespace OpenMPCD
119 
120 #endif
FlowProfile.hpp
OpenMPCD::CUDA::Instrumentation::measure
void measure()
Performs measurements on MPC fluids and solutes.
Definition: Instrumentation.cpp:110
Histogram.hpp
DensityProfile.hpp
OpenMPCD::CUDA::Instrumentation::~Instrumentation
~Instrumentation()
The destructor.
Definition: Instrumentation.cpp:104
OpenMPCD::CUDA::Instrumentation::setAutosave
void setAutosave(const std::string &rundir)
Sets the autosave flag.
Definition: Instrumentation.hpp:58
OpenMPCD::CUDA::Instrumentation::Instrumentation
Instrumentation(const Simulation *const sim, const unsigned int rngSeed_, const std::string &gitRevision_)
The constructor.
Definition: Instrumentation.cpp:18
OpenMPCD::CUDA::Simulation
MPCD simulation with Molecular Dynamics on CUDA-capable GPUs.
Definition: CUDA/Simulation.hpp:48
OpenMPCD::CUDA::Instrumentation
Class doing measurements in a CUDA simulation.
Definition: Instrumentation.hpp:26
Simulation.hpp
Types.hpp
Graph.hpp
OpenMPCD::CUDA::Instrumentation::save
void save(const std::string &rundir) const
Saves the data to the given run directory.
Definition: Instrumentation.cpp:120