XdmfAttribute.hpp 7.22 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 : XdmfAttribute.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.                                                 */
/*                                                                           */
/*****************************************************************************/

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
24 25 26
#ifndef XDMFATTRIBUTE_HPP_
#define XDMFATTRIBUTE_HPP_

27 28 29 30
// Forward Declarations
class XdmfAttributeCenter;
class XdmfAttributeType;

Ken Leiter (Civ ARL/CISD) kleiter's avatar
Ken Leiter (Civ ARL/CISD) kleiter committed
31
// Includes
32
#include "Xdmf.hpp"
33
#include "XdmfArray.hpp"
34

35
/**
36
 * @brief Holds values located at specific parts of an XdmfGrid.
37
 *
38 39 40 41 42
 * XdmfAttribute holds values centered at specific locations of an
 * XdmfGrid. An attribute contains two properties that should be set,
 * XdmfAttributeCenter, which describes where the values are centered,
 * and XdmfAttributeType, which describes what types of values the
 * attribute contains.
43
 */
44
class XDMF_EXPORT XdmfAttribute : public XdmfArray {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
45

46
public:
47 48 49 50

  /**
   * Create a new XdmfAttribute.
   *
51 52 53 54
   * Example of use:
   *
   * C++
   *
55
   * @dontinclude ExampleXdmfAttribute.cpp
56 57
   * @skipline //#initialization
   * @until //#initialization
58 59 60
   *
   * Python
   *
61
   * @dontinclude XdmfExampleAttribute.py
62 63
   * @skipline #//initialization
   * @until #//initialization
64
   *
65
   * @return    Constructed XdmfAttribute.
66
   */
67
  static shared_ptr<XdmfAttribute> New();
68 69 70 71 72 73 74 75 76

  virtual ~XdmfAttribute();

  LOKI_DEFINE_VISITABLE(XdmfAttribute, XdmfArray);
  static const std::string ItemTag;

  /**
   * Get the XdmfAttributeCenter associated with this attribute.
   *
77 78 79 80
   * Example of use:
   *
   * C++
   *
81
   * @dontinclude ExampleXdmfAttribute.cpp
82 83 84 85 86 87
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setCenter
   * @until //#setCenter
   * @skipline //#getCenter
   * @until //#getCenter
88 89 90
   *
   * Python
   *
91
   * @dontinclude XdmfExampleAttribute.py
92 93 94 95 96 97
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setCenter
   * @until #//setCenter
   * @skipline #//getCenter
   * @until #//getCenter
98
   *
99
   * @return    XdmfAttributeCenter of the attribute.
100
   */
101
  shared_ptr<const XdmfAttributeCenter> getCenter() const;
102 103 104 105 106 107 108 109

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

  std::string getItemTag() const;

  /**
   * Get the name of the attribute.
   *
110 111 112 113
   * Example of use:
   *
   * C++
   *
114
   * @dontinclude ExampleXdmfAttribute.cpp
115 116 117 118 119 120
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setName
   * @until //#setName
   * @skipline //#getName
   * @until //#getName
121 122 123
   *
   * Python
   *
124
   * @dontinclude XdmfExampleAttribute.py
125 126 127 128 129 130
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setName
   * @until #//setName
   * @skipline #//getName
   * @until #//getName
131
   *
132
   * @return    A string containing the name of the attribute.
133 134 135 136 137 138
   */
  std::string getName() const;

  /**
   * Get the XdmfAttributeType associated with this attribute.
   *
139 140 141 142
   * Example of use:
   *
   * C++
   *
143
   * @dontinclude ExampleXdmfAttribute.cpp
144 145 146 147 148 149
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setType
   * @until //#setType
   * @skipline //#getType
   * @until //#getType
150 151 152
   *
   * Python
   *
153
   * @dontinclude XdmfExampleAttribute.py
154 155 156 157 158 159
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setType
   * @until #//setType
   * @skipline #//getType
   * @until #//getType
160
   *
161
   * @return    XdmfAttributeType of the attribute.
162
   */
163
  shared_ptr<const XdmfAttributeType> getType() const;
164 165 166 167

  /**
   * Set the XdmfAttributeCenter associated with this attribute.
   *
168 169 170 171
   * Example of use:
   *
   * C++
   *
172
   * @dontinclude ExampleXdmfAttribute.cpp
173 174 175 176
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setCenter
   * @until //#setCenter
177 178 179
   *
   * Python
   *
180
   * @dontinclude XdmfExampleAttribute.py
181 182 183 184
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setCenter
   * @until #//setCenter
185
   *
186
   * @param     center  The XdmfAttributeCenter to set.
187
   */
188
  void setCenter(const shared_ptr<const XdmfAttributeCenter> center);
189 190 191 192

  /**
   * Set the name of the attribute.
   *
193 194 195 196
   * Example of use:
   *
   * C++
   *
197
   * @dontinclude ExampleXdmfAttribute.cpp
198 199 200 201
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setName
   * @until //#setName
202 203 204
   *
   * Python
   *
205
   * @dontinclude XdmfExampleAttribute.py
206 207 208 209
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setName
   * @until #//setName
210
   *
211
   * @param     name    A string containing the name to set.
212 213 214 215 216 217
   */
  void setName(const std::string & name);

  /**
   * Set the XdmfAttributeType associated with this attribute.
   *
218 219 220 221
   * Example of use:
   *
   * C++
   *
222
   * @dontinclude ExampleXdmfAttribute.cpp
223 224 225 226
   * @skipline //#initialization
   * @until //#initialization
   * @skipline //#setType
   * @until //#setType
227 228 229
   *
   * Python
   *
230
   * @dontinclude XdmfExampleAttribute.py
231 232 233 234
   * @skipline #//initialization
   * @until #//initialization
   * @skipline #//setType
   * @until #//setType
235
   *
236
   * @param     type    XdmfAttributeType to set.
237
   */
238
  void setType(const shared_ptr<const XdmfAttributeType> type);
239

240
protected:
241 242 243 244 245

  XdmfAttribute();

  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
246
               const std::vector<shared_ptr<XdmfItem> > & childItems,
247 248
               const XdmfCoreReader * const reader);

249
private:
250 251 252 253

  XdmfAttribute(const XdmfAttribute &);  // Not implemented.
  void operator=(const XdmfAttribute &);  // Not implemented.

254
  shared_ptr<const XdmfAttributeCenter> mCenter;
255
  std::string mName;
256
  shared_ptr<const XdmfAttributeType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
257 258
};

259
#ifdef _WIN32
260
XDMF_TEMPLATE template class XDMF_EXPORT
261
shared_ptr<const XdmfAttributeType>;
262
XDMF_TEMPLATE template class XDMF_EXPORT
263
shared_ptr<const XdmfAttributeCenter>;
264 265
#endif

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
266
#endif /* XDMFATTRIBUTE_HPP_ */