XdmfSet.hpp 6.07 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
  /**
   * Create a new XdmfSet.
   *
54
55
56
57
   * Example of use:
   *
   * C++
   *
58
   * @dontinclude ExampleXdmfSet.cpp
59
60
   * @skipline //#initialize
   * @until //#initialize
61
62
63
   *
   * Python
   *
64
   * @dontinclude XdmfExampleSet.py
65
66
   * @skipline #//initialize
   * @until #//initialize
67
   *
68
   * @return 	Constructed XdmfSet.
69
   */
70
  static shared_ptr<XdmfSet> New();
71

72
  virtual ~XdmfSet();
73

74
  LOKI_DEFINE_VISITABLE(XdmfSet, XdmfArray);
75
  XDMF_CHILDREN(XdmfSet, XdmfAttribute, Attribute, Name);
76
  static const std::string ItemTag;
77

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

80
  std::string getItemTag() const;
81

82
83
84
  /**
   * Get the name of the set.
   *
85
86
87
88
   * Example of use:
   *
   * C++
   *
89
   * @dontinclude ExampleXdmfSet.cpp
90
91
92
93
94
95
   * @skipline //#initialize
   * @until //#initialize
   * @skipline //#setName
   * @until //#setName
   * @skipline //#getName
   * @until //#getName
96
97
98
   *
   * Python
   *
99
   * @dontinclude XdmfExampleSet.py
100
101
102
103
104
105
   * @skipline #//initialize
   * @until #//initialize
   * @skipline #//setName
   * @until #//setName
   * @skipline #//getName
   * @until #//getName
106
   *
107
   * @return	A string containing the name of the set.
108
109
   */
  std::string getName() const;
110

111
112
113
  /**
   * Get the XdmfSetType associated with this set.
   *
114
115
116
117
   * Example of use:
   *
   * C++
   *
118
   * @dontinclude ExampleXdmfSet.cpp
119
120
121
122
123
124
   * @skipline //#initialize
   * @until //#initialize
   * @skipline //#setType
   * @until //#setType
   * @skipline //#getType
   * @until //#getType
125
126
127
   *
   * Python
   *
128
   * @dontinclude XdmfExampleSet.py
129
130
131
132
133
134
   * @skipline #//initialize
   * @until #//initialize
   * @skipline #//setType
   * @until #//setType
   * @skipline #//getType
   * @until #//getType
135
   *
136
   * @return 	XdmfSetType of this set.
137
   */
138
  shared_ptr<const XdmfSetType> getType() const;
139

140
  using XdmfArray::insert;
141
142
143
144
  
#if defined(SWIG)
  using XdmfItem::insert;
#endif
145

146
147
148
  /**
   * Set the name of the set.
   *
149
150
151
152
   * Example of use:
   *
   * C++
   *
153
   * @dontinclude ExampleXdmfSet.cpp
154
155
156
157
   * @skipline //#initialize
   * @until //#initialize
   * @skipline //#setName
   * @until //#setName
158
159
160
   *
   * Python
   *
161
   * @dontinclude XdmfExampleSet.py
162
163
164
165
   * @skipline #//initialize
   * @until #//initialize
   * @skipline #//setName
   * @until #//setName
166
   *
167
   * @param 	name	A string containing the name to set.
168
169
   */
  void setName(const std::string & name);
170

171
172
173
  /**
   * Set the XdmfSetType associated with this set.
   *
174
175
176
177
   * Example of use:
   *
   * C++
   *
178
   * @dontinclude ExampleXdmfSet.cpp
179
180
181
182
   * @skipline //#initialize
   * @until //#initialize
   * @skipline //#setType
   * @until //#setType
183
184
185
   *
   * Python
   *
186
   * @dontinclude XdmfExampleSet.py
187
188
189
190
   * @skipline //#initialize
   * @until //#initialize
   * @skipline //#setType
   * @until //#setType
191
   *
192
   * @param	type	The XdmfSetType to set.
193
   */
194
  void setType(const shared_ptr<const XdmfSetType> type);
195

196
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
197

198
protected:
199

200
  XdmfSet();
201

202
203
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
204
               const std::vector<shared_ptr<XdmfItem> > & childItems,
205
               const XdmfCoreReader * const reader);
206

207
private:
208

209
210
211
212
  XdmfSet(const XdmfSet &);  // Not implemented.
  void operator=(const XdmfSet &);  // Not implemented.

  std::string mName;
213
  shared_ptr<const XdmfSetType> mType;
214
215
};

216
#ifdef _WIN32
217
XDMF_TEMPLATE template class XDMF_EXPORT
218
std::allocator<shared_ptr<XdmfAttribute> >;
219
XDMF_TEMPLATE template class XDMF_EXPORT
220
221
std::vector<shared_ptr<XdmfAttribute>,
            std::allocator<shared_ptr<XdmfAttribute> > >;
222
XDMF_TEMPLATE template class XDMF_EXPORT
223
shared_ptr<const XdmfSetType>;
224
225
#endif

226
#endif /* XDMFSET_HPP_ */