XdmfTime.hpp 4.59 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
#ifndef XDMFTIME_HPP_
#define XDMFTIME_HPP_

27
// C Compatible Includes
28
#include "Xdmf.hpp"
29 30
#include "XdmfItem.hpp"

31 32
#ifdef __cplusplus

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

40
public:
41

42 43 44
  /**
   * Create a new XdmfTime.
   *
45 46 47 48
   * Example of use:
   *
   * C++
   *
49
   * @dontinclude ExampleXdmfTime.cpp
50 51
   * @skipline //#initialization
   * @until //#initialization
52 53 54
   *
   * Python
   *
55
   * @dontinclude XdmfExampleTime.py
56 57
   * @skipline #//initialization
   * @until #//initialization
58
   *
59 60
   * @param     value   The timeValue of the XdmfTime to create.
   * @return            The new XdmfTime.
61
   */
62
  static shared_ptr<XdmfTime> New(const double & value = 0);
63

64
  virtual ~XdmfTime();
65

66
  LOKI_DEFINE_VISITABLE(XdmfTime, XdmfItem)
67
  static const std::string ItemTag;
68

69
  std::map<std::string, std::string> getItemProperties() const;
70

71
  std::string getItemTag() const;
72

73 74 75
  /**
   * Get the time value associated with this XdmfTime.
   *
76 77 78 79
   * Example of use:
   *
   * C++
   *
80
   * @dontinclude ExampleXdmfTime.cpp
81 82 83 84
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#getValue
   * @until //#getValue
85 86 87
   *
   * Python
   *
88
   * @dontinclude XdmfExampleTime.py
89 90 91 92
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//getValue
   * @until #//getValue
93
   *
94
   * @return    A double containing the time value.
95 96
   */
  double getValue() const;
97

98 99 100
  /**
   * Set the time value associated with this XdmfTime.
   *
101 102 103 104
   * Example of use:
   *
   * C++
   *
105
   * @dontinclude ExampleXdmfTime.cpp
106 107 108 109
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setValue
   * @until //#setValue
110 111 112
   *
   * Python
   *
113
   * @dontinclude XdmfExampleTime.py
114 115 116 117
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setValue
   * @until #//setValue
118
   *
119
   * @param     time    A double containing the time value.
120 121
   */
  void setValue(const double & time);
122

123 124
  XdmfTime(XdmfTime &);

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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
#endif

#ifdef __cplusplus
extern "C" {
#endif

// C wrappers go here

struct XDMFTIME; // Simply as a typedef to ensure correct typing
typedef struct XDMFTIME XDMFTIME;

XDMF_EXPORT XDMFTIME * XdmfTimeNew(double value);

XDMF_EXPORT double XdmfTimeGetValue(XDMFTIME * timePointer);

XDMF_EXPORT void XdmfTimeSetValue(XDMFTIME * timePointer, double time);

XDMF_ITEM_C_CHILD_DECLARE(XdmfTime, XDMFTIME, XDMF)

#ifdef __cplusplus
}
#endif

165
#endif /* XDMFTIME_HPP_ */