]> https://gitweb.dealii.org/ - dealii.git/commitdiff
ReferenceCell: use std::numeric_limits.
authorDavid Wells <drwells@email.unc.edu>
Sat, 21 Jan 2023 23:15:33 +0000 (18:15 -0500)
committerDavid Wells <drwells@email.unc.edu>
Sun, 22 Jan 2023 20:23:57 +0000 (15:23 -0500)
include/deal.II/grid/reference_cell.h
source/grid/reference_cell.cc

index d8a6e4e7d89e8701e4b4334ca84c6a1090771deb..e7f7e916fe56cf70860a9223e16e2bca3820242d 100644 (file)
@@ -879,7 +879,7 @@ namespace internal
 #ifndef DEAL_II_CXX14_CONSTEXPR_BUG
     // Make sure these are the only indices from which objects can be
     // created.
-    Assert((kind == static_cast<std::uint8_t>(-1)) || (kind < 8),
+    Assert((kind == std::numeric_limits<std::uint8_t>::max()) || (kind < 8),
            ExcInternalError());
 #endif
 
@@ -917,7 +917,8 @@ namespace ReferenceCells
   constexpr const ReferenceCell Hexahedron =
     internal::make_reference_cell_from_int(7);
   constexpr const ReferenceCell Invalid =
-    internal::make_reference_cell_from_int(static_cast<std::uint8_t>(-1));
+    internal::make_reference_cell_from_int(
+      std::numeric_limits<std::uint8_t>::max());
 
   /**
    * Return the correct simplex reference cell type for the given dimension
@@ -2776,7 +2777,7 @@ ReferenceCell::get_orientation_index(const ArrayView<const T> &vertices_0,
     }
 
   Assert(false, (internal::NoPermutation<T>(*this, vertices_0, vertices_1)));
-  return numbers::invalid_unsigned_int;
+  return std::numeric_limits<unsigned char>::max();
 }
 
 
index 3ae63c455624116fd71ec5d6538a21497410475d..83e75fffdc7a54b418f069e66d37de750876487d 100644 (file)
@@ -41,7 +41,7 @@ namespace
   {
     // Define VTK constants for linear, quadratic and
     // high-order Lagrange geometrices
-    enum
+    enum : unsigned int
     {
       VTK_VERTEX = 1,
       // Linear cells
@@ -69,7 +69,7 @@ namespace
       VTK_LAGRANGE_WEDGE         = 73,
       VTK_LAGRANGE_PYRAMID       = 74,
       // Invalid code
-      VTK_INVALID = static_cast<unsigned int>(-1)
+      VTK_INVALID = numbers::invalid_unsigned_int
     };
 
   } // namespace VTKCellType

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.