From ca33c5aafdd7e6c240238ef4a9c1e94b18c92ac4 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 10 May 2021 11:25:03 -0500 Subject: [PATCH] fix hdf5 output for dimension 0 and 1 --- source/base/data_out_base.cc | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 1bc13689b5..a8f3d607fc 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -8730,39 +8730,33 @@ XDMFEntry::get_xdmf_content(const unsigned int indent_level, ss << indent(indent_level + 3) << h5_mesh_filename << ":/nodes\n"; ss << indent(indent_level + 2) << "\n"; ss << indent(indent_level + 1) << "\n"; + // If we have cells defined, use the topology corresponding to the dimension if (num_cells > 0) { + ss << indent(indent_level + 1) << "\n"; + { + ss << "Polyvertex"; + } else if (dimension == 1) - ss << indent(indent_level + 1) << "\n"; + { + ss << "Polyline"; + } else if (dimension == 2) { Assert(reference_cell == ReferenceCells::Quadrilateral || reference_cell == ReferenceCells::Triangle, ExcNotImplemented()); - ss << indent(indent_level + 1) << "\n" - << indent(indent_level + 2) << "\n" - << indent(indent_level + 2) << "\n" - << indent(indent_level + 2) << "\n" - << indent(indent_level + 2) << "\n"; + ss << "\" NumberOfElements=\"" << num_cells; + if (dimension == 0) + ss << "\" NodesPerElement=\"1\">\n"; + else if (dimension == 1) + ss << "\" NodesPerElement=\"2\">\n"; + else + // no "NodesPerElement" for dimension 2 and higher + ss << "\">\n"; + + ss << indent(indent_level + 2) << "\n"; + ss << indent(indent_level + 3) << h5_mesh_filename << ":/cells\n"; ss << indent(indent_level + 2) << "\n"; ss << indent(indent_level + 1) << "\n"; -- 2.39.5