XdmfAttribute.hpp 4.4 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
ENH:  
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 51 52

  /**
   * Create a new XdmfAttribute.
   *
   * @return constructed XdmfAttribute.
   */
53
  static shared_ptr<XdmfAttribute> New();
54 55 56 57 58 59 60 61 62 63 64

  virtual ~XdmfAttribute();

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

  /**
   * Get the XdmfAttributeCenter associated with this attribute.
   *
   * @return XdmfAttributeCenter of the attribute.
   */
65
  shared_ptr<const XdmfAttributeCenter> getCenter() const;
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82

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

  std::string getItemTag() const;

  /**
   * Get the name of the attribute.
   *
   * @return a string containing the name of the attribute.
   */
  std::string getName() const;

  /**
   * Get the XdmfAttributeType associated with this attribute.
   *
   * @return XdmfAttributeType of the attribute.
   */
83
  shared_ptr<const XdmfAttributeType> getType() const;
84 85 86 87 88 89

  /**
   * Set the XdmfAttributeCenter associated with this attribute.
   *
   * @param center the XdmfAttributeCenter to set.
   */
90
  void setCenter(const shared_ptr<const XdmfAttributeCenter> center);
91 92 93 94 95 96 97 98 99 100 101 102 103

  /**
   * Set the name of the attribute.
   *
   * @param name a string containing the name to set.
   */
  void setName(const std::string & name);

  /**
   * Set the XdmfAttributeType associated with this attribute.
   *
   * @param type XdmfAttributeType to set.
   */
104
  void setType(const shared_ptr<const XdmfAttributeType> type);
105

106
protected:
107 108 109 110 111

  XdmfAttribute();

  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
112
               std::vector<shared_ptr<XdmfItem> > & childItems,
113 114
               const XdmfCoreReader * const reader);

115
private:
116 117 118 119

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

120
  shared_ptr<const XdmfAttributeCenter> mCenter;
121
  std::string mName;
122
  shared_ptr<const XdmfAttributeType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
123 124
};

125
#ifdef _WIN32
126
XDMF_TEMPLATE template class XDMF_EXPORT
127
shared_ptr<const XdmfAttributeType>;
128
XDMF_TEMPLATE template class XDMF_EXPORT
129
shared_ptr<const XdmfAttributeCenter>;
130 131
#endif

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