XdmfGrid.hpp 4.82 KB
Newer Older
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
1 2 3 4 5 6
#ifndef XDMFGRID_HPP_
#define XDMFGRID_HPP_

// Forward Declarations
class XdmfAttribute;
class XdmfGeometry;
7
class XdmfSet;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
8 9 10
class XdmfTopology;

// Includes
11
#include "XdmfItem.hpp"
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
12

13 14 15 16 17
/**
 * @brief A mesh that consists of elements, points, and values attached to the mesh.
 *
 * XdmfGrid represents a mesh.  It is required to contain two other Xdmf data structures, an XdmfGeometry
 * that stores point locations and an XdmfTopology that store connectivity information.  XdmfAttributes can be inserted
18 19
 * into the XdmfGrid to specify values attached at various parts of the mesh.  XdmfSets can be inserted in the XdmfGrid
 * to specify collections of mesh elements.
20
 */
21
class XdmfGrid : public XdmfItem {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
22 23 24 25

public:

	XdmfNewMacro(XdmfGrid);
26
	LOKI_DEFINE_VISITABLE(XdmfGrid, XdmfItem)
27
	static std::string ItemTag;
28

29
	/**
30
	 * Get an XdmfAttribute attached to this grid.
31
	 *
32 33
	 * @param index of the XdmfAttribute to retrieve.
	 * @return smart pointer to the XdmfAttribute attached to this grid.
34
	 */
35
	boost::shared_ptr<XdmfAttribute> getAttribute(const unsigned int index);
36 37

	/**
38
	 * Get an XdmfAttribute attached to this grid (const version).
39
	 *
40 41
	 * @param index of the XdmfAttribute to retrieve.
	 * @return pointer to the XdmfAttribute attached to this grid.
42
	 */
43
	boost::shared_ptr<const XdmfAttribute> getAttribute(const unsigned int index) const;
44 45

	/**
46
	 * Get the XdmfGeometry associated with this grid.
47
	 *
48
	 * @return a smart pointer to the XdmfGeometry.
49
	 */
50
	boost::shared_ptr<XdmfGeometry> getGeometry();
51 52

	/**
53
	 * Get the XdmfGeometry associated with this grid (const version).
54
	 *
55
	 * @return a smart pointer to the XdmfGeometry.
56
	 */
57
	boost::shared_ptr<const XdmfGeometry> getGeometry() const;
58

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

61 62
	std::string getItemTag() const;

63
	/**
64
	 * Get the name of the grid.
65
	 *
66
	 * @return a string containing the name of the grid.
67
	 */
68
	std::string getName() const;
69 70

	/**
71
	 * Get the number of XdmfAttributes attached to this grid.
72
	 *
73
	 * @return an unsigned int containing the number of XdmfAttributes attached to this grid.
74
	 */
75
	unsigned int getNumberOfAttributes() const;
76

77 78 79 80 81 82 83 84 85 86 87 88 89
	/**
	 * Get the number of XdmfSets attached to this grid.
	 *
	 * @return an unsigned int containing the number of XdmfSets attached to this grid.
	 */
	unsigned int getNumberOfSets() const;

	/**
	 * Get an XdmfSet attached to this grid.
	 *
	 * @param index of the XdmfSet to retrieve.
	 * @return pointer to the XdmfSet attached to this grid.
	 */
90
	boost::shared_ptr<XdmfSet> getSet(const unsigned int index);
91 92 93 94 95 96 97

	/**
	 * Get an XdmfSet attached to this grid (const version).
	 *
	 * @param index of the XdmfSet to retrieve.
	 * @return pointer to the XdmfSet attached to this grid.
	 */
98
	boost::shared_ptr<const XdmfSet> getSet(const unsigned int index) const;
99

100
	/**
101
	 * Get the XdmfTopology associated with this grid.
102
	 *
103
	 * @return a smart pointer to the XdmfTopology.
104
	 */
105
	boost::shared_ptr<XdmfTopology> getTopology();
106 107

	/**
108
	 * Get the XdmfTopology associated with this grid (const version).
109
	 *
110
	 * @return a smart pointer to the XdmfTopology.
111
	 */
112
	boost::shared_ptr<const XdmfTopology> getTopology() const;
113

114
	/**
115 116
	 * Insert an XdmfAttribute into the grid.
	 *
117
	 * @param attribute an XdmfAttribute to attach to this grid.
118
	 */
119 120
	void insert(boost::shared_ptr<XdmfAttribute> attribute);

121 122 123 124 125 126 127
	/**
	 * Insert an XdmfSet into the grid.
	 *
	 * @param set an XdmfSet to attach to this grid.
	 */
	void insert(boost::shared_ptr<XdmfSet> set);

128 129 130 131 132 133 134 135 136 137 138 139 140 141
	/**
	 * Remove an XdmfAttribute from the grid.
	 *
	 * @param index of the XdmfAttribute to remove.
	 */
	void removeAttribute(const unsigned int index);

	/**
	 * Remove an XdmfSet from the grid.
	 *
	 * @param index of the XdmfSet to remove.
	 */
	void removeSet(const unsigned int index);

142
	/**
143
	 * Set the XdmfGeometry associated with this grid.
144
	 *
145
	 * @param geometry an XdmfGeometry to attach to this grid.
146
	 */
147
	void setGeometry(boost::shared_ptr<XdmfGeometry> geometry);
148 149

	/**
150
	 * Set the XdmfTopology associated with this grid.
151
	 *
152
	 * @param topology an XdmfTopology to attach to this grid.
153
	 */
154
	void setTopology(boost::shared_ptr<XdmfTopology> topology);
155 156

	/**
157 158 159
	 * Set the name of the grid.
	 *
	 * @param name a string containing the name to set.
160
	 */
161
	void setName(const std::string & name);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
162

163
	virtual void traverse(boost::shared_ptr<Loki::BaseVisitor> visitor);
164

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
165 166 167 168
protected:

	XdmfGrid();
	virtual ~XdmfGrid();
169
	virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
170

171 172
	std::string mName;

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
173 174
private:

175 176
	XdmfGrid(const XdmfGrid & grid);  // Not implemented.
	void operator=(const XdmfGrid & grid);  // Not implemented.
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
177

178
	std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
179
	boost::shared_ptr<XdmfGeometry> mGeometry;
180
	std::vector<boost::shared_ptr<XdmfSet> > mSets;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
181 182 183 184
	boost::shared_ptr<XdmfTopology> mTopology;
};

#endif /* XDMFGRID_HPP_ */