Commit 68d4ee41 authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

ENH: Add Hexahedron_64() to Hexahedron() Topology Conversion.

parent 12f100b7
#include <math.h>
#include "XdmfArray.hpp"
#include "XdmfAttribute.hpp"
#include "XdmfAttributeCenter.hpp"
#include "XdmfAttributeType.hpp"
#include "XdmfGeometry.hpp"
#include "XdmfGeometryType.hpp"
#include "XdmfGrid.hpp"
......@@ -324,6 +326,286 @@ public:
}
};
class XdmfTopologyConverter::Hexahedron64ToHexahedron {
public:
Hexahedron64ToHexahedron()
{
}
boost::shared_ptr<XdmfGrid> convert(const boost::shared_ptr<XdmfGrid> gridToConvert) const
{
boost::shared_ptr<XdmfGrid> toReturn = XdmfGrid::New();
toReturn->setName(gridToConvert->getName());
toReturn->setGeometry(gridToConvert->getGeometry());
toReturn->getTopology()->setTopologyType(XdmfTopologyType::Hexahedron());
boost::shared_ptr<XdmfArray> oldConnectivity = gridToConvert->getTopology()->getArray();
boost::shared_ptr<XdmfArray> newConnectivity = toReturn->getTopology()->getArray();
newConnectivity->initialize(oldConnectivity->getType());
newConnectivity->resize(216 * gridToConvert->getTopology()->getNumberElements(), 0);
if(!oldConnectivity->isInitialized())
{
oldConnectivity->read();
}
for(unsigned int i=0; i<gridToConvert->getTopology()->getNumberElements(); ++i)
{
const unsigned int startIndex = 216 * i;
const unsigned int valuesStartIndex = 64 * i;
newConnectivity->copyValues(startIndex + 0, oldConnectivity, 0 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 1, oldConnectivity, 8 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 2, oldConnectivity, 48 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 3, oldConnectivity, 15 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 4, oldConnectivity, 24 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 5, oldConnectivity, 36 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 6, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 7, oldConnectivity, 33 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 8, oldConnectivity, 8 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 9, oldConnectivity, 9 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 10, oldConnectivity, 49 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 11, oldConnectivity, 48 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 12, oldConnectivity, 36 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 13, oldConnectivity, 37 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 14, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 15, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 16, oldConnectivity, 9 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 17, oldConnectivity, 1 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 18, oldConnectivity, 10 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 19, oldConnectivity, 49 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 20, oldConnectivity, 37 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 21, oldConnectivity, 25 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 22, oldConnectivity, 34 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 23, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 24, oldConnectivity, 15 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 25, oldConnectivity, 48 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 26, oldConnectivity, 51 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 27, oldConnectivity, 14 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 28, oldConnectivity, 33 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 29, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 30, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 31, oldConnectivity, 32 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 32, oldConnectivity, 48 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 33, oldConnectivity, 49 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 34, oldConnectivity, 50 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 35, oldConnectivity, 51 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 36, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 37, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 38, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 39, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 40, oldConnectivity, 49 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 41, oldConnectivity, 10 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 42, oldConnectivity, 11 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 43, oldConnectivity, 50 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 44, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 45, oldConnectivity, 34 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 46, oldConnectivity, 35 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 47, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 48, oldConnectivity, 14 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 49, oldConnectivity, 51 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 50, oldConnectivity, 13 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 51, oldConnectivity, 3 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 52, oldConnectivity, 32 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 53, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 54, oldConnectivity, 39 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 55, oldConnectivity, 27 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 56, oldConnectivity, 51 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 57, oldConnectivity, 50 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 58, oldConnectivity, 12 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 59, oldConnectivity, 13 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 60, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 61, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 62, oldConnectivity, 38 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 63, oldConnectivity, 39 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 64, oldConnectivity, 50 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 65, oldConnectivity, 11 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 66, oldConnectivity, 2 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 67, oldConnectivity, 12 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 68, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 69, oldConnectivity, 35 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 70, oldConnectivity, 26 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 71, oldConnectivity, 38 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 72, oldConnectivity, 24 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 73, oldConnectivity, 36 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 74, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 75, oldConnectivity, 33 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 76, oldConnectivity, 28 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 77, oldConnectivity, 44 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 78, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 79, oldConnectivity, 41 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 80, oldConnectivity, 36 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 81, oldConnectivity, 37 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 82, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 83, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 84, oldConnectivity, 44 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 85, oldConnectivity, 45 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 86, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 87, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 88, oldConnectivity, 37 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 89, oldConnectivity, 25 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 90, oldConnectivity, 34 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 91, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 92, oldConnectivity, 45 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 93, oldConnectivity, 29 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 94, oldConnectivity, 42 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 95, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 96, oldConnectivity, 33 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 97, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 98, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 99, oldConnectivity, 32 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 100, oldConnectivity, 41 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 101, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 102, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 103, oldConnectivity, 40 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 104, oldConnectivity, 56 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 105, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 106, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 107, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 108, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 109, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 110, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 111, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 112, oldConnectivity, 57 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 113, oldConnectivity, 34 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 114, oldConnectivity, 35 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 115, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 116, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 117, oldConnectivity, 42 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 118, oldConnectivity, 43 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 119, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 120, oldConnectivity, 32 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 121, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 122, oldConnectivity, 39 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 123, oldConnectivity, 27 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 124, oldConnectivity, 40 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 125, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 126, oldConnectivity, 47 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 127, oldConnectivity, 31 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 128, oldConnectivity, 59 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 129, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 130, oldConnectivity, 38 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 131, oldConnectivity, 39 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 132, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 133, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 134, oldConnectivity, 46 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 135, oldConnectivity, 47 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 136, oldConnectivity, 58 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 137, oldConnectivity, 35 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 138, oldConnectivity, 26 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 139, oldConnectivity, 38 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 140, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 141, oldConnectivity, 43 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 142, oldConnectivity, 30 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 143, oldConnectivity, 46 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 144, oldConnectivity, 28 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 145, oldConnectivity, 44 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 146, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 147, oldConnectivity, 41 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 148, oldConnectivity, 4 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 149, oldConnectivity, 16 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 150, oldConnectivity, 52 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 151, oldConnectivity, 23 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 152, oldConnectivity, 44 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 153, oldConnectivity, 45 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 154, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 155, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 156, oldConnectivity, 16 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 157, oldConnectivity, 17 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 158, oldConnectivity, 53 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 159, oldConnectivity, 52 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 160, oldConnectivity, 45 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 161, oldConnectivity, 29 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 162, oldConnectivity, 42 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 163, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 164, oldConnectivity, 17 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 165, oldConnectivity, 5 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 166, oldConnectivity, 18 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 167, oldConnectivity, 53 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 168, oldConnectivity, 41 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 169, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 170, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 171, oldConnectivity, 40 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 172, oldConnectivity, 23 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 173, oldConnectivity, 52 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 174, oldConnectivity, 55 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 175, oldConnectivity, 22 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 176, oldConnectivity, 60 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 177, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 178, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 179, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 180, oldConnectivity, 52 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 181, oldConnectivity, 53 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 182, oldConnectivity, 54 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 183, oldConnectivity, 55 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 184, oldConnectivity, 61 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 185, oldConnectivity, 42 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 186, oldConnectivity, 43 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 187, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 188, oldConnectivity, 53 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 189, oldConnectivity, 18 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 190, oldConnectivity, 19 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 191, oldConnectivity, 54 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 192, oldConnectivity, 40 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 193, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 194, oldConnectivity, 47 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 195, oldConnectivity, 31 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 196, oldConnectivity, 22 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 197, oldConnectivity, 55 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 198, oldConnectivity, 21 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 199, oldConnectivity, 7 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 200, oldConnectivity, 63 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 201, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 202, oldConnectivity, 46 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 203, oldConnectivity, 47 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 204, oldConnectivity, 55 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 205, oldConnectivity, 54 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 206, oldConnectivity, 20 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 207, oldConnectivity, 21 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 208, oldConnectivity, 62 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 209, oldConnectivity, 43 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 210, oldConnectivity, 30 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 211, oldConnectivity, 46 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 212, oldConnectivity, 54 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 213, oldConnectivity, 19 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 214, oldConnectivity, 6 + valuesStartIndex, 1);
newConnectivity->copyValues(startIndex + 215, oldConnectivity, 20 + valuesStartIndex, 1);
}
for(unsigned int i=0; i<gridToConvert->getNumberOfAttributes(); ++i)
{
boost::shared_ptr<XdmfAttribute> currAttribute = gridToConvert->getAttribute(i);
if(currAttribute->getAttributeCenter() == XdmfAttributeCenter::Node())
{
toReturn->insert(currAttribute);
}
else if(currAttribute->getAttributeCenter() == XdmfAttributeCenter::Cell())
{
if(!currAttribute->getArray()->isInitialized())
{
currAttribute->getArray()->read();
}
boost::shared_ptr<XdmfAttribute> newAttribute = XdmfAttribute::New();
newAttribute->setName(currAttribute->getName());
newAttribute->setAttributeType(currAttribute->getAttributeType());
newAttribute->setAttributeCenter(currAttribute->getAttributeCenter());
boost::shared_ptr<XdmfArray> vals = newAttribute->getArray();
vals->initialize(currAttribute->getArray()->getType());
vals->resize(currAttribute->getArray()->getSize() * 27, 0);
for(unsigned int j=0; j<currAttribute->getArray()->getSize(); ++j)
{
vals->copyValues(j * 27, currAttribute->getArray(), j, 27, 1, 0);
}
toReturn->insert(newAttribute);
}
}
return toReturn;
}
};
boost::shared_ptr<XdmfGrid> XdmfTopologyConverter::convert(const boost::shared_ptr<XdmfGrid> gridToConvert, const boost::shared_ptr<const XdmfTopologyType> topologyType) const
{
boost::shared_ptr<const XdmfTopologyType> topologyTypeToConvert = gridToConvert->getTopology()->getTopologyType();
......@@ -346,5 +628,13 @@ boost::shared_ptr<XdmfGrid> XdmfTopologyConverter::convert(const boost::shared_p
return converter.convert(gridToConvert);
}
}
else if(topologyTypeToConvert == XdmfTopologyType::Hexahedron_64())
{
if(topologyType == XdmfTopologyType::Hexahedron())
{
Hexahedron64ToHexahedron converter;
return converter.convert(gridToConvert);
}
}
assert(false);
}
......@@ -46,6 +46,7 @@ private:
// Specific Topology Converters
class HexahedronToHexahedron64;
class Hexahedron64ToHexahedron;
// Point comparator
class PointComparison;
......
......@@ -62,5 +62,18 @@ int main(int argc, char* argv[])
assert(i == hex64Grid->getTopology()->getArray()->getValueCopy<unsigned int>(i));
}
/*
* Hexahedron_64 to Hexahedron
*/
boost::shared_ptr<XdmfGrid> newHexGrid = converter->convert(hex64Grid, XdmfTopologyType::Hexahedron());
assert(newHexGrid->getGeometry()->getGeometryType() == XdmfGeometryType::XYZ());
assert(newHexGrid->getGeometry()->getNumberPoints() == 64);
for(unsigned int i=0; i<192; ++i)
{
assert(fabs(expectedPoints[i] - newHexGrid->getGeometry()->getArray()->getValueCopy<double>(i)) < epsilon);
}
assert(newHexGrid->getTopology()->getTopologyType() == XdmfTopologyType::Hexahedron());
assert(newHexGrid->getTopology()->getNumberElements() == 27);
return 0;
}
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