XdmfDomain.hpp 3.36 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
21

public:

	XdmfNewMacro(XdmfDomain);
22
23
	virtual ~XdmfDomain();

24
	LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem)
25
	static const std::string ItemTag;
26

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

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

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	/**
	 * 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;

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

61
	virtual std::string getItemTag() const;
62

Kenneth Leiter's avatar
Kenneth Leiter committed
63
	/**
64
65
66
	 * 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
67
	 */
68
69
70
71
72
73
74
75
	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
76

77
78
79
80
81
	/**
	 * Insert a XdmfGrid into the domain.
	 *
	 * @param grid a shared pointer to an XdmfGrid to insert into the domain.
	 */
82
	void insert(const boost::shared_ptr<XdmfGrid> grid);
83

84
85
86
87
88
89
90
	/**
	 * 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);

91
92
93
94
95
96
97
	/**
	 * Remove an XdmfGrid from the domain.
	 *
	 * @param index of the XdmfGrid to remove.
	 */
	void removeGrid(const unsigned int index);

98
99
100
101
102
103
104
	/**
	 * Remove an XdmfGridCollection from the domain.
	 *
	 * @param index of the XdmfGridCollection to remove.
	 */
	void removeGridCollection(const unsigned int index);

105
	virtual void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor) const;
Kenneth Leiter's avatar
Kenneth Leiter committed
106
107
108
109

protected:

	XdmfDomain();
110
	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
111
112
113

private:

114
115
	XdmfDomain(const XdmfDomain & domain);  // Not implemented.
	void operator=(const XdmfDomain & domain);  // Not implemented.
Kenneth Leiter's avatar
Kenneth Leiter committed
116
117

	std::vector<boost::shared_ptr<XdmfGrid> > mGrids;
118
	std::vector<boost::shared_ptr<XdmfGridCollection> > mGridCollections;
Kenneth Leiter's avatar
Kenneth Leiter committed
119
120
121
};

#endif /* XDMFDOMAIN_HPP_ */