XdmfTime.hpp 4.35 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfTime.hpp                                                        */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/

24
25
26
27
#ifndef XDMFTIME_HPP_
#define XDMFTIME_HPP_

// Includes
28
#include "Xdmf.hpp"
29
30
31
#include "XdmfItem.hpp"

/**
32
 * @brief Time specification for an XdmfGrid.
33
 *
34
 * An XdmfTime sets a time value for an XdmfGrid.
35
 */
36
class XDMF_EXPORT XdmfTime : public XdmfItem {
37

38
public:
39

40
41
42
  /**
   * Create a new XdmfTime.
   *
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
   * Example of use:
   *
   * C++
   *
   * //specifying a time
   * double newTime = 5.0;
   * shared_ptr<XdmfTime> exampleTime = XdmfTime::New(newTime);
   * //Or the default case can be used to have time set to 0
   * shared_ptr<XdmfTime> exampleTime2 = XdmfTime::New();
   *
   * Python
   *
   * '''
   * specifying a time
   * '''
   * newTime = 5.0
   * exampleTime = XdmfTime.New(newTime)
   * '''
   * Or the default case can be used to have time set to 0
   * '''
   * exampleTime2 = XdmfTime.New()
   *
65
66
67
   * @param value the timeValue of the XdmfTime to create.
   * @return the new XdmfTime.
   */
68
  static shared_ptr<XdmfTime> New(const double & value = 0);
69

70
  virtual ~XdmfTime();
71

72
73
  LOKI_DEFINE_VISITABLE(XdmfTime, XdmfItem);
  static const std::string ItemTag;
74

75
  std::map<std::string, std::string> getItemProperties() const;
76

77
  std::string getItemTag() const;
78

79
80
81
  /**
   * Get the time value associated with this XdmfTime.
   *
82
83
84
85
86
87
88
89
90
91
92
93
94
95
   * Example of use:
   *
   * C++
   *
   * //Assumming that exampleTime is a shared pointer to an XdmfTime object
   * double readTime = exampleTime->getTime();
   *
   * Python
   *
   * '''
   * Assumming that exampleTime is a shared pointer to an XdmfTime object
   * '''
   * readTime = exampleTime.getTime()
   *
96
97
98
   * @return a double containing the time value.
   */
  double getValue() const;
99

100
101
102
  /**
   * Set the time value associated with this XdmfTime.
   *
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
   * Example of use:
   *
   * C++
   *
   * shared_ptr<XdmfTime> exampleTime = XdmfTime::New();
   * double newTime = 5.0;
   * exampleTime->setValue(newTime);
   * //This sets the exampleTime's value to the value of newTime, which is 5.0.
   *
   * Python
   *
   * exampleTime = XdmfTime.New()
   * newTime = 5.0
   * exampleTime.setValue(newTime)
   * '''
   * This sets the exampleTime's value to the value of newTime, which is 5.0.
   * '''
   *
121
122
123
   * @param time a double containing the time value.
   */
  void setValue(const double & time);
124

125
protected:
126

127
  XdmfTime(const double & value);
128

129
130
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
131
               const std::vector<shared_ptr<XdmfItem> > & childItems,
132
               const XdmfCoreReader * const reader);
133

134
private:
135

136
137
138
139
  XdmfTime(const XdmfTime &);  // Not implemented.
  void operator=(const XdmfTime &);  // Not implemented.

  double mValue;
140
141
142
};

#endif /* XDMFTIME_HPP_ */