XdmfGeometry.hpp 2.97 KB
Newer Older
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
1 2 3 4 5 6 7 8 9 10
/*
 * XdmfGeometry.hpp
 *
 *  Created on: Jan 25, 2010
 *      Author: kleiter
 */

#ifndef XDMFGEOMETRY_HPP_
#define XDMFGEOMETRY_HPP_

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

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
class XdmfGeometryType {

public:

	const int dimensions;
	const std::string name;

	// Supported Xdmf Geometry Types
	static const XdmfGeometryType NoGeometry;
	static const XdmfGeometryType XYZ;
	static const XdmfGeometryType XY;
	static const XdmfGeometryType X_Y_Z;
	static const XdmfGeometryType X_Y;
	static const XdmfGeometryType VXVYVZ;
	static const XdmfGeometryType Origin_DXDYDZ;
	static const XdmfGeometryType VXVY;
	static const XdmfGeometryType Origin_DXDY;

	/*
	 * Compare two XdmfGeometry types for equality. Each geometry type has a single static instance meaning that
	 * equality can be determined by determining if they have the same pointer value.
	 *
	 * @param an XdmfGeometryType to compare equality to.
	 * @return true iff the XdmfGeometryTypes are equal.
	 */
	bool operator==(const XdmfGeometryType& top) const
	{
		return (this == &top) ? true : false;
	}

	/**
	 * Compare two XdmfGeometry types for inequality. Each geometry type has a single static instance meaning that
	 * equality can be determined by determining if they have the same pointer value.
	 *
	 * @param XdmfGeometryType to compare inequality to.
	 * @return true iff the XdmfGeometryTypes are not equal.
	 */
	bool operator!=(const XdmfGeometryType& top) const
	{
		return (this != &top) ? true : false;
	}

protected:

	/**
	 * Protected constructor for XdmfGeometryType.  The constructor is protected because all geometry types supported
	 * by Xdmf should be accessed through static public instances of XdmfGeometryType - i.e. XdmfGeometryType::XYZ.
	 */
	XdmfGeometryType(const std::string& name, const int& dimensions) :
		name(name),
		dimensions(dimensions)
	{};

private:

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

};

class XdmfGeometry : public XdmfItem {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
74 75 76 77

public:

	XdmfNewMacro(XdmfGeometry);
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

	/**
	 * Get the XdmfGeometryType associated with this Geometry.
	 *
	 * @return XdmfGeometryType.
	 */
	const XdmfGeometryType& getGeometryType() const;

	/**
	 * Set the XdmfGeometryType associated with this Geometry.
	 *
	 * @param XdmfGeometryType to set.
	 */
	void setGeometryType(const XdmfGeometryType&);

	/**
	 * Get the name of the GeometryType associated with this Geometry.
	 *
	 * @return std::string containing name of the GeometryType.
	 */
	const std::string getGeometryTypeAsString() const;

	/**
	 * Get the number of dimensions for this Geometry.
	 *
	 * @return int giving number of dimensions: i.e. XY = 2, XYZ = 3.
	 */
	const int getDimensions() const;

107
	virtual const std::string printSelf() const;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
108 109 110 111 112 113 114 115 116 117 118

protected:

	XdmfGeometry();
	virtual ~XdmfGeometry();

private:

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

119 120
  const XdmfGeometryType * mGeometryType;

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
121 122 123
};

#endif /* XDMFGEOMETRY_HPP_ */