XdmfSet.hpp 4.26 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 : XdmfSet.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 XDMFSET_HPP_
#define XDMFSET_HPP_

27
// Forward Declarations
28
class XdmfAttribute;
29
class XdmfHDF5Controller;
30 31
class XdmfSetType;

32
// Includes
33
#include "Xdmf.hpp"
34
#include "XdmfArray.hpp"
35 36

/**
37 38
 * @brief Holds a collection of individual nodes, cells, faces, or
 * edges that are part of an XdmfGrid.
39
 *
40 41 42 43 44 45
 * An XdmfSet holds a collection of nodes, cells, faces, or edges that
 * are part of an XdmfGrid. For instance, a simulation may want to
 * hold a set of nodes on a boundary. The individual elements making
 * up the set are determined by their id. An XdmfSet can have
 * XdmfAttributes attached that contain extra values attached to the
 * elements in the set.
46
 */
47
class XDMF_EXPORT XdmfSet : public XdmfArray {
48

49
public:
50

51 52 53 54 55
  /**
   * Create a new XdmfSet.
   *
   * @return constructed XdmfSet.
   */
56
  static shared_ptr<XdmfSet> New();
57

58
  virtual ~XdmfSet();
59

60 61 62
  LOKI_DEFINE_VISITABLE(XdmfSet, XdmfArray);
  XDMF_CHILDREN(XdmfAttribute, Attribute, Name);
  static const std::string ItemTag;
63

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

66
  std::string getItemTag() const;
67

68 69 70 71 72 73
  /**
   * Get the name of the set.
   *
   * @return a string containing the name of the set.
   */
  std::string getName() const;
74

75 76 77 78 79
  /**
   * Get the XdmfSetType associated with this set.
   *
   * @return XdmfSetType of this set.
   */
80
  shared_ptr<const XdmfSetType> getType() const;
81

82
  using XdmfArray::insert;
83 84 85 86
  
#if defined(SWIG)
  using XdmfItem::insert;
#endif
87

88 89 90 91 92 93
  /**
   * Set the name of the set.
   *
   * @param name a string containing the name to set.
   */
  void setName(const std::string & name);
94

95 96 97 98 99
  /**
   * Set the XdmfSetType associated with this set.
   *
   * @param type the XdmfSetType to set.
   */
100
  void setType(const shared_ptr<const XdmfSetType> type);
101

102
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
103

104
protected:
105

106
  XdmfSet();
107

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

113
private:
114

115 116 117 118
  XdmfSet(const XdmfSet &);  // Not implemented.
  void operator=(const XdmfSet &);  // Not implemented.

  std::string mName;
119
  shared_ptr<const XdmfSetType> mType;
120 121
};

122
#ifdef _WIN32
123
XDMF_TEMPLATE template class XDMF_EXPORT
124
std::allocator<shared_ptr<XdmfAttribute> >;
125
XDMF_TEMPLATE template class XDMF_EXPORT
126 127
std::vector<shared_ptr<XdmfAttribute>,
            std::allocator<shared_ptr<XdmfAttribute> > >;
128
XDMF_TEMPLATE template class XDMF_EXPORT
129
shared_ptr<const XdmfSetType>;
130 131
#endif

132
#endif /* XDMFSET_HPP_ */