All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Time.cpp
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 The plumed team
3  (see the PEOPLE file at the root of the distribution for a list of names)
4 
5  See http://www.plumed-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
8 
9  plumed is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  plumed is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 #include "core/ActionWithValue.h"
23 #include "core/ActionRegister.h"
24 #include <string>
25 #include <cmath>
26 
27 using namespace std;
28 
29 namespace PLMD{
30 namespace generic{
31 
32 //+PLUMEDOC GENERIC TIME
33 /*
34 retrieve the time of the simulation to be used elsewere
35 
36 \par Examples
37 
38 \verbatim
39 TIME LABEL=t1
40 PRINT ARG=t1
41 \endverbatim
42 (See also \ref PRINT).
43 
44 */
45 //+ENDPLUMEDOC
46 
47 class Time : public ActionWithValue {
48 public:
49  static void registerKeywords( Keywords& keys );
50  Time(const ActionOptions&);
51 // active methods:
52  virtual void calculate();
53  virtual void apply(){}
54 };
55 
56 PLUMED_REGISTER_ACTION(Time,"TIME")
57 
58 void Time::registerKeywords( Keywords& keys ){
59  Action::registerKeywords( keys );
60  ActionWithValue::registerKeywords( keys );
61 }
62 
63 Time::Time(const ActionOptions&ao):
64 Action(ao),ActionWithValue(ao)
65 {
67  // resize derivative by hand to a nonzero value
69 }
70 
72  setValue (getTime());
73 }
74 
75 }
76 
77 
78 
79 
80 
81 }
void setNotPeriodic()
Set your default value to have no periodicity.
virtual void calculate()
Calculate an Action.
Definition: Time.cpp:71
Value * getPntrToValue()
Get a pointer to the default value.
STL namespace.
void addValueWithDerivatives()
Add a value with the name label that has derivatives.
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
This class holds the keywords and their documentation.
Definition: Keywords.h:36
virtual void apply()
Apply an Action.
Definition: Time.cpp:53
This class is used to bring the relevant information to the Action constructor.
Definition: Action.h:41
double getTime() const
Return the present time.
Definition: Action.cpp:173
Base class for all the input Actions.
Definition: Action.h:60
void setValue(const double &d)
Set the default value (the one without name)
void resizeDerivatives(int n)
Set the number of derivatives.
Definition: Value.h:218
Provides the keyword TIME
Definition: Time.cpp:47