From: Peter Munch Date: Sat, 5 Dec 2020 12:07:04 +0000 (+0100) Subject: Enabel GridOut::write_vtk() for pyramids X-Git-Tag: v9.3.0-rc1~772^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11328%2Fhead;p=dealii.git Enabel GridOut::write_vtk() for pyramids --- 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'; }