Commit 6f03bd17 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

cleanup of source code

parent 12eebf7a
......@@ -28,9 +28,7 @@ namespace Dune { namespace experimental
std::size_t idx = 0;
for (std::size_t i = 0; i < types.size(); ++i) {
if (Vtk::Map::from_type.count(types[i]) == 0)
DUNE_THROW(Exception, "Unknown ElementType: " << types[i]);
auto type = Vtk::Map::from_type[types[i]];
auto type = Vtk::to_geometry(types[i]);
Vtk::CellType cellType{type};
auto refElem = referenceElement<double,Grid::dimension>(type);
......@@ -92,9 +90,7 @@ namespace Dune { namespace experimental
idx = 0;
for (std::size_t i = 0; i < types.size(); ++i) {
if (Vtk::Map::from_type.count(types[i]) == 0)
DUNE_THROW(Exception, "Unknown ElementType: " << types[i]);
auto type = Vtk::Map::from_type[types[i]];
auto type = Vtk::to_geometry(types[i]);
Vtk::CellType cellType{type};
std::size_t nNodes = offsets[i] - (i == 0 ? 0 : offsets[i-1]);
......
......@@ -3,6 +3,7 @@
#include <algorithm>
#include <cctype>
#include <locale>
#include <sstream>
#include <string>
namespace Dune
......@@ -74,8 +75,8 @@ namespace Dune
}
}
template <class InputIter, class SeparaterIter, class Func>
void split(InputIter first, InputIter end, SeparaterIter s_first, SeparaterIter s_end, Func f)
template <class InputIter, class SeparatorIter, class Func>
void split(InputIter first, InputIter end, SeparatorIter s_first, SeparatorIter s_end, Func f)
{
if (first == end)
return;
......@@ -102,4 +103,18 @@ namespace Dune
}
}
template <class InputIter>
std::string join (InputIter first, InputIter end, std::string sep = " ")
{
if (first == end)
return "";
std::ostringstream os;
os << *first++;
while (first != end)
os << sep << *first++;
return os.str();
}
} // end namspace Dune
......@@ -3,6 +3,7 @@
#include <type_traits>
#include <dune/common/std/type_traits.hh>
#include <dune/functions/common/signature.hh>
#include <dune/functions/common/typeerasure.hh>
namespace Dune { namespace experimental
......@@ -162,14 +163,32 @@ namespace Dune { namespace experimental
template <class F>
using HasLocalFunction = decltype(localFunction(std::declval<F>()));
public:
template <class F>
VTKFunction (F&& f, std::string name, int ncomps = 1)
using Signature = typename std::decay_t<F>::Signature;
public:
template <class F,
class Range = typename Functions::SignatureTraits<Signature<F>>::Range>
VTKFunction (F&& f, std::string name, int ncomps = 1,
Vtk::DataTypes type = Vtk::Map::type<Range>)
: Super(std::forward<F>(f))
, name_(std::move(name))
, ncomps_(ncomps > 3 ? 9 : ncomps > 1 ? 3 : 1) // tensor, vector, or scalar
, type_(type)
{
static_assert(Std::is_detected<HasLocalFunction,F>::value,
"Requires A GridFunction to be passed to the VTKFunction.");
}
template <class F,
std::enable_if_t<not Std::is_detected<Signature,F>::value,int> = 0>
VTKFunction (F&& f, std::string name, int ncomps = 1,
Vtk::DataTypes type = Vtk::FLOAT32)
: Super(std::forward<F>(f))
, name_(std::move(name))
, ncomps_(ncomps > 1 ? 3 : 1)
, ncomps_(ncomps > 3 ? 9 : ncomps > 1 ? 3 : 1) // tensor, vector, or scalar
, type_(type)
{
assert(1 <= ncomps && ncomps <= 3);
static_assert(Std::is_detected<HasLocalFunction,F>::value,
"Requires A GridFunction to be passed to the VTKFunction.");
}
......@@ -194,10 +213,16 @@ namespace Dune { namespace experimental
return ncomps_;
}
/// Return the VTK Datatype associated with the functions range type
Vtk::DataTypes type () const
{
return type_;
}
private:
std::string name_;
int ncomps_ = 1;
Vtk::DataTypes type_;
};
}} // end namespace Dune::experimental
......@@ -29,56 +29,39 @@ void VtkImageDataWriter<GV,DC>
}
std::vector<pos_type> offsets; // pos => offset
out << "<VTKFile type=\"ImageData\" version=\"1.0\" "
<< "byte_order=\"" << this->getEndian() << "\" header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\">\n" : ">\n");
out << "<ImageData WholeExtent=\"";
out << "<VTKFile"
<< " type=\"StructuredGrid\""
<< " version=\"1.0\""
<< " byte_order=\"" << this->getEndian() << "\""
<< " header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\"" : "")
<< ">\n";
auto const& wholeExtent = dataCollector_.wholeExtent();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << wholeExtent[2*i] << " " << wholeExtent[2*i+1];
}
out << "\" Origin=\"";
auto const& origin = dataCollector_.origin();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << origin[i];
}
out << "\" Spacing=\"";
auto const& spacing = dataCollector_.spacing();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << spacing[i];
}
out << "\">\n";
dataCollector_.writeLocalPiece([&out](std::array<int,6> const& extent)
{
out << "<Piece Extent=\"";
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << extent[2*i] << " " << extent[2*i+1];
}
out << "\">\n";
out << "<ImageData"
<< " WholeExtent=\"" << join(wholeExtent.begin(), wholeExtent.end()) << "\""
<< " Origin=\"" << join(origin.begin(), origin.end()) << "\""
<< " Spacing=\"" << join(spacing.begin(), spacing.end()) << "\""
<< ">\n";
dataCollector_.writeLocalPiece([&out](auto const& extent) {
out << "<Piece Extent=\"" << join(extent.begin(), extent.end()) << "\">\n";
});
{ // Write data associated with grid points
auto scalar = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PointData" << (scalar != pointData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != pointData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : pointData_)
this->writeData(out, offsets, v, Super::POINT_DATA);
out << "</PointData>\n";
}
// Write data associated with grid points
out << "<PointData" << this->getNames(pointData_) << ">\n";
for (auto const& v : pointData_)
this->writeData(out, offsets, v, Super::POINT_DATA);
out << "</PointData>\n";
// Write data associated with grid cells
out << "<CellData" << this->getNames(cellData_) << ">\n";
for (auto const& v : cellData_)
this->writeData(out, offsets, v, Super::CELL_DATA);
out << "</CellData>\n";
{ // Write data associated with grid cells
auto scalar = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<CellData" << (scalar != cellData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != cellData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : cellData_)
this->writeData(out, offsets, v, Super::CELL_DATA);
out << "</CellData>\n";
}
out << "</Piece>\n";
out << "</ImageData>\n";
......@@ -88,13 +71,13 @@ void VtkImageDataWriter<GV,DC>
out << "<AppendedData encoding=\"raw\">\n_";
appended_pos = out.tellp();
for (auto const& v : pointData_) {
if (datatype_ == Vtk::FLOAT32)
if (v.type() == Vtk::FLOAT32)
blocks.push_back( this->template writeDataAppended<float>(out, v, Super::POINT_DATA) );
else
blocks.push_back( this->template writeDataAppended<double>(out, v, Super::POINT_DATA) );
}
for (auto const& v : cellData_) {
if (datatype_ == Vtk::FLOAT32)
if (v.type() == Vtk::FLOAT32)
blocks.push_back( this->template writeDataAppended<float>(out, v, Super::CELL_DATA) );
else
blocks.push_back( this->template writeDataAppended<double>(out, v, Super::CELL_DATA) );
......@@ -123,63 +106,53 @@ void VtkImageDataWriter<GV,DC>
std::string filename = pfilename + ".p" + this->fileExtension();
std::ofstream out(filename, std::ios_base::ate | std::ios::binary);
out << "<VTKFile type=\"PImageData\" version=\"1.0\" "
<< "byte_order=\"" << this->getEndian() << "\" header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\">\n" : ">\n");
out << "<PImageData GhostLevel=\"0\" WholeExtent=\"";
out << "<VTKFile"
<< " type=\"StructuredGrid\""
<< " version=\"1.0\""
<< " byte_order=\"" << this->getEndian() << "\""
<< " header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\"" : "")
<< ">\n";
auto const& wholeExtent = dataCollector_.wholeExtent();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << wholeExtent[2*i] << " " << wholeExtent[2*i+1];
}
out << "\" Origin=\"";
auto const& origin = dataCollector_.origin();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << origin[i];
}
out << "\" Spacing=\"";
auto const& spacing = dataCollector_.spacing();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << spacing[i];
out << "<PImageData"
<< " GhostLevel=\"0\""
<< " WholeExtent=\"" << join(wholeExtent.begin(), wholeExtent.end()) << "\""
<< " Origin=\"" << join(origin.begin(), origin.end()) << "\""
<< " Spacing=\"" << join(spacing.begin(), spacing.end()) << "\""
<< ">\n";
// Write data associated with grid points
out << "<PPointData" << this->getNames(pointData_) << ">\n";
for (auto const& v : pointData_) {
out << "<PDataArray"
<< " Name=\"" << v.name() << "\""
<< " type=\"" << to_string(v.type()) << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\""
<< " />\n";
}
out << "\">\n";
{ // Write data associated with grid points
auto scalar = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PPointData" << (scalar != pointData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != pointData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : pointData_) {
out << "<PDataArray Name=\"" << v.name() << "\" type=\"" << Vtk::Map::from_datatype[datatype_] << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\" />\n";
}
out << "</PPointData>\n";
}
{ // Write data associated with grid cells
auto scalar = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PCellData" << (scalar != cellData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != cellData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : cellData_) {
out << "<PDataArray Name=\"" << v.name() << "\" type=\"" << Vtk::Map::from_datatype[datatype_] << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\" />\n";
}
out << "</PCellData>\n";
out << "</PPointData>\n";
// Write data associated with grid cells
out << "<PCellData" << this->getNames(cellData_) << ">\n";
for (auto const& v : cellData_) {
out << "<PDataArray"
<< " Name=\"" << v.name() << "\""
<< " type=\"" << to_string(v.type()) << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\""
<< " />\n";
}
out << "</PCellData>\n";
// Write piece file references
dataCollector_.writePieces([&out,pfilename,ext=this->fileExtension()](int p, std::array<int,6> const& extent, bool write_extent)
dataCollector_.writePieces([&out,pfilename,ext=this->fileExtension()](int p, auto const& extent, bool write_extent)
{
out << "<Piece Source=\"" << pfilename << "_p" << std::to_string(p) << "." << ext << "\"";
if (write_extent) {
out << " Extent=\"";
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << extent[2*i] << " " << extent[2*i+1];
}
out << "\"";
}
std::string piece_source = pfilename + "_p" + std::to_string(p) + "." + ext;
out << "<Piece Source=\"" << piece_source << "\"";
if (write_extent)
out << " Extent=\"" << join(extent.begin(), extent.end()) << "\"";
out << " />\n";
});
......
......@@ -29,46 +29,32 @@ void VtkStructuredGridWriter<GV,DC>
}
std::vector<pos_type> offsets; // pos => offset
out << "<VTKFile type=\"StructuredGrid\" version=\"1.0\" "
<< "byte_order=\"" << this->getEndian() << "\" header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\">\n" : ">\n");
out << "<StructuredGrid WholeExtent=\"";
out << "<VTKFile"
<< " type=\"StructuredGrid\""
<< " version=\"1.0\""
<< " byte_order=\"" << this->getEndian() << "\""
<< " header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\"" : "")
<< ">\n";
auto const& wholeExtent = dataCollector_.wholeExtent();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << wholeExtent[2*i] << " " << wholeExtent[2*i+1];
}
out << "\">\n";
out << "<StructuredGrid WholeExtent=\"" << join(wholeExtent.begin(), wholeExtent.end()) << "\">\n";
dataCollector_.writeLocalPiece([&out](std::array<int,6> const& extent)
{
out << "<Piece Extent=\"";
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << extent[2*i] << " " << extent[2*i+1];
}
out << "\">\n";
dataCollector_.writeLocalPiece([&out](auto const& extent) {
out << "<Piece Extent=\"" << join(extent.begin(), extent.end()) << "\">\n";
});
{ // Write data associated with grid points
auto scalar = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PointData" << (scalar != pointData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != pointData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : pointData_)
this->writeData(out, offsets, v, Super::POINT_DATA);
out << "</PointData>\n";
}
// Write data associated with grid points
out << "<PointData" << this->getNames(pointData_) << ">\n";
for (auto const& v : pointData_)
this->writeData(out, offsets, v, Super::POINT_DATA);
out << "</PointData>\n";
{ // Write data associated with grid cells
auto scalar = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<CellData" << (scalar != cellData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != cellData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : cellData_)
this->writeData(out, offsets, v, Super::CELL_DATA);
out << "</CellData>\n";
}
// Write data associated with grid cells
out << "<CellData" << this->getNames(cellData_) << ">\n";
for (auto const& v : cellData_)
this->writeData(out, offsets, v, Super::CELL_DATA);
out << "</CellData>\n";
// Write point coordinates
out << "<Points>\n";
......@@ -84,17 +70,18 @@ void VtkStructuredGridWriter<GV,DC>
out << "<AppendedData encoding=\"raw\">\n_";
appended_pos = out.tellp();
for (auto const& v : pointData_) {
if (datatype_ == Vtk::FLOAT32)
if (v.type() == Vtk::FLOAT32)
blocks.push_back( this->template writeDataAppended<float>(out, v, Super::POINT_DATA) );
else
blocks.push_back( this->template writeDataAppended<double>(out, v, Super::POINT_DATA) );
}
for (auto const& v : cellData_) {
if (datatype_ == Vtk::FLOAT32)
if (v.type() == Vtk::FLOAT32)
blocks.push_back( this->template writeDataAppended<float>(out, v, Super::CELL_DATA) );
else
blocks.push_back( this->template writeDataAppended<double>(out, v, Super::CELL_DATA) );
}
if (datatype_ == Vtk::FLOAT32)
blocks.push_back( this->template writePointsAppended<float>(out) );
else
......@@ -123,58 +110,57 @@ void VtkStructuredGridWriter<GV,DC>
std::string filename = pfilename + ".p" + this->fileExtension();
std::ofstream out(filename, std::ios_base::ate | std::ios::binary);
out << "<VTKFile type=\"PStructuredGrid\" version=\"1.0\" "
<< "byte_order=\"" << this->getEndian() << "\" header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\">\n" : ">\n");
out << "<PStructuredGrid GhostLevel=\"0\" WholeExtent=\"";
out << "<VTKFile"
<< " type=\"PStructuredGrid\""
<< " version=\"1.0\""
<< " byte_order=\"" << this->getEndian() << "\""
<< " header_type=\"UInt64\""
<< (format_ == Vtk::COMPRESSED ? " compressor=\"vtkZLibDataCompressor\"" : "")
<< ">\n";
auto const& wholeExtent = dataCollector_.wholeExtent();
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << wholeExtent[2*i] << " " << wholeExtent[2*i+1];
out << "<PStructuredGrid"
<< " GhostLevel=\"0\""
<< " WholeExtent=\"" << join(wholeExtent.begin(), wholeExtent.end()) << "\""
<< ">\n";
// Write data associated with grid points
out << "<PPointData" << this->getNames(pointData_) << ">\n";
for (auto const& v : pointData_) {
out << "<PDataArray"
<< " Name=\"" << v.name() << "\""
<< " type=\"" << to_string(v.type()) << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\""
<< " />\n";
}
out << "\">\n";
{ // Write data associated with grid points
auto scalar = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(pointData_.begin(), pointData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PPointData" << (scalar != pointData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != pointData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : pointData_) {
out << "<PDataArray Name=\"" << v.name() << "\" type=\"" << Vtk::Map::from_datatype[datatype_] << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\" />\n";
}
out << "</PPointData>\n";
}
{ // Write data associated with grid cells
auto scalar = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() == 1; });
auto vector = std::find_if(cellData_.begin(), cellData_.end(), [](auto const& v) { return v.ncomps() > 1; });
out << "<PCellData" << (scalar != cellData_.end() ? " Scalars=\"" + scalar->name() + "\"" : "")
<< (vector != cellData_.end() ? " Vectors=\"" + vector->name() + "\"" : "")
<< ">\n";
for (auto const& v : cellData_) {
out << "<PDataArray Name=\"" << v.name() << "\" type=\"" << Vtk::Map::from_datatype[datatype_] << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\" />\n";
}
out << "</PCellData>\n";
out << "</PPointData>\n";
// Write data associated with grid cells
out << "<PCellData" << this->getNames(cellData_) << ">\n";
for (auto const& v : cellData_) {
out << "<PDataArray"
<< " Name=\"" << v.name() << "\""
<< " type=\"" << to_string(v.type()) << "\""
<< " NumberOfComponents=\"" << v.ncomps() << "\""
<< " />\n";
}
out << "</PCellData>\n";
// Write points
out << "<PPoints>\n";
out << "<PDataArray type=\"" << Vtk::Map::from_datatype[datatype_] << "\" NumberOfComponents=\"3\" />\n";
out << "<PDataArray"
<< " type=\"" << to_string(datatype_) << "\""
<< " NumberOfComponents=\"3\""
<< " />\n";
out << "</PPoints>\n";
// Write piece file references
dataCollector_.writePieces([&out,pfilename,ext=this->fileExtension()](int p, std::array<int,6> const& extent, bool write_extent)
dataCollector_.writePieces([&out,pfilename,ext=this->fileExtension()](int p, auto const& extent, bool write_extent)
{
out << "<Piece Source=\"" << pfilename << "_p" << std::to_string(p) << "." << ext << "\"";
if (write_extent) {
out << " Extent=\"";
for (int i = 0; i < 3; ++i) {
out << (i == 0 ? "" : " ") << extent[2*i] << " " << extent[2*i+1];
}
out << "\"";
}
std::string piece_source = pfilename + "_p" + std::to_string(p) + "." + ext;
out << "<Piece Source=\"" << piece_source << "\"";
if (write_extent)
out << " Extent=\"" << join(extent.begin(), extent.end()) << "\"";
out << " />\n";
});
......
......@@ -5,16 +5,55 @@
namespace Dune { namespace experimental {
namespace Vtk {
std::map<std::uint8_t, GeometryType> Map::from_type = {
{VERTEX, GeometryTypes::vertex },
{LINE, GeometryTypes::line },
{TRIANGLE, GeometryTypes::triangle },
{QUAD, GeometryTypes::quadrilateral },
{TETRA, GeometryTypes::tetrahedron },
{HEXAHEDRON, GeometryTypes::hexahedron },
{WEDGE, GeometryTypes::prism },
{PYRAMID, GeometryTypes::pyramid },
};
std::string to_string (FormatTypes type)
{
switch (type) {
case ASCII: return "ascii";
case BINARY: return "binary";
case COMPRESSED: return "compressed";
case APPENDED: return "appended";
default:
DUNE_THROW(RangeError, "FormatType not found.");
std::abort();
}
}
std::string to_string (DataTypes type)
{
switch (type) {
case INT8: return "Int8";
case UINT8: return "UInt8";
case INT16: return "Int16";
case UINT16: return "UInt16";
case INT32: return "Int32";
case UINT32: return "UInt32";
case INT64: return "Int64";
case UINT64: return "UInt64";
case FLOAT32: return "Float32";
case FLOAT64: return "Float64";
default:
DUNE_THROW(RangeError, "DataType not found.");
std::abort();
}
}
GeometryType to_geometry (std::uint8_t cell)
{
switch (cell) {
case VERTEX: return GeometryTypes::vertex;
case LINE: return GeometryTypes::line;
case TRIANGLE: return GeometryTypes::triangle;
case QUAD: return GeometryTypes::quadrilateral;
case TETRA: return GeometryTypes::tetrahedron;
case HEXAHEDRON: return GeometryTypes::hexahedron;
case WEDGE: return GeometryTypes::prism;
case PYRAMID: return GeometryTypes