]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make more functions __host__ __device__
authorBruno Turcksin <bruno.turcksin@gmail.com>
Thu, 16 Mar 2023 17:41:24 +0000 (13:41 -0400)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Thu, 6 Apr 2023 13:10:39 +0000 (13:10 +0000)
include/deal.II/base/geometry_info.h
include/deal.II/base/utilities.h

index 76de3d69ace4a17dac249076ea2d891d25df6a23..4ae92aa8c3ce904fda4e01c972e1e4a68791134c 100644 (file)
@@ -819,7 +819,7 @@ public:
    * mapping from the symbolic flags defined in the RefinementPossibilities
    * base class to actual numerical values (the array indices).
    */
-  operator std::uint8_t() const;
+  DEAL_II_HOST_DEVICE operator std::uint8_t() const;
 
   /**
    * Return the union of the refinement flags represented by the current
@@ -2814,7 +2814,7 @@ inline RefinementCase<dim>::RefinementCase(const std::uint8_t refinement_case)
 
 
 template <int dim>
-inline RefinementCase<dim>::operator std::uint8_t() const
+inline DEAL_II_HOST_DEVICE RefinementCase<dim>::operator std::uint8_t() const
 {
   return value;
 }
index df2eb7c0e8dd427756f15fc9705f22b94d35c6f7..e14a858879aa37f712c209d662dac696b4b8920d 100644 (file)
@@ -443,22 +443,22 @@ namespace Utilities
    * be an integer type and the exponent @p iexp must not be negative.
    */
   template <typename T>
-  constexpr T
+  constexpr DEAL_II_HOST_DEVICE T
   pow(const T base, const int iexp)
   {
 #if defined(DEBUG) && !defined(DEAL_II_CXX14_CONSTEXPR_BUG)
     // Up to __builtin_expect this is the same code as in the 'Assert' macro.
     // The call to __builtin_expect turns out to be problematic.
-    if (!(iexp >= 0))
-      ::dealii::deal_II_exceptions::internals::issue_error_noreturn(
-        ::dealii::deal_II_exceptions::internals::ExceptionHandling::
-          abort_or_throw_on_exception,
-        __FILE__,
-        __LINE__,
-        __PRETTY_FUNCTION__,
-        "iexp>=0",
-        "ExcMessage(\"The exponent must not be negative!\")",
-        ExcMessage("The exponent must not be negative!"));
+    KOKKOS_IF_ON_HOST(if (!(iexp >= 0))::dealii::deal_II_exceptions::internals::
+                        issue_error_noreturn(
+                          ::dealii::deal_II_exceptions::internals::
+                            ExceptionHandling::abort_or_throw_on_exception,
+                          __FILE__,
+                          __LINE__,
+                          __PRETTY_FUNCTION__,
+                          "iexp>=0",
+                          "ExcMessage(\"The exponent must not be negative!\")",
+                          ExcMessage("The exponent must not be negative!"));)
 #endif
     // The "exponentiation by squaring" algorithm used below has to be
     // compressed to one statement due to C++11's restrictions on constexpr

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.