]> https://gitweb.dealii.org/ - dealii.git/commitdiff
address comment 14056/head
authorTimo Heister <timo.heister@gmail.com>
Wed, 29 Jun 2022 19:04:30 +0000 (15:04 -0400)
committerTimo Heister <timo.heister@gmail.com>
Wed, 29 Jun 2022 19:04:30 +0000 (15:04 -0400)
source/base/data_out_base.cc

index 4c03f33ad8cef13f3a451d171b907b99b6e60670..a6a22d09a3f852a9151038c40c08ae4c09f64c94 100644 (file)
@@ -9209,6 +9209,39 @@ XDMFEntry::XDMFEntry(const std::string & mesh_filename,
 
 
 
+namespace
+{
+  /**
+   * Deprecated XDMFEntry constructors do not fill the cell_type, so we use this
+   * little helper to convert it to the appropriate hex cell.
+   */
+  ReferenceCell
+  cell_type_hex_if_invalid(const ReferenceCell &cell_type,
+                           const unsigned int   dimension)
+  {
+    if (cell_type == ReferenceCells::Invalid)
+      {
+        switch (dimension)
+          {
+            case 0:
+              return ReferenceCells::get_hypercube<0>();
+            case 1:
+              return ReferenceCells::get_hypercube<1>();
+            case 2:
+              return ReferenceCells::get_hypercube<2>();
+            case 3:
+              return ReferenceCells::get_hypercube<3>();
+            default:
+              AssertThrow(false, ExcMessage("Invalid dimension"));
+          }
+      }
+    else
+      return cell_type;
+  }
+} // namespace
+
+
+
 XDMFEntry::XDMFEntry(const std::string &  mesh_filename,
                      const std::string &  solution_filename,
                      const double         time,
@@ -9225,29 +9258,8 @@ XDMFEntry::XDMFEntry(const std::string &  mesh_filename,
   , num_cells(cells)
   , dimension(dim)
   , space_dimension(spacedim)
-  , cell_type(cell_type_)
-{
-  if (cell_type == ReferenceCells::Invalid)
-    {
-      switch (dimension)
-        {
-          case 0:
-            cell_type = ReferenceCells::get_hypercube<0>();
-            break;
-          case 1:
-            cell_type = ReferenceCells::get_hypercube<1>();
-            break;
-          case 2:
-            cell_type = ReferenceCells::get_hypercube<2>();
-            break;
-          case 3:
-            cell_type = ReferenceCells::get_hypercube<3>();
-            break;
-          default:
-            AssertThrow(false, ExcMessage("Invalid dimension"));
-        }
-    }
-}
+  , cell_type(cell_type_hex_if_invalid(cell_type_, dim))
+{}
 
 
 

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.