From f41e5b79a9459e8f190c6c979604f76ab501b759 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 2 Dec 2020 19:57:10 +0100 Subject: [PATCH] Enable GridTools:min/max_diameter() for wedges --- source/grid/grid_tools.cc | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index f97d2eba4b..9ad875bb2b 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -3107,25 +3107,37 @@ namespace GridTools case ReferenceCell::Type::Line: return (vertices[1] - vertices[0]).norm(); case ReferenceCell::Type::Tri: - return std::max(std::max((vertices[1] - vertices[0]).norm(), - (vertices[2] - vertices[1]).norm()), - (vertices[2] - vertices[0]).norm()); + return std::max({(vertices[1] - vertices[0]).norm(), + (vertices[2] - vertices[1]).norm(), + (vertices[2] - vertices[0]).norm()}); case ReferenceCell::Type::Quad: - return std::max((vertices[3] - vertices[0]).norm(), - (vertices[2] - vertices[1]).norm()); + return std::max({(vertices[3] - vertices[0]).norm(), + (vertices[2] - vertices[1]).norm()}); case ReferenceCell::Type::Tet: - return std::max( - std::max(std::max((vertices[1] - vertices[0]).norm(), - (vertices[2] - vertices[0]).norm()), - std::max((vertices[2] - vertices[1]).norm(), - (vertices[3] - vertices[0]).norm())), - std::max((vertices[3] - vertices[1]).norm(), - (vertices[3] - vertices[2]).norm())); + return std::max({(vertices[1] - vertices[0]).norm(), + (vertices[2] - vertices[0]).norm(), + (vertices[2] - vertices[1]).norm(), + (vertices[3] - vertices[0]).norm(), + (vertices[3] - vertices[1]).norm(), + (vertices[3] - vertices[2]).norm()}); + case ReferenceCell::Type::Wedge: + return std::max({(vertices[4] - vertices[0]).norm(), + (vertices[3] - vertices[1]).norm(), + (vertices[5] - vertices[1]).norm(), + (vertices[4] - vertices[2]).norm(), + (vertices[5] - vertices[0]).norm(), + (vertices[3] - vertices[2]).norm(), + (vertices[1] - vertices[0]).norm(), + (vertices[2] - vertices[1]).norm(), + (vertices[2] - vertices[0]).norm(), + (vertices[4] - vertices[3]).norm(), + (vertices[5] - vertices[4]).norm(), + (vertices[5] - vertices[3]).norm()}); case ReferenceCell::Type::Hex: - return std::max(std::max((vertices[7] - vertices[0]).norm(), - (vertices[6] - vertices[1]).norm()), - std::max((vertices[2] - vertices[5]).norm(), - (vertices[3] - vertices[4]).norm())); + return std::max({(vertices[7] - vertices[0]).norm(), + (vertices[6] - vertices[1]).norm(), + (vertices[2] - vertices[5]).norm(), + (vertices[3] - vertices[4]).norm()}); default: Assert(false, ExcNotImplemented()); return -1e10; -- 2.39.5