XdmfGridRegular.hpp 4.98 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#ifndef XDMFGRIDREGULAR_HPP_
#define XDMFGRIDREGULAR_HPP_

// Includes
#include "XdmfGrid.hpp"

/**
 * @brief A mesh consisting of congruent points arranged regularly in space.
 *
 * XdmfGridRegular represents a regular mesh of congruent points arranged in space.
 * In order to define a regular grid, three sets of terms need to be supplied:
 *
 * Brick Size (Dx, Dy, (Dz)) - Size of an individual brick.
 * Dimensions (X, Y, (Z)) - Number of points in X, Y, and Z directions
 * Origin Location (X, Y, (Z)) - Location of the origin of the mesh in space.
 */
class XdmfGridRegular : public XdmfGrid {

public:

	/**
	 * Create a new structured grid (Two dimensional).
	 *
	 * @param brickSizeX the size of the brick in the x direction.
	 * @param brickSizeY the size of the brick in the y direction.
	 * @param numPointsX the number of points in the x direction.
	 * @param numPointsY the number of points in the y direction.
	 * @param originX the x coordinate of the origin.
	 * @param originY the y coordinate of the origin.
	 *
	 * @return constructed structured grid.
	 */
	static boost::shared_ptr<XdmfGridRegular> New(const double brickSizeX, const double brickSizeY, const unsigned int numPointsX,
34
		const unsigned int numPointsY, const double originX, const double originY);
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

	/**
	 * Create a new structured grid (Three dimensional).
	 *
	 * @param brickSizeX the size of the brick in the x direction.
	 * @param brickSizeY the size of the brick in the y direction.
	 * @param brickSizeZ the size of the brick in the z direction.
	 * @param numPointsX the number of points in the x direction.
	 * @param numPointsY the number of points in the y direction.
	 * @param numPointsZ the number of points in the z direction.
	 * @param originX the x coordinate of the origin.
	 * @param originY the y coordinate of the origin.
	 * @param originZ the z coordinate of the origin.
	 *
	 * @return constructed structured grid.
	 */
	static boost::shared_ptr<XdmfGridRegular> New(const double brickSizeX, const double brickSizeY, const double brickSizeZ,
		const unsigned int numPointsX, const unsigned int numPointsY, const unsigned int numPointsZ,
53
		const double originX, const double originY, const double originZ);
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131

	virtual ~XdmfGridRegular();

	LOKI_DEFINE_VISITABLE(XdmfGridRegular, XdmfGrid)
	static const std::string ItemTag;

	/**
	 * Get the size of the points composing the grid.
	 *
	 * @return XdmfArray containing brick sizes for this grid.
	 */
	boost::shared_ptr<XdmfArray> getBrickSize();

	/**
	 * Get the size of the points composing the grid (const version).
	 *
	 * @return XdmfArray containing brick sizes for this grid.
	 */
	boost::shared_ptr<const XdmfArray> getBrickSize() const;

	/**
	 * Get the dimensions of the grid, the number of points in each direction.
	 *
	 * @return XdmfArray containing dimensions of this grid.
	 */
	boost::shared_ptr<XdmfArray> getDimensions();

	/**
	 * Get the dimensions of the grid, the number of points in each direction.
	 *
	 * @return XdmfArray containing the dimensions of this grid.
	 */
	boost::shared_ptr<const XdmfArray> getDimensions() const;

	/**
	 * Get the location of the origin of the grid.
	 *
	 * @return XdmfArray containing the location of the origin of the grid.
	 */
	boost::shared_ptr<XdmfArray> getOrigin();

	/**
	 * Get the location of the origin of the grid.
	 *
	 * @return XdmfArray containing the location of the origin of the grid.
	 */
	boost::shared_ptr<const XdmfArray> getOrigin() const;

	/**
	 * Set the size of the points composing the grid.
	 *
	 * @param brickSize the sizes of the points composing the mesh.  This should
	 * have the same number of terms as the dimensionality of the mesh.
	 */
	void setBrickSize(const boost::shared_ptr<XdmfArray> brickSize);

	/**
	 * Set the dimensions of the grid, the number of points in each direction.
	 *
	 * @param dimensions the dimension of the grid.
	 */
	void setDimensions(const boost::shared_ptr<XdmfArray> dimensions);

	/**
	 * Set the origin of the grid.
	 *
	 * @param origin location of the origin of the grid.  This should have
	 * the same number of terms as the dimensionality of the mesh.
	 */
	void setOrigin(const boost::shared_ptr<XdmfArray> origin);

protected:

	XdmfGridRegular(const double brickSizeX, const double brickSizeY, const unsigned int numPointsX,
		const unsigned int numPointsY, const double originX, const double originY);
	XdmfGridRegular(const double brickSizeX, const double brickSizeY, const double brickSizeZ,
		const unsigned int numPointsX, const unsigned int numPointsY, const unsigned int numPointsZ,
		const double originX, const double originY, const double originZ);
132
	void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader);
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148

private:

	/**
	 * PIMPL
	 */
	class XdmfGridRegularImpl;

	XdmfGridRegular(const XdmfGridRegular & grid);  // Not implemented.
	void operator=(const XdmfGridRegular & grid);  // Not implemented.

	XdmfGridRegularImpl * mImpl;

};

#endif /* XDMFGRIDREGULAR_HPP_ */