]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Enabel GridOut::write_vtk() for pyramids 11328/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 5 Dec 2020 12:07:04 +0000 (13:07 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 9 Dec 2020 08:38:02 +0000 (09:38 +0100)
source/grid/grid_out.cc

index 5589d313181d5ef6ad866b70689492a9c0798a1f..fadc5d4fb5d26735e307e6648ad427d65a45ed39 100644 (file)
@@ -3217,11 +3217,30 @@ GridOut::write_vtk(const Triangulation<dim, spacedim> &tria,
         out << cell->n_vertices();
         for (const unsigned int i : cell->vertex_indices())
           {
-            out << ' '
-                << cell->vertex_index(GeometryInfo<dim>::vertices_per_cell ==
-                                          cell->n_vertices() ?
-                                        GeometryInfo<dim>::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<dim>::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<unsigned int, 5> permutation_table{
+                      {0, 1, 3, 2, 4}};
+                    out << cell->vertex_index(permutation_table[i]);
+                    break;
+                  }
+                default:
+                  Assert(false, ExcNotImplemented());
+              }
           }
         out << '\n';
       }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.