]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Enable GridTools:min/max_diameter() for wedges 11295/head
authorPeter Munch <peterrmuench@gmail.com>
Wed, 2 Dec 2020 18:57:10 +0000 (19:57 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 2 Dec 2020 22:44:36 +0000 (23:44 +0100)
source/grid/grid_tools.cc

index f97d2eba4b80077d9c9aa1e2dd50698cf314a9a0..9ad875bb2b264f0b4e13c999fe24ab6b0822c822 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.