XdmfTopologyType.cpp 4.15 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
/*
 * XdmfTopologyType.cpp
 *
 *  Created on: Jan 29, 2010
 *      Author: kleiter
 */

#include "XdmfTopologyType.hpp"

// Supported XdmfTopologyTypes
XdmfTopologyType XdmfTopologyType::NoTopologyType()
{
	return XdmfTopologyType(0, "NoTopology", NoCellType);
}

XdmfTopologyType XdmfTopologyType::Polyvertex()
{
	return XdmfTopologyType(1, "Polyvertex", Linear);
}

XdmfTopologyType XdmfTopologyType::Polyline()
{
	return XdmfTopologyType(1, "Polyline", Linear);
}

26
XdmfTopologyType XdmfTopologyType::Polygon(const int nodesPerElement)
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 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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
{
	return XdmfTopologyType(nodesPerElement, "Polygon", Linear);
}

XdmfTopologyType XdmfTopologyType::Triangle()
{
	return XdmfTopologyType(3, "Triangle", Linear);
}

XdmfTopologyType XdmfTopologyType::Quadrilateral()
{
	return XdmfTopologyType(4, "Quadrilateral", Linear);
}

XdmfTopologyType XdmfTopologyType::Tetrahedron()
{
	return XdmfTopologyType(4, "Tetrahedron", Linear);
}

XdmfTopologyType XdmfTopologyType::Pyramid()
{
	return XdmfTopologyType(5, "Pyramid", Linear);
}

XdmfTopologyType XdmfTopologyType::Wedge()
{
	return XdmfTopologyType(6, "Wedge", Linear);
}

XdmfTopologyType XdmfTopologyType::Hexahedron()
{
	return XdmfTopologyType(8, "Hexahedron", Linear);
}

XdmfTopologyType XdmfTopologyType::Edge_3()
{
	return XdmfTopologyType(3, "Edge_3", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Triangle_6()
{
	return XdmfTopologyType(6, "Triangle_6", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Quadrilateral_8()
{
	return XdmfTopologyType(8, "Quadrilateral_8", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Tetrahedron_10()
{
	return XdmfTopologyType(10, "Tetrahedron_10", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Pyramid_13()
{
	return XdmfTopologyType(13, "Pyramid_13", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Wedge_15()
{
	return XdmfTopologyType(15, "Wedge_15", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Hexahedron_20()
{
	return XdmfTopologyType(20, "Hexahedron_20", Quadratic);
}

XdmfTopologyType XdmfTopologyType::Mixed()
{
	return XdmfTopologyType(0, "Mixed", Arbitrary);
}

XdmfTopologyType XdmfTopologyType::TwoDSMesh()
{
	return XdmfTopologyType(1, "2DSMesh", Structured);
}

XdmfTopologyType XdmfTopologyType::TwoDRectMesh()
{
	return XdmfTopologyType(1, "2DRectMesh", Structured);
}

XdmfTopologyType XdmfTopologyType::TwoDCoRectMesh()
{
	return XdmfTopologyType(1, "2DCoRectMesh", Structured);
}

XdmfTopologyType XdmfTopologyType::ThreeDSMesh()
{
	return XdmfTopologyType(1, "3DSMesh", Structured);
}

XdmfTopologyType XdmfTopologyType::ThreeDRectMesh()
{
	return XdmfTopologyType(1, "3DRectMesh", Structured);
}

XdmfTopologyType XdmfTopologyType::ThreeDCoRectMesh()
{
	return XdmfTopologyType(1, "3DCoRectMesh", Structured);
}

XdmfTopologyType::XdmfTopologyType(const int& nodesPerElement, const std::string& name, const CellType& cellType) :
	mNodesPerElement(nodesPerElement),
	mName(name),
	mCellType(cellType)
{}

XdmfTopologyType::XdmfTopologyType(const XdmfTopologyType& topologyType):
	mNodesPerElement(topologyType.mNodesPerElement),
	mName(topologyType.mName),
	mCellType(topologyType.mCellType)
{
}

XdmfTopologyType& XdmfTopologyType::operator=(const XdmfTopologyType& topologyType)
{
	if(this != &topologyType)
	{
		mNodesPerElement = topologyType.mNodesPerElement;
		mName = topologyType.mName;
		mCellType = topologyType.mCellType;
	}
	return *this;
}

bool XdmfTopologyType::operator==(const XdmfTopologyType& topologyType) const
{
	return mNodesPerElement == topologyType.mNodesPerElement && mName.compare(topologyType.mName) == 0 && mCellType == topologyType.mCellType;
}

bool XdmfTopologyType::operator!=(const XdmfTopologyType& topologyType) const
{
	return !this->operator==(topologyType);
}

165
XdmfTopologyType::CellType XdmfTopologyType::getCellType() const
166
{
167
	return mCellType;
168 169 170 171 172 173 174
}

std::string XdmfTopologyType::getName() const
{
	return mName;
}

175
unsigned int XdmfTopologyType::getNodesPerElement() const
176
{
177
	return mNodesPerElement;
178
}
179 180 181 182 183 184 185 186 187

void XdmfTopologyType::getProperties(std::map<std::string, std::string> & collectedProperties) const
{
	collectedProperties["TopologyType"] = this->mName;
	if(this->getName().compare("Polygon") == 0)
	{
		collectedProperties["NodesPerElement"] = this->mNodesPerElement;
	}
}