XdmfTopologyType.hpp 3.71 KB
Newer Older
1 2 3
#ifndef XDMFTOPOLOGYTYPE_HPP_
#define XDMFTOPOLOGYTYPE_HPP_

4
// Includes
5
#include "XdmfItemProperty.hpp"
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 34 35 36 37
/**
 * @brief Property describing the types of elements stored in an XdmfTopology.
 *
 * XdmfTopologyType is a property used by XdmfTopology to specify the element types stored in the XdmfTopology.
 * A specific XdmfTopologyType can be created by calling on of the static methods in the class, i.e.
 * XdmfTopologyType::Tetrahedron().
 *
 * Xdmf supports the following topology types:
 * 	NoTopologyType
 * 	Polyvertex
 * 	Polyline
 * 	Polygon
 * 	Triangle
 * 	Quadrilateral
 * 	Tetrahedron
 * 	Wedge
 * 	Hexahedron
 * 	Edge_3
 * 	Triangle_6
 * 	Quadrilateral_8
 * 	Tetrahedron_10
 * 	Pyramid_13
 * 	Wedge_15
 * 	Hexahedron_20
 * 	Mixed
 * 	TwoDSMesh
 * 	TwoDRectMesh
 * 	TwoDCoRectMesh
 * 	ThreeDSMesh
 * 	ThreeDRectMesh
 *	ThreeDCoRectMesh
 */
38
class XdmfTopologyType : public XdmfItemProperty {
39 40 41

public:

42 43
	friend class XdmfTopology;

44
	enum CellType {
45
		NoCellType, Linear, Quadratic, Cubic, Arbitrary, Structured
46 47 48 49 50 51
	};

	// Supported Xdmf Topology Types
	static XdmfTopologyType NoTopologyType();
	static XdmfTopologyType Polyvertex();
	static XdmfTopologyType Polyline();
52
	static XdmfTopologyType Polygon(const int numNodes);
53 54 55 56 57 58 59 60 61 62 63 64 65
	static XdmfTopologyType Triangle();
	static XdmfTopologyType Quadrilateral();
	static XdmfTopologyType Tetrahedron();
	static XdmfTopologyType Pyramid();
	static XdmfTopologyType Wedge();
	static XdmfTopologyType Hexahedron();
	static XdmfTopologyType Edge_3();
	static XdmfTopologyType Triangle_6();
	static XdmfTopologyType Quadrilateral_8();
	static XdmfTopologyType Tetrahedron_10();
	static XdmfTopologyType Pyramid_13();
	static XdmfTopologyType Wedge_15();
	static XdmfTopologyType Hexahedron_20();
66 67 68
	static XdmfTopologyType Hexahedron_24();
	static XdmfTopologyType Hexahedron_27();
	static XdmfTopologyType Hexahedron_64();
69 70 71 72 73 74 75 76 77
	static XdmfTopologyType Mixed();
	static XdmfTopologyType TwoDSMesh();
	static XdmfTopologyType TwoDRectMesh();
	static XdmfTopologyType TwoDCoRectMesh();
	static XdmfTopologyType ThreeDSMesh();
	static XdmfTopologyType ThreeDRectMesh();
	static XdmfTopologyType ThreeDCoRectMesh();

	/**
78
	 * Get the cell type associated with this topology type
79
	 *
80
	 * @return a CellType containing the cell type.
81
	 */
82
	CellType getCellType() const;
83 84

	/**
85
	 * Get the number of nodes per element associated with this topology type.
86
	 *
87
	 * @return an unsinged int containing number of nodes per element.
88
	 */
89
	unsigned int getNodesPerElement() const;
90

91 92
	void getProperties(std::map<std::string, std::string> & collectedProperties) const;

93 94 95
	/*
	 * Compare two XdmfTopologyTypes for equality.
	 *
96 97
	 * @param topologyType an XdmfTopologyType to compare equality to.
	 * @return true if the XdmfTopologyTypes are equal.
98
	 */
99
	bool operator==(const XdmfTopologyType & topologyType) const;
100 101 102 103

	/**
	 * Compare two XdmfTopologyTypes for inequality
	 *
104 105
	 * @param topologyType XdmfTopologyType to compare inequality to.
	 * @return true if the XdmfTopologyTypes are not equal.
106
	 */
107
	bool operator!=(const XdmfTopologyType & topologyType) const;
108

109
	XdmfTopologyType(const XdmfTopologyType & topologyType);
110
	XdmfTopologyType & operator=(const XdmfTopologyType & topologyType);
111 112 113 114 115

protected:

	/**
	 * Protected constructor for XdmfTopologyType.  The constructor is protected because all topology types supported
116 117
	 * by Xdmf should be accessed through more specific static methods that construct XdmfTopologyType -
	 * i.e. XdmfTopologyType::Tetrahedron()
118
	 */
119
	XdmfTopologyType(const int & nodesPerElement, const std::string & name, const CellType & cellType);
120 121 122

private:

123 124
	static XdmfTopologyType New(const std::map<std::string, std::string> & itemProperties);

125
	CellType mCellType;
126 127
	std::string mName;
	int mNodesPerElement;
128 129 130
};

#endif /* XDMFTOPOLOGYTYPE_HPP_ */