Simpatico  v1.10
RadialDistribution.h
1 #ifndef UTIL_RADIAL_DISTRIBUTION_H
2 #define UTIL_RADIAL_DISTRIBUTION_H
3 
4 /*
5 * Util Package - C++ Utilities for Scientific Computation
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <util/accumulators/Distribution.h>
12 
13 namespace Util
14 {
15 
22  {
23 
24  public:
25 
30 
37 
44 
45  // base class destructor is fine
46 
52  virtual void readParameters(std::istream& in);
53 
60  void setParam(double max, int nBin);
61 
67  virtual void loadParameters(Serializable::IArchive &ar);
68 
74  virtual void save(Serializable::OArchive &ar);
75 
76 
83  template <class Archive>
84  void serialize(Archive& ar, const unsigned int version);
85 
89  virtual void clear();
90 
94  void beginSnapshot();
95 
101  void setNorm(double norm);
102 
108  void setOutputIntegral(bool outputIntegral);
109 
115  void output(std::ostream& out);
116 
120  long nSnapshot();
121 
122  private:
123 
134  double norm_;
135 
139  long nSnapshot_;
140 
144  bool outputIntegral_;
145 
146  };
147 
148  // Inline methods
149 
150  /*
151  * Get number of snapshots.
152  */
154  { return nSnapshot_; }
155 
156  /*
157  * Serialize this Distribution.
158  */
159  template <class Archive>
160  void RadialDistribution::serialize(Archive& ar, const unsigned int version)
161  {
162  Distribution::serialize(ar, version);
163  ar & norm_;
164  ar & nSnapshot_;
165  ar & outputIntegral_;
166  }
167 
168 }
169 #endif
void setParam(double max, int nBin)
Set parameters and initialize.
void serialize(Archive &ar, const unsigned int version)
Serialize this Distribution to/from an archive.
Definition: Distribution.h:198
void output(std::ostream &out)
Output the distribution to file.
void setOutputIntegral(bool outputIntegral)
Set true to enable output of spatial integral of g(r).
RadialDistribution()
Default constructor.
void serialize(Archive &ar, const unsigned int version)
Serialize this RadialDistribution to/from an archive.
Saving / output archive for binary ostream.
long nSnapshot()
Get number of snapshots.
void setNorm(double norm)
Set the factor used to normalize the RDF before output.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void beginSnapshot()
Mark the beginning of a "snapshot" (i.e., a sampled time step).
Utility classes for scientific computation.
Definition: accumulators.mod:1
RadialDistribution & operator=(const RadialDistribution &other)
Assignment.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
Saving archive for binary istream.
virtual void readParameters(std::istream &in)
Read values of min, max, and nBin from file.
int nBin() const
Get the number of bins.
Definition: Distribution.h:191
Distribution (or histogram) of values for particle separations.
virtual void clear()
Clear all accumulators.
A distribution (or histogram) of values for a real variable.
Definition: Distribution.h:23
double max() const
Get maximum value in range of histogram.
Definition: Distribution.h:179