From 1ba5039ba61322f20b2dcbaee67b23bd62d0b7a8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 19 Nov 2022 18:23:44 -0700 Subject: [PATCH] Convert yet another function. --- source/base/data_out_base.cc | 133 ++++++++++++++++++++++++++--------- 1 file changed, 101 insertions(+), 32 deletions(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 30889fd792..a6639db497 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -1786,19 +1786,41 @@ namespace const unsigned int start = s + 1; stream << gmv_cell_type[dim] << '\n'; - stream << start; - if (dim >= 1) + switch (dim) { - stream << '\t' << start + d1; - if (dim >= 2) + case 0: { + stream << start; + break; + } + + case 1: + { + stream << start; + stream << '\t' << start + d1; + break; + } + + case 2: + { + stream << start; + stream << '\t' << start + d1; stream << '\t' << start + d2 + d1 << '\t' << start + d2; - if (dim >= 3) - { - stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' - << start + d3 + d2 + d1 << '\t' << start + d3 + d2; - } + break; + } + + case 3: + { + stream << start; + stream << '\t' << start + d1; + stream << '\t' << start + d2 + d1 << '\t' << start + d2; + stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' + << start + d3 + d2 + d1 << '\t' << start + d3 + d2; + break; } + + default: + Assert(false, ExcNotImplemented()); } stream << '\n'; } @@ -1832,19 +1854,41 @@ namespace { const unsigned int start = s + 1; - stream << start; - if (dim >= 1) + switch (dim) { - stream << '\t' << start + d1; - if (dim >= 2) + case 0: { + stream << start; + break; + } + + case 1: + { + stream << start; + stream << '\t' << start + d1; + break; + } + + case 2: + { + stream << start; + stream << '\t' << start + d1; stream << '\t' << start + d2 + d1 << '\t' << start + d2; - if (dim >= 3) - { - stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' - << start + d3 + d2 + d1 << '\t' << start + d3 + d2; - } + break; } + + case 3: + { + stream << start; + stream << '\t' << start + d1; + stream << '\t' << start + d2 + d1 << '\t' << start + d2; + stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' + << start + d3 + d2 + d1 << '\t' << start + d3 + d2; + break; + } + + default: + Assert(false, ExcNotImplemented()); } stream << '\n'; } @@ -1934,24 +1978,49 @@ namespace unsigned int d2, unsigned int d3) { - stream << GeometryInfo::vertices_per_cell << '\t' << start; + stream << GeometryInfo::vertices_per_cell << '\t'; - if (dim >= 1) - stream << '\t' << start + d1; - { - if (dim >= 2) - { - stream << '\t' << start + d2 + d1 << '\t' << start + d2; - if (dim >= 3) - { - stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' - << start + d3 + d2 + d1 << '\t' << start + d3 + d2; - } - } - } + switch (dim) + { + case 0: + { + stream << start; + break; + } + + case 1: + { + stream << start; + stream << '\t' << start + d1; + break; + } + + case 2: + { + stream << start; + stream << '\t' << start + d1; + stream << '\t' << start + d2 + d1 << '\t' << start + d2; + break; + } + + case 3: + { + stream << start; + stream << '\t' << start + d1; + stream << '\t' << start + d2 + d1 << '\t' << start + d2; + stream << '\t' << start + d3 << '\t' << start + d3 + d1 << '\t' + << start + d3 + d2 + d1 << '\t' << start + d3 + d2; + break; + } + + default: + Assert(false, ExcNotImplemented()); + } stream << '\n'; } + + void VtkStream::write_cell_single(const unsigned int index, const unsigned int start, -- 2.39.5