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

// Forward Declarations
class XdmfGrid;

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

10 11 12 13 14 15
/**
 * @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.
 */
Kenneth Leiter's avatar
Kenneth Leiter committed
16 17 18 19 20
class XdmfDomain : public XdmfItem {

public:

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

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

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

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

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

44 45
	std::string getItemTag() const;

Kenneth Leiter's avatar
Kenneth Leiter committed
46
	/**
47 48 49
	 * 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
50 51 52
	 */
	unsigned int getNumberOfGrids() const;

53 54 55 56 57
	/**
	 * Insert a XdmfGrid into the domain.
	 *
	 * @param grid a shared pointer to an XdmfGrid to insert into the domain.
	 */
58
	void insert(const boost::shared_ptr<XdmfGrid> grid);
59

60 61 62 63 64 65 66
	/**
	 * Remove an XdmfGrid from the domain.
	 *
	 * @param index of the XdmfGrid to remove.
	 */
	void removeGrid(const unsigned int index);

67
	virtual void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor) const;
Kenneth Leiter's avatar
Kenneth Leiter committed
68 69 70 71

protected:

	XdmfDomain();
72
	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
73 74 75

private:

76 77
	XdmfDomain(const XdmfDomain & domain);  // Not implemented.
	void operator=(const XdmfDomain & domain);  // Not implemented.
Kenneth Leiter's avatar
Kenneth Leiter committed
78 79 80 81 82

	std::vector<boost::shared_ptr<XdmfGrid> > mGrids;
};

#endif /* XDMFDOMAIN_HPP_ */