From: Timo Heister Date: Wed, 29 Jun 2022 19:04:30 +0000 (-0400) Subject: address comment X-Git-Tag: v9.5.0-rc1~1112^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14056%2Fhead;p=dealii.git address comment --- diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 4c03f33ad8..a6a22d09a3 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -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)) +{}