From 187af39b5946d8d1cbc60a35c27ccff3f305fa3a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 14 Jan 2021 10:55:37 -0700 Subject: [PATCH] Make code slightly easier to read. --- source/simplex/fe_lib.cc | 54 +++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/source/simplex/fe_lib.cc b/source/simplex/fe_lib.cc index 78bfcdd0f0..d0c7ac1cc3 100644 --- a/source/simplex/fe_lib.cc +++ b/source/simplex/fe_lib.cc @@ -69,60 +69,52 @@ namespace Simplex { // We don't really have dim = 1 support for simplex elements yet, but // its convenient for populating the face array + Assert(degree <= 2, ExcNotImplemented()); if (degree >= 1) { unit_points.emplace_back(0.0); unit_points.emplace_back(1.0); - } - if (degree == 2) - { - unit_points.emplace_back(0.5); - } - if (degree > 2) - { - Assert(false, ExcNotImplemented()); + + if (degree == 2) + unit_points.emplace_back(0.5); } } else if (dim == 2) { + Assert(degree <= 2, ExcNotImplemented()); if (degree >= 1) { unit_points.emplace_back(0.0, 0.0); unit_points.emplace_back(1.0, 0.0); unit_points.emplace_back(0.0, 1.0); - } - if (degree == 2) - { - unit_points.emplace_back(0.5, 0.0); - unit_points.emplace_back(0.5, 0.5); - unit_points.emplace_back(0.0, 0.5); - } - if (degree > 3) - { - Assert(false, ExcNotImplemented()); + + if (degree == 2) + { + unit_points.emplace_back(0.5, 0.0); + unit_points.emplace_back(0.5, 0.5); + unit_points.emplace_back(0.0, 0.5); + } } } else if (dim == 3) { + Assert(degree <= 2, ExcNotImplemented()); if (degree >= 1) { unit_points.emplace_back(0.0, 0.0, 0.0); unit_points.emplace_back(1.0, 0.0, 0.0); unit_points.emplace_back(0.0, 1.0, 0.0); unit_points.emplace_back(0.0, 0.0, 1.0); - } - if (degree == 2) - { - unit_points.emplace_back(0.5, 0.0, 0.0); - unit_points.emplace_back(0.5, 0.5, 0.0); - unit_points.emplace_back(0.0, 0.5, 0.0); - unit_points.emplace_back(0.0, 0.0, 0.5); - unit_points.emplace_back(0.5, 0.0, 0.5); - unit_points.emplace_back(0.0, 0.5, 0.5); - } - if (degree == 3) - { - Assert(false, ExcNotImplemented()); + + if (degree == 2) + { + unit_points.emplace_back(0.5, 0.0, 0.0); + unit_points.emplace_back(0.5, 0.5, 0.0); + unit_points.emplace_back(0.0, 0.5, 0.0); + unit_points.emplace_back(0.0, 0.0, 0.5); + unit_points.emplace_back(0.5, 0.0, 0.5); + unit_points.emplace_back(0.0, 0.5, 0.5); + } } } else -- 2.39.5