Simpatico  v1.10
ColVar.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "ColVar.h"
9 
10 namespace McMd
11 {
12 
13  using namespace Util;
14 
15  /*
16  * Default constructor.
17  */
19  {}
20 
21  /*
22  * Default destructor.
23  */
25  {}
26 
27  /*
28  * Return value, compute if necesary.
29  */
30  double ColVar::value()
31  {
32  if (!value_.isSet()) {
33  compute();
34  }
35  return value_.value();
36  }
37 
38  /*
39  * Unset colvar value, i.e., mark as unknown.
40  */
42  { value_.unset(); }
43 
44  /*
45  * Return true iff value is set (i.e., known).
46  */
47  bool ColVar::isSet() const
48  { return value_.isSet(); }
49 
50 }
ColVar()
Constructor.
Definition: ColVar.cpp:18
Utility classes for scientific computation.
Definition: accumulators.mod:1
virtual ~ColVar()
Destructor.
Definition: ColVar.cpp:24
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
virtual double value()
Return current value, compute if not already set.
Definition: ColVar.cpp:30
bool isSet() const
Is the value already set?
Definition: ColVar.cpp:47
void unset()
Unset the stored value (mark as unknown or obsolete).
Definition: ColVar.cpp:41