From 2f788a5fdab31e1f50c6757626b582cb1b9cc967 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 5 Dec 2020 13:07:04 +0100 Subject: [PATCH] Enabel GridOut::write_vtk() for pyramids --- source/grid/grid_out.cc | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 5589d31318..fadc5d4fb5 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -3217,11 +3217,30 @@ GridOut::write_vtk(const Triangulation &tria, out << cell->n_vertices(); for (const unsigned int i : cell->vertex_indices()) { - out << ' ' - << cell->vertex_index(GeometryInfo::vertices_per_cell == - cell->n_vertices() ? - GeometryInfo::ucd_to_deal[i] : - i); + out << ' '; + switch (cell->reference_cell_type()) + { + case ReferenceCell::Type::Vertex: + case ReferenceCell::Type::Line: + case ReferenceCell::Type::Quad: + case ReferenceCell::Type::Hex: + out << cell->vertex_index(GeometryInfo::ucd_to_deal[i]); + break; + case ReferenceCell::Type::Tri: + case ReferenceCell::Type::Tet: + case ReferenceCell::Type::Wedge: + out << cell->vertex_index(i); + break; + case ReferenceCell::Type::Pyramid: + { + static const std::array permutation_table{ + {0, 1, 3, 2, 4}}; + out << cell->vertex_index(permutation_table[i]); + break; + } + default: + Assert(false, ExcNotImplemented()); + } } out << '\n'; } -- 2.39.5