XdmfDomain.hpp 3.46 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1
2
3
4
5
#ifndef XDMFDOMAIN_HPP_
#define XDMFDOMAIN_HPP_

// Forward Declarations
class XdmfGrid;
6
class XdmfGridCollection;
Kenneth Leiter's avatar
Kenneth Leiter committed
7
8

// Includes
9
#include "XdmfItem.hpp"
Kenneth Leiter's avatar
Kenneth Leiter committed
10

11
12
13
14
15
16
/**
 * @brief The root XdmfItem that contains XdmfGrids.
 *
 * XdmfDomain is the top XdmfItem in an Xdmf structure.  It can store a number of grids and
 * provides methods to insert, retrieve, and remove these grids.
 */
17
class XdmfDomain : public virtual XdmfItem {
Kenneth Leiter's avatar
Kenneth Leiter committed
18
19
20

public:

21
22
23
24
25
	/**
	 * Create a new XdmfDomain.
	 *
	 * @return constructed XdmfDomain.
	 */
26
	static boost::shared_ptr<XdmfDomain> New();
27
28
	virtual ~XdmfDomain();

29
	LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem)
30
	static const std::string ItemTag;
31

Kenneth Leiter's avatar
Kenneth Leiter committed
32
	/**
33
34
	 * Get a XdmfGrid attached to the domain.
	 *
35
36
	 * @param index of the grid to retrieve.
	 * @return grid at the specified index attached to this domain.
Kenneth Leiter's avatar
Kenneth Leiter committed
37
	 */
38
	boost::shared_ptr<XdmfGrid> getGrid(const unsigned int index);
Kenneth Leiter's avatar
Kenneth Leiter committed
39
40

	/**
41
	 * Get a XdmfGrid attached to this domain (const version).
Kenneth Leiter's avatar
Kenneth Leiter committed
42
43
	 *
	 * @param index of the grid to retrieve.
44
	 * @return grid at the specified index attached to this domain.
Kenneth Leiter's avatar
Kenneth Leiter committed
45
	 */
46
	boost::shared_ptr<const XdmfGrid> getGrid(const unsigned int index) const;
Kenneth Leiter's avatar
Kenneth Leiter committed
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	/**
	 * Get a XdmfGridCollection attached to the domain.
	 *
	 * @param index of the grid collection to retrieve.
	 * @return grid collection at the specified index attached to this domain.
	 */
	boost::shared_ptr<XdmfGridCollection> getGridCollection(const unsigned int index);

	/**
	 * Get a XdmfGridCollection attached to the domain (const version).
	 *
	 * @param index of the grid collection to retrieve.
	 * @return grid collection at the specified index attached to this domain.
	 */
	boost::shared_ptr<const XdmfGridCollection> getGridCollection(const unsigned int index) const;

64
	std::map<std::string, std::string> getItemProperties() const;
Kenneth Leiter's avatar
Kenneth Leiter committed
65

66
	virtual std::string getItemTag() const;
67

Kenneth Leiter's avatar
Kenneth Leiter committed
68
	/**
69
70
71
	 * Get the number of XdmfGrids attached to this domain.
	 *
	 * @return unsigned int containing the number of XdmfGrids attached to this domain.
Kenneth Leiter's avatar
Kenneth Leiter committed
72
	 */
73
74
75
76
77
78
79
80
	unsigned int getNumberGrids() const;

	/**
	 * Get the number of XdmfGridCollections attached to this domain.
	 *
	 * @return unsigned int containing the number of XdmfGridCollections attached to this domain.
	 */
	unsigned int getNumberGridCollections() const;
Kenneth Leiter's avatar
Kenneth Leiter committed
81

82
83
84
85
86
	/**
	 * Insert a XdmfGrid into the domain.
	 *
	 * @param grid a shared pointer to an XdmfGrid to insert into the domain.
	 */
87
	void insert(const boost::shared_ptr<XdmfGrid> grid);
88

89
90
91
92
93
94
95
	/**
	 * Insert a XdmfGridCollection into the domain.
	 *
	 * @param gridCollection a shared pointer to an XdmfGridCollection to insert into the domain.
	 */
	void insert(const boost::shared_ptr<XdmfGridCollection> gridCollection);

96
97
98
99
100
101
102
	/**
	 * Remove an XdmfGrid from the domain.
	 *
	 * @param index of the XdmfGrid to remove.
	 */
	void removeGrid(const unsigned int index);

103
104
105
106
107
108
109
	/**
	 * Remove an XdmfGridCollection from the domain.
	 *
	 * @param index of the XdmfGridCollection to remove.
	 */
	void removeGridCollection(const unsigned int index);

110
	virtual void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor) const;
Kenneth Leiter's avatar
Kenneth Leiter committed
111
112
113
114

protected:

	XdmfDomain();
115
	virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems);
Kenneth Leiter's avatar
Kenneth Leiter committed
116
117
118

private:

119
120
	XdmfDomain(const XdmfDomain & domain);  // Not implemented.
	void operator=(const XdmfDomain & domain);  // Not implemented.
Kenneth Leiter's avatar
Kenneth Leiter committed
121
122

	std::vector<boost::shared_ptr<XdmfGrid> > mGrids;
123
	std::vector<boost::shared_ptr<XdmfGridCollection> > mGridCollections;
Kenneth Leiter's avatar
Kenneth Leiter committed
124
125
126
};

#endif /* XDMFDOMAIN_HPP_ */