From de9639cd8b4c776b1deb9fe6158320c28d6de6a1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 18 Nov 2022 16:03:09 -0700 Subject: [PATCH] Simplify yet more code. --- source/base/data_out_base.cc | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 3eea04099d..30889fd792 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -589,22 +589,37 @@ namespace DataOutBase const unsigned int base_entry = index * GeometryInfo::vertices_per_cell; - internal_add_cell(base_entry + 0, start); - if (dim >= 1) + switch (dim) { - internal_add_cell(base_entry + 1, start + d1); - if (dim >= 2) - { - internal_add_cell(base_entry + 2, start + d2 + d1); - internal_add_cell(base_entry + 3, start + d2); - if (dim >= 3) - { - internal_add_cell(base_entry + 4, start + d3); - internal_add_cell(base_entry + 5, start + d3 + d1); - internal_add_cell(base_entry + 6, start + d3 + d2 + d1); - internal_add_cell(base_entry + 7, start + d3 + d2); - } - } + case 0: + internal_add_cell(base_entry + 0, start); + break; + + case 1: + internal_add_cell(base_entry + 0, start); + internal_add_cell(base_entry + 1, start + d1); + break; + + case 2: + internal_add_cell(base_entry + 0, start); + internal_add_cell(base_entry + 1, start + d1); + internal_add_cell(base_entry + 2, start + d2 + d1); + internal_add_cell(base_entry + 3, start + d2); + break; + + case 3: + internal_add_cell(base_entry + 0, start); + internal_add_cell(base_entry + 1, start + d1); + internal_add_cell(base_entry + 2, start + d2 + d1); + internal_add_cell(base_entry + 3, start + d2); + internal_add_cell(base_entry + 4, start + d3); + internal_add_cell(base_entry + 5, start + d3 + d1); + internal_add_cell(base_entry + 6, start + d3 + d2 + d1); + internal_add_cell(base_entry + 7, start + d3 + d2); + break; + + default: + Assert(false, ExcNotImplemented()); } } @@ -3077,6 +3092,8 @@ namespace DataOutBase out.flush_cells(); } + + template void write_high_order_cells(const std::vector> &patches, -- 2.39.5