Commit 93e3cbe1 authored by Armin Wehrfritz's avatar Armin Wehrfritz

Add support for Polyhedron cells

Elements of type Polyhedron (i.e. N face cells, where each face is a M edge
polygon) are in the following format:
[nCellFaces, nFace0Pts, id0_0, id0_1, ..., nFace1Pts, id1_0, id1_1, ..., ...]
parent 1819d6ae
......@@ -97,6 +97,18 @@ XdmfTopology::getNumberElements() const
numberElements += 1;
index += numberNodes + 2;
}
else if(topologyType == XdmfTopologyType::Polyhedron()) {
// get number of face
const unsigned int numberFaces =
this->getValue<unsigned int>(index + 1);
// skip to first face
index += 2;
// iterate over all faces and add number of nodes per face to index
for(unsigned int i=0; i<numberFaces; ++i) {
index += this->getValue<unsigned int>(index) + 1;
}
numberElements += 1;
}
else {
// add 1 to element count and move to next element id
numberElements += 1;
......
......@@ -51,6 +51,10 @@ class XdmfTopologyType;
*
* The tetrahedron is composed of nodes 20, 25, 100, and 200. The
* polygon is composed of nodes 300 to 304.
*
* Elements of type Polyhedron (i.e. N face cells, where each face is a M edge
* polygon) are in the following format:
* [nCellFaces, nFace0Pts, id0_0, id0_1, ..., nFace1Pts, id1_0, id1_1, ..., ...]
*/
class XDMF_EXPORT XdmfTopology : public XdmfArray {
......
......@@ -145,6 +145,15 @@ XdmfTopologyType::Hexahedron()
return p;
}
shared_ptr<const XdmfTopologyType>
XdmfTopologyType::Polyhedron()
{
std::vector<shared_ptr<const XdmfTopologyType> > faces;
static shared_ptr<const XdmfTopologyType>
p(new XdmfTopologyType(0, 0, faces, 0, "Polyhedron", Linear, 0x10));
return p;
}
shared_ptr<const XdmfTopologyType>
XdmfTopologyType::Edge_3()
{
......@@ -473,6 +482,9 @@ XdmfTopologyType::New(const unsigned int id)
else if(id == XdmfTopologyType::Hexahedron()->getID()) {
return XdmfTopologyType::Hexahedron();
}
else if(id == XdmfTopologyType::Polyhedron()->getID()) {
return XdmfTopologyType::Polyhedron();
}
else if(id == XdmfTopologyType::Edge_3()->getID()) {
return XdmfTopologyType::Edge_3();
}
......@@ -643,6 +655,9 @@ XdmfTopologyType::New(const std::map<std::string, std::string> & itemProperties)
else if(typeVal.compare("HEXAHEDRON") == 0) {
return Hexahedron();
}
else if(typeVal.compare("POLYHEDRON") == 0) {
return Polyhedron();
}
else if(typeVal.compare("EDGE_3") == 0) {
return Edge_3();
}
......
......@@ -62,6 +62,7 @@
* Tetrahedron - 4 Triangular Faces
* Wedge - 4 Triangular Faces, Quadrilateral Base
* Hexahedron - 6 Quadrilateral Faces
* Polyhedron - N Face Cell, where each Face is a M Edge Polygon
* Edge_3 - 3 Node Quadratic Line
* Triangle_6 - 6 Node Quadratic Triangle
* Quadrilateral_8 - 8 Node Quadratic Quadrilateral
......@@ -120,7 +121,7 @@ public:
*/
static shared_ptr<const XdmfTopologyType> NoTopologyType();
static shared_ptr<const XdmfTopologyType> Polyvertex();
static shared_ptr<const XdmfTopologyType>
static shared_ptr<const XdmfTopologyType>
Polyline(const unsigned int nodesPerElement);
static shared_ptr<const XdmfTopologyType>
Polygon(const unsigned int nodesPerElement);
......@@ -130,6 +131,7 @@ public:
static shared_ptr<const XdmfTopologyType> Pyramid();
static shared_ptr<const XdmfTopologyType> Wedge();
static shared_ptr<const XdmfTopologyType> Hexahedron();
static shared_ptr<const XdmfTopologyType> Polyhedron();
static shared_ptr<const XdmfTopologyType> Edge_3();
static shared_ptr<const XdmfTopologyType> Triangle_6();
static shared_ptr<const XdmfTopologyType> Quadrilateral_8();
......@@ -300,7 +302,7 @@ public:
* @skipline //#getName
* @until //#getName
*
* Python
* Python
*
* @dontinclude XdmfExampleTopologyType.py
* @skipline #//getName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment