From 79417cc6b41426af7e8aeab6a9f5c351027ef464 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 25 Feb 2023 10:40:48 -0500 Subject: [PATCH] Fix host-device annotations --- include/deal.II/base/array_view.h | 9 +- include/deal.II/base/config.h.in | 14 + include/deal.II/base/symmetric_tensor.h | 391 ++++++++++-------- include/deal.II/base/table_indices.h | 4 +- include/deal.II/base/tensor.h | 2 +- include/deal.II/lac/read_write_vector.h | 3 +- .../physics/elasticity/standard_tensors.h | 26 +- 7 files changed, 245 insertions(+), 204 deletions(-) diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 31a5435823..9a118dbcdf 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -319,8 +319,8 @@ public: * Return a pointer to the underlying array serving as element storage. * In case the container is empty a nullptr is returned. */ - value_type * - data() const noexcept; + DEAL_II_HOST_DEVICE value_type * + data() const noexcept; /** * Return an iterator pointing to the beginning of the array view. @@ -539,8 +539,9 @@ ArrayView::operator!=( template -inline typename ArrayView::value_type * -ArrayView::data() const noexcept +inline DEAL_II_HOST_DEVICE + typename ArrayView::value_type * + ArrayView::data() const noexcept { if (n_elements == 0) return nullptr; diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index b2b830344d..c6ef29e331 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -173,6 +173,20 @@ #endif #cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@ #cmakedefine DEAL_II_CONSTEXPR @DEAL_II_CONSTEXPR@ +// clang++ assumes that all constexpr functions are __host__ __device__ when +// compiling CUDA code, i.e, when Kokkos was configured with CUDA support. +// This is problematic when calling non-constexpr functions in constexpr +// functions. Also, we intend constexpr functions to only be device-callable if +// not marked with DEAL_II_HOST_DEVICE. Hence, just annotate constexpr +// functions additionally with "__host__". +#if defined(DEAL_II_CONSTEXPR) +# if defined(__clang__) && defined(__CUDA__) +# define DEAL_II_CONSTEXPR_FUNCTION DEAL_II_CONSTEXPR __host__ +# else +# define DEAL_II_CONSTEXPR_FUNCTION DEAL_II_CONSTEXPR +# endif +#endif + // defined for backwards compatibility with older deal.II versions #define DEAL_II_WITH_CXX11 diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index 4a8397a6d0..580e257c1c 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -45,8 +45,9 @@ class SymmetricTensor; * @relatesalso SymmetricTensor */ template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - unit_symmetric_tensor(); +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<2, dim, Number> + unit_symmetric_tensor(); /** * Return the tensor of rank 4 that, when multiplied by a symmetric rank 2 @@ -77,8 +78,9 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> * @relatesalso SymmetricTensor */ template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> - deviator_tensor(); +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<4, dim, Number> + deviator_tensor(); /** * Return the fourth-order symmetric identity tensor $\mathbb S$ which maps @@ -118,16 +120,17 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> * @relatesalso SymmetricTensor */ template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> - identity_tensor(); +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<4, dim, Number> + identity_tensor(); template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - invert(const SymmetricTensor<2, dim, Number> &); +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> +invert(const SymmetricTensor<2, dim, Number> &); template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> - invert(const SymmetricTensor<4, dim, Number> &); +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> +invert(const SymmetricTensor<4, dim, Number> &); /** * Compute and return the trace of a tensor of rank 2, i.e. the sum of its @@ -139,7 +142,7 @@ constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number trace(const SymmetricTensor<2, dim2, Number> &); /** @@ -153,8 +156,9 @@ trace(const SymmetricTensor<2, dim2, Number> &); * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> -deviator(const SymmetricTensor<2, dim, Number> &); +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<2, dim, Number> + deviator(const SymmetricTensor<2, dim, Number> &); /** * Compute the determinant of a rank 2 symmetric tensor. The determinant is @@ -170,7 +174,7 @@ deviator(const SymmetricTensor<2, dim, Number> &); * @relatesalso SymmetricTensor */ template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number determinant(const SymmetricTensor<2, dim, Number> &); @@ -246,7 +250,7 @@ namespace internal * put at position position. The remaining indices remain in * invalid state. */ - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<2> + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE TableIndices<2> merge(const TableIndices<2> &previous_indices, const unsigned int new_index, const unsigned int position) @@ -267,7 +271,7 @@ namespace internal * put at position position. The remaining indices remain in * invalid state. */ - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<4> + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE TableIndices<4> merge(const TableIndices<4> &previous_indices, const unsigned int new_index, const unsigned int position) @@ -502,27 +506,27 @@ namespace internal * This guarantees that the accessor objects go out of scope earlier * than the mother object, avoid problems with data consistency. */ - constexpr Accessor(tensor_type & tensor, - const TableIndices &previous_indices); + DEAL_II_CONSTEXPR_FUNCTION + Accessor(tensor_type &tensor, const TableIndices &previous_indices); /** * Copy constructor. */ - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Accessor(const Accessor &) = default; public: /** * Index operator. */ - constexpr Accessor - operator[](const unsigned int i); + DEAL_II_CONSTEXPR_FUNCTION Accessor + operator[](const unsigned int i); /** * Index operator. */ - constexpr Accessor - operator[](const unsigned int i) const; + DEAL_II_CONSTEXPR_FUNCTION Accessor + operator[](const unsigned int i) const; private: /** @@ -584,26 +588,26 @@ namespace internal * This guarantees that the accessor objects go out of scope earlier * than the mother object, avoid problems with data consistency. */ - constexpr Accessor(tensor_type & tensor, - const TableIndices &previous_indices); + DEAL_II_CONSTEXPR_FUNCTION + Accessor(tensor_type &tensor, const TableIndices &previous_indices); /** * Copy constructor. */ - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Accessor(const Accessor &) = default; public: /** * Index operator. */ - constexpr reference + DEAL_II_CONSTEXPR_FUNCTION reference operator[](const unsigned int); /** * Index operator. */ - constexpr reference + DEAL_II_CONSTEXPR_FUNCTION reference operator[](const unsigned int) const; private: @@ -733,7 +737,7 @@ public: /** * Default constructor. Creates a tensor with all entries equal to zero. */ - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor() = default; /** @@ -767,7 +771,8 @@ public: * the object from the internal namespace is to work around bugs in some * older compilers. */ - constexpr SymmetricTensor(const Number (&array)[n_independent_components]); + DEAL_II_CONSTEXPR_FUNCTION + SymmetricTensor(const Number (&array)[n_independent_components]); /** * Copy constructor from tensors with different underlying scalar type. This @@ -775,7 +780,7 @@ public: * Number. */ template - constexpr explicit SymmetricTensor( + DEAL_II_CONSTEXPR_FUNCTION explicit SymmetricTensor( const SymmetricTensor &initializer); /** @@ -834,7 +839,7 @@ public: * @p Number. */ template - constexpr SymmetricTensor & + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & operator=(const SymmetricTensor &rhs); /** @@ -843,39 +848,39 @@ public: * value allowed for d, allowing the intuitive notation * $\mathbf A = 0$ to reset all elements of the tensor to zero. */ - constexpr SymmetricTensor & - operator=(const Number &d); + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & + operator=(const Number &d); /** * Convert the present symmetric tensor into a full tensor with the same * elements, but using the different storage scheme of full tensors. */ - constexpr operator Tensor() const; + DEAL_II_CONSTEXPR_FUNCTION operator Tensor() const; /** * Test for equality of two tensors. */ - constexpr bool + DEAL_II_CONSTEXPR_FUNCTION bool operator==(const SymmetricTensor &) const; /** * Test for inequality of two tensors. */ - constexpr bool + DEAL_II_CONSTEXPR_FUNCTION bool operator!=(const SymmetricTensor &) const; /** * Add another tensor. */ template - constexpr SymmetricTensor & + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & operator+=(const SymmetricTensor &); /** * Subtract another tensor. */ template - constexpr SymmetricTensor & + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & operator-=(const SymmetricTensor &); /** @@ -883,20 +888,20 @@ public: * factor. */ template - constexpr SymmetricTensor & - operator*=(const OtherNumber &factor); + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & + operator*=(const OtherNumber &factor); /** * Scale the tensor by 1/factor. */ template - constexpr SymmetricTensor & - operator/=(const OtherNumber &factor); + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor & + operator/=(const OtherNumber &factor); /** * Unary minus operator. Negate all entries of a tensor. */ - constexpr SymmetricTensor + DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor operator-() const; /** @@ -952,7 +957,7 @@ public: * symmetric tensors. */ template - DEAL_II_CONSTEXPR typename internal::SymmetricTensorAccessors:: + DEAL_II_CONSTEXPR_FUNCTION typename internal::SymmetricTensorAccessors:: double_contraction_result::type operator*(const SymmetricTensor<2, dim, OtherNumber> &s) const; @@ -961,27 +966,27 @@ public: * two indices of the rank-4 symmetric tensor given as argument. */ template - DEAL_II_CONSTEXPR typename internal::SymmetricTensorAccessors:: + DEAL_II_CONSTEXPR_FUNCTION typename internal::SymmetricTensorAccessors:: double_contraction_result::type operator*(const SymmetricTensor<4, dim, OtherNumber> &s) const; /** * Return a read-write reference to the indicated element. */ - constexpr Number & - operator()(const TableIndices &indices); + DEAL_II_CONSTEXPR_FUNCTION Number & + operator()(const TableIndices &indices); /** * Return a @p const reference to the value referred to by the argument. */ - constexpr const Number & + DEAL_II_CONSTEXPR_FUNCTION const Number & operator()(const TableIndices &indices) const; /** * Access the elements of a row of this symmetric tensor. This function is * called for constant tensors. */ - constexpr internal::SymmetricTensorAccessors:: + DEAL_II_CONSTEXPR_FUNCTION internal::SymmetricTensorAccessors:: Accessor operator[](const unsigned int row) const; @@ -989,7 +994,7 @@ public: * Access the elements of a row of this symmetric tensor. This function is * called for non-constant tensors. */ - constexpr internal::SymmetricTensorAccessors:: + DEAL_II_CONSTEXPR_FUNCTION internal::SymmetricTensorAccessors:: Accessor operator[](const unsigned int row); @@ -998,7 +1003,7 @@ public: * * Exactly the same as operator(). */ - constexpr const Number & + DEAL_II_CONSTEXPR_FUNCTION const Number & operator[](const TableIndices &indices) const; /** @@ -1006,8 +1011,8 @@ public: * * Exactly the same as operator(). */ - constexpr Number & - operator[](const TableIndices &indices); + DEAL_II_CONSTEXPR_FUNCTION Number & + operator[](const TableIndices &indices); /** * Access to an element according to unrolled index. The function @@ -1015,7 +1020,7 @@ public: * s[s.unrolled_to_component_indices(unrolled_index)], but more * efficiently. */ - constexpr const Number & + DEAL_II_CONSTEXPR_FUNCTION const Number & access_raw_entry(const unsigned int unrolled_index) const; /** @@ -1024,7 +1029,7 @@ public: * s[s.unrolled_to_component_indices(unrolled_index)], but more * efficiently. */ - constexpr Number & + DEAL_II_CONSTEXPR_FUNCTION Number & access_raw_entry(const unsigned int unrolled_index); /** @@ -1036,7 +1041,7 @@ public: * upper right as well as lower left entries, not just one of them, although * they are equal for symmetric tensors). */ - constexpr typename numbers::NumberTraits::real_type + DEAL_II_CONSTEXPR_FUNCTION typename numbers::NumberTraits::real_type norm() const; /** @@ -1046,7 +1051,7 @@ public: * [0,n_independent_components) the given entry in a symmetric * tensor has. */ - static constexpr unsigned int + static DEAL_II_CONSTEXPR_FUNCTION unsigned int component_to_unrolled_index(const TableIndices &indices); /** @@ -1054,7 +1059,7 @@ public: * form of the tensor, return what set of indices $(k,l)$ (for rank-2 * tensors) or $(k,l,m,n)$ (for rank-4 tensors) corresponds to it. */ - static constexpr TableIndices + static DEAL_II_CONSTEXPR_FUNCTION TableIndices unrolled_to_component_indices(const unsigned int i); /** @@ -1069,15 +1074,15 @@ public: * and indeed the state where all elements have a zero value is the state * right after construction of such an object. */ - constexpr void + DEAL_II_CONSTEXPR_FUNCTION void clear(); /** * Determine an estimate for the memory consumption (in bytes) of this * object. */ - static constexpr std::size_t - memory_consumption(); + static DEAL_II_CONSTEXPR_FUNCTION std::size_t + memory_consumption(); /** * Read or write the data of this object to or from a stream for the purpose @@ -1113,28 +1118,28 @@ private: // Make a few more functions friends. template - friend constexpr Number2 + friend DEAL_II_CONSTEXPR_FUNCTION Number2 trace(const SymmetricTensor<2, dim2, Number2> &d); template - friend DEAL_II_CONSTEXPR Number2 + friend DEAL_II_CONSTEXPR_FUNCTION Number2 determinant(const SymmetricTensor<2, dim2, Number2> &t); template - friend constexpr SymmetricTensor<2, dim2, Number2> + friend DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<2, dim2, Number2> deviator(const SymmetricTensor<2, dim2, Number2> &t); template - friend DEAL_II_CONSTEXPR SymmetricTensor<2, dim2, Number2> - unit_symmetric_tensor(); + friend DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<2, dim2, Number2> + unit_symmetric_tensor(); template - friend DEAL_II_CONSTEXPR SymmetricTensor<4, dim2, Number2> - deviator_tensor(); + friend DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim2, Number2> + deviator_tensor(); template - friend DEAL_II_CONSTEXPR SymmetricTensor<4, dim2, Number2> - identity_tensor(); + friend DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim2, Number2> + identity_tensor(); // Make a few helper classes friends as well. @@ -1165,7 +1170,7 @@ namespace internal namespace SymmetricTensorAccessors { template - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Accessor::Accessor( tensor_type & tensor, const TableIndices &previous_indices) @@ -1176,7 +1181,7 @@ namespace internal template - constexpr inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Accessor Accessor::operator[]( const unsigned int i) @@ -1188,8 +1193,8 @@ namespace internal template - constexpr DEAL_II_ALWAYS_INLINE - Accessor + DEAL_II_CONSTEXPR_FUNCTION + DEAL_II_ALWAYS_INLINE Accessor Accessor::operator[]( const unsigned int i) const { @@ -1200,7 +1205,7 @@ namespace internal template - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Accessor::Accessor( tensor_type & tensor, const TableIndices &previous_indices) @@ -1211,7 +1216,7 @@ namespace internal template - constexpr inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename Accessor::reference Accessor::operator[]( const unsigned int i) @@ -1221,7 +1226,7 @@ namespace internal template - constexpr DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE typename Accessor::reference Accessor::operator[]( const unsigned int i) const @@ -1257,7 +1262,7 @@ SymmetricTensor::SymmetricTensor( template template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor::SymmetricTensor( const SymmetricTensor &initializer) : data(initializer.data) @@ -1266,7 +1271,7 @@ SymmetricTensor::SymmetricTensor( template -constexpr inline DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE SymmetricTensor::SymmetricTensor( const Number (&array)[n_independent_components]) : data( @@ -1281,9 +1286,10 @@ SymmetricTensor::SymmetricTensor( template template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator=( - const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator=( + const SymmetricTensor &t) { data = t.data; return *this; @@ -1292,8 +1298,9 @@ SymmetricTensor::operator=( template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator=(const Number &d) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator=(const Number &d) { Assert(numbers::value_is_zero(d), ExcMessage("Only assignment with zero is allowed")); @@ -1654,7 +1661,7 @@ namespace internal template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor::operator Tensor() const { @@ -1664,7 +1671,7 @@ constexpr DEAL_II_ALWAYS_INLINE template -constexpr bool +DEAL_II_CONSTEXPR_FUNCTION bool SymmetricTensor::operator==( const SymmetricTensor &t) const { @@ -1674,7 +1681,7 @@ SymmetricTensor::operator==( template -constexpr bool +DEAL_II_CONSTEXPR_FUNCTION bool SymmetricTensor::operator!=( const SymmetricTensor &t) const { @@ -1685,9 +1692,10 @@ SymmetricTensor::operator!=( template template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator+=( - const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator+=( + const SymmetricTensor &t) { data += t.data; return *this; @@ -1697,9 +1705,10 @@ SymmetricTensor::operator+=( template template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator-=( - const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator-=( + const SymmetricTensor &t) { data -= t.data; return *this; @@ -1709,8 +1718,9 @@ SymmetricTensor::operator-=( template template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator*=(const OtherNumber &d) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator*=(const OtherNumber &d) { data *= d; return *this; @@ -1720,8 +1730,9 @@ SymmetricTensor::operator*=(const OtherNumber &d) template template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & -SymmetricTensor::operator/=(const OtherNumber &d) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor & + SymmetricTensor::operator/=(const OtherNumber &d) { data /= d; return *this; @@ -1730,8 +1741,9 @@ SymmetricTensor::operator/=(const OtherNumber &d) template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor -SymmetricTensor::operator-() const +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor + SymmetricTensor::operator-() const { SymmetricTensor tmp = *this; tmp.data = -tmp.data; @@ -1741,7 +1753,7 @@ SymmetricTensor::operator-() const template -constexpr inline DEAL_II_ALWAYS_INLINE void +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE void SymmetricTensor::clear() { data.clear(); @@ -1750,7 +1762,7 @@ SymmetricTensor::clear() template -constexpr std::size_t +DEAL_II_CONSTEXPR_FUNCTION std::size_t SymmetricTensor::memory_consumption() { // all memory consists of statically allocated memory of the current @@ -1763,7 +1775,7 @@ SymmetricTensor::memory_consumption() namespace internal { template - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename SymmetricTensorAccessors:: double_contraction_result<2, 2, dim, Number, OtherNumber>::type perform_double_contraction( @@ -1798,7 +1810,7 @@ namespace internal template - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename SymmetricTensorAccessors:: double_contraction_result<4, 2, dim, Number, OtherNumber>::type perform_double_contraction( @@ -1824,7 +1836,7 @@ namespace internal template - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename SymmetricTensorAccessors::StorageType< 2, dim, @@ -1862,7 +1874,7 @@ namespace internal template - DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE + DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename SymmetricTensorAccessors::StorageType< 4, dim, @@ -1904,7 +1916,7 @@ namespace internal template template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename internal::SymmetricTensorAccessors:: double_contraction_result::type SymmetricTensor::operator*( @@ -1922,7 +1934,7 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE template template -DEAL_II_CONSTEXPR inline typename internal::SymmetricTensorAccessors:: +DEAL_II_CONSTEXPR_FUNCTION inline typename internal::SymmetricTensorAccessors:: double_contraction_result::type SymmetricTensor::operator*( const SymmetricTensor<4, dim, OtherNumber> &s) const @@ -2141,7 +2153,7 @@ namespace internal template -constexpr inline DEAL_II_ALWAYS_INLINE Number & +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number & SymmetricTensor::operator()( const TableIndices &indices) { @@ -2153,7 +2165,7 @@ SymmetricTensor::operator()( template -constexpr inline DEAL_II_ALWAYS_INLINE const Number & +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE const Number & SymmetricTensor::operator()( const TableIndices &indices) const { @@ -2192,8 +2204,8 @@ namespace internal template -constexpr DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: - Accessor +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE internal:: + SymmetricTensorAccessors::Accessor SymmetricTensor::operator[](const unsigned int row) const { return internal::SymmetricTensorAccessors:: @@ -2206,8 +2218,8 @@ constexpr DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: template -constexpr inline DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: - Accessor +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE internal:: + SymmetricTensorAccessors::Accessor SymmetricTensor::operator[](const unsigned int row) { return internal::SymmetricTensorAccessors:: @@ -2220,7 +2232,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: template -constexpr DEAL_II_ALWAYS_INLINE const Number & +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE const Number & SymmetricTensor::operator[]( const TableIndices &indices) const { @@ -2230,7 +2242,7 @@ SymmetricTensor::operator[]( template -constexpr inline DEAL_II_ALWAYS_INLINE Number & +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number & SymmetricTensor::operator[]( const TableIndices &indices) { @@ -2303,7 +2315,7 @@ namespace internal template -constexpr inline const Number & +DEAL_II_CONSTEXPR_FUNCTION inline const Number & SymmetricTensor::access_raw_entry( const unsigned int index) const { @@ -2315,7 +2327,7 @@ SymmetricTensor::access_raw_entry( template -constexpr inline Number & +DEAL_II_CONSTEXPR_FUNCTION inline Number & SymmetricTensor::access_raw_entry(const unsigned int index) { AssertIndexRange(index, n_independent_components); @@ -2417,7 +2429,7 @@ namespace internal template -constexpr typename numbers::NumberTraits::real_type +DEAL_II_CONSTEXPR_FUNCTION typename numbers::NumberTraits::real_type SymmetricTensor::norm() const { return internal::compute_norm(data); @@ -2511,7 +2523,7 @@ namespace internal template -constexpr unsigned int +DEAL_II_CONSTEXPR_FUNCTION unsigned int SymmetricTensor::component_to_unrolled_index( const TableIndices &indices) { @@ -2613,7 +2625,7 @@ namespace internal } // namespace internal template -constexpr DEAL_II_ALWAYS_INLINE TableIndices +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE TableIndices SymmetricTensor::unrolled_to_component_indices( const unsigned int i) { @@ -2650,7 +2662,7 @@ SymmetricTensor::serialize(Archive &ar, const unsigned int) * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE SymmetricTensor::type> operator+(const SymmetricTensor & left, const SymmetricTensor &right) @@ -2675,7 +2687,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE SymmetricTensor::type> operator-(const SymmetricTensor & left, const SymmetricTensor &right) @@ -2695,7 +2707,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Tensor::type> operator+(const SymmetricTensor &left, const Tensor & right) @@ -2712,7 +2724,7 @@ constexpr DEAL_II_ALWAYS_INLINE * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Tensor::type> operator+(const Tensor & left, const SymmetricTensor &right) @@ -2729,7 +2741,7 @@ constexpr DEAL_II_ALWAYS_INLINE * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Tensor::type> operator-(const SymmetricTensor &left, const Tensor & right) @@ -2746,7 +2758,7 @@ constexpr DEAL_II_ALWAYS_INLINE * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Tensor::type> operator-(const Tensor & left, const SymmetricTensor &right) @@ -2757,7 +2769,7 @@ constexpr DEAL_II_ALWAYS_INLINE template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number determinant(const SymmetricTensor<2, dim, Number> &t) { switch (dim) @@ -2797,7 +2809,7 @@ determinant(const SymmetricTensor<2, dim, Number> &t) * @relatesalso SymmetricTensor */ template -DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Number third_invariant(const SymmetricTensor<2, dim, Number> &t) { return determinant(t); @@ -2806,7 +2818,7 @@ third_invariant(const SymmetricTensor<2, dim, Number> &t) template -constexpr inline DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE Number trace(const SymmetricTensor<2, dim, Number> &d) { Number t = d.data[0]; @@ -2828,7 +2840,7 @@ trace(const SymmetricTensor<2, dim, Number> &d) * @relatesalso SymmetricTensor */ template -constexpr Number +DEAL_II_CONSTEXPR_FUNCTION Number first_invariant(const SymmetricTensor<2, dim, Number> &t) { return trace(t); @@ -2847,7 +2859,7 @@ first_invariant(const SymmetricTensor<2, dim, Number> &t) * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Number second_invariant(const SymmetricTensor<2, 1, Number> &) { return internal::NumberType::value(0.0); @@ -2874,7 +2886,7 @@ second_invariant(const SymmetricTensor<2, 1, Number> &) * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Number second_invariant(const SymmetricTensor<2, 2, Number> &t) { return t[0][0] * t[1][1] - t[0][1] * t[0][1]; @@ -2891,7 +2903,7 @@ second_invariant(const SymmetricTensor<2, 2, Number> &t) * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE Number +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE Number second_invariant(const SymmetricTensor<2, 3, Number> &t) { return (t[0][0] * t[1][1] + t[1][1] * t[2][2] + t[2][2] * t[0][0] - @@ -3296,8 +3308,9 @@ eigenvectors(const SymmetricTensor<2, dim, Number> &T, * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor -transpose(const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION + DEAL_II_ALWAYS_INLINE SymmetricTensor + transpose(const SymmetricTensor &t) { return t; } @@ -3305,8 +3318,9 @@ transpose(const SymmetricTensor &t) template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> -deviator(const SymmetricTensor<2, dim, Number> &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<2, dim, Number> + deviator(const SymmetricTensor<2, dim, Number> &t) { SymmetricTensor<2, dim, Number> tmp = t; @@ -3321,8 +3335,9 @@ deviator(const SymmetricTensor<2, dim, Number> &t) template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - unit_symmetric_tensor() +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<2, dim, Number> + unit_symmetric_tensor() { // create a default constructed matrix filled with // zeros, then set the diagonal elements to one @@ -3349,7 +3364,7 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> template -DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim, Number> +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor<4, dim, Number> deviator_tensor() { SymmetricTensor<4, dim, Number> tmp; @@ -3377,8 +3392,9 @@ deviator_tensor() template -DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> - identity_tensor() +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<4, dim, Number> + identity_tensor() { SymmetricTensor<4, dim, Number> tmp; @@ -3412,8 +3428,8 @@ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - invert(const SymmetricTensor<2, dim, Number> &t) +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> +invert(const SymmetricTensor<2, dim, Number> &t) { return internal::SymmetricTensorImplementation::Inverse<2, dim, Number>:: value(t); @@ -3432,8 +3448,8 @@ constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> * @relatesalso SymmetricTensor */ template -constexpr SymmetricTensor<4, dim, Number> -invert(const SymmetricTensor<4, dim, Number> &t) +DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim, Number> + invert(const SymmetricTensor<4, dim, Number> &t) { return internal::SymmetricTensorImplementation::Inverse<4, dim, Number>:: value(t); @@ -3463,7 +3479,7 @@ invert(const SymmetricTensor<4, dim, Number> &t) * @relatesalso SymmetricTensor */ template -constexpr inline SymmetricTensor<4, dim, Number> +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor<4, dim, Number> outer_product(const SymmetricTensor<2, dim, Number> &t1, const SymmetricTensor<2, dim, Number> &t2) { @@ -3489,8 +3505,9 @@ outer_product(const SymmetricTensor<2, dim, Number> &t1, * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> -symmetrize(const Tensor<2, dim, Number> &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor<2, dim, Number> + symmetrize(const Tensor<2, dim, Number> &t) { SymmetricTensor<2, dim, Number> result; for (unsigned int d = 0; d < dim; ++d) @@ -3513,8 +3530,9 @@ symmetrize(const Tensor<2, dim, Number> &t) * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor -operator*(const SymmetricTensor &t, const Number &factor) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor + operator*(const SymmetricTensor &t, const Number &factor) { SymmetricTensor tt = t; tt *= factor; @@ -3531,8 +3549,9 @@ operator*(const SymmetricTensor &t, const Number &factor) * @relatesalso SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor -operator*(const Number &factor, const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION + DEAL_II_ALWAYS_INLINE SymmetricTensor + operator*(const Number &factor, const SymmetricTensor &t) { // simply forward to the other operator return t * factor; @@ -3565,7 +3584,7 @@ operator*(const Number &factor, const SymmetricTensor &t) * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor< +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE SymmetricTensor< rank_, dim, typename ProductType &t, * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor< +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE SymmetricTensor< rank_, dim, typename ProductType -constexpr inline SymmetricTensor< +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor< rank_, dim, typename ProductType &t, * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor -operator*(const SymmetricTensor &t, const double factor) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor + operator*(const SymmetricTensor &t, const double factor) { SymmetricTensor tt(t); tt *= factor; @@ -3654,8 +3674,9 @@ operator*(const SymmetricTensor &t, const double factor) * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor -operator*(const double factor, const SymmetricTensor &t) +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE + SymmetricTensor + operator*(const double factor, const SymmetricTensor &t) { SymmetricTensor tt(t); tt *= factor; @@ -3670,7 +3691,7 @@ operator*(const double factor, const SymmetricTensor &t) * @relates SymmetricTensor */ template -constexpr inline SymmetricTensor +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor operator/(const SymmetricTensor &t, const double factor) { SymmetricTensor tt(t); @@ -3688,9 +3709,10 @@ operator/(const SymmetricTensor &t, const double factor) * @relates SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE typename ProductType::type -scalar_product(const SymmetricTensor<2, dim, Number> & t1, - const SymmetricTensor<2, dim, OtherNumber> &t2) +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE + typename ProductType::type + scalar_product(const SymmetricTensor<2, dim, Number> & t1, + const SymmetricTensor<2, dim, OtherNumber> &t2) { return (t1 * t2); } @@ -3709,7 +3731,7 @@ scalar_product(const SymmetricTensor<2, dim, Number> & t1, * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE typename ProductType::type scalar_product(const SymmetricTensor<2, dim, Number> &t1, const Tensor<2, dim, OtherNumber> & t2) @@ -3736,9 +3758,10 @@ constexpr inline DEAL_II_ALWAYS_INLINE * @relates SymmetricTensor */ template -constexpr DEAL_II_ALWAYS_INLINE typename ProductType::type -scalar_product(const Tensor<2, dim, Number> & t1, - const SymmetricTensor<2, dim, OtherNumber> &t2) +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE + typename ProductType::type + scalar_product(const Tensor<2, dim, Number> & t1, + const SymmetricTensor<2, dim, OtherNumber> &t2) { return scalar_product(t2, t1); } @@ -3759,7 +3782,7 @@ scalar_product(const Tensor<2, dim, Number> & t1, * @relates SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE void +DEAL_II_CONSTEXPR_FUNCTION inline DEAL_II_ALWAYS_INLINE void double_contract( SymmetricTensor<2, 1, typename ProductType::type> &tmp, const SymmetricTensor<4, 1, Number> & t, @@ -3785,7 +3808,7 @@ double_contract( * @relates SymmetricTensor */ template -constexpr inline void +DEAL_II_CONSTEXPR_FUNCTION inline void double_contract( SymmetricTensor<2, 1, typename ProductType::type> &tmp, const SymmetricTensor<2, 1, Number> & s, @@ -3811,7 +3834,7 @@ double_contract( * @relates SymmetricTensor */ template -constexpr inline void +DEAL_II_CONSTEXPR_FUNCTION inline void double_contract( SymmetricTensor<2, 2, typename ProductType::type> &tmp, const SymmetricTensor<4, 2, Number> & t, @@ -3842,7 +3865,7 @@ double_contract( * @relates SymmetricTensor */ template -constexpr inline void +DEAL_II_CONSTEXPR_FUNCTION inline void double_contract( SymmetricTensor<2, 2, typename ProductType::type> &tmp, const SymmetricTensor<2, 2, Number> & s, @@ -3873,7 +3896,7 @@ double_contract( * @relates SymmetricTensor */ template -constexpr inline void +DEAL_II_CONSTEXPR_FUNCTION inline void double_contract( SymmetricTensor<2, 3, typename ProductType::type> &tmp, const SymmetricTensor<4, 3, Number> & t, @@ -3905,7 +3928,7 @@ double_contract( * @relates SymmetricTensor */ template -constexpr inline void +DEAL_II_CONSTEXPR_FUNCTION inline void double_contract( SymmetricTensor<2, 3, typename ProductType::type> &tmp, const SymmetricTensor<2, 3, Number> & s, @@ -3929,9 +3952,10 @@ double_contract( * @relates SymmetricTensor */ template -constexpr Tensor<1, dim, typename ProductType::type> -operator*(const SymmetricTensor<2, dim, Number> &src1, - const Tensor<1, dim, OtherNumber> & src2) +DEAL_II_CONSTEXPR_FUNCTION + Tensor<1, dim, typename ProductType::type> + operator*(const SymmetricTensor<2, dim, Number> &src1, + const Tensor<1, dim, OtherNumber> & src2) { Tensor<1, dim, typename ProductType::type> dest; for (unsigned int i = 0; i < dim; ++i) @@ -3948,9 +3972,10 @@ operator*(const SymmetricTensor<2, dim, Number> &src1, * @relates SymmetricTensor */ template -constexpr Tensor<1, dim, typename ProductType::type> -operator*(const Tensor<1, dim, Number> & src1, - const SymmetricTensor<2, dim, OtherNumber> &src2) +DEAL_II_CONSTEXPR_FUNCTION + Tensor<1, dim, typename ProductType::type> + operator*(const Tensor<1, dim, Number> & src1, + const SymmetricTensor<2, dim, OtherNumber> &src2) { // this is easy for symmetric tensors: return src2 * src1; @@ -3982,7 +4007,7 @@ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE typename Tensor::type>::tensor_type @@ -4018,7 +4043,7 @@ template -constexpr DEAL_II_ALWAYS_INLINE +DEAL_II_CONSTEXPR_FUNCTION DEAL_II_ALWAYS_INLINE typename Tensor::type>::tensor_type diff --git a/include/deal.II/base/table_indices.h b/include/deal.II/base/table_indices.h index f7d8a7c5ab..ae1ceff506 100644 --- a/include/deal.II/base/table_indices.h +++ b/include/deal.II/base/table_indices.h @@ -93,7 +93,7 @@ public: * Sort the indices in ascending order. While this operation is not very * useful for Table objects, it is used for the SymmetricTensor class. */ - DEAL_II_CONSTEXPR void + DEAL_II_CONSTEXPR_FUNCTION void sort(); /** @@ -165,7 +165,7 @@ TableIndices::operator!=(const TableIndices &other) const template -DEAL_II_CONSTEXPR inline void +DEAL_II_CONSTEXPR_FUNCTION inline void TableIndices::sort() { std::sort(std::begin(indices), std::end(indices)); diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index eefd25c2fb..5d17ee8808 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1720,7 +1720,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE template -inline typename numbers::NumberTraits::real_type +inline DEAL_II_HOST_DEVICE typename numbers::NumberTraits::real_type Tensor::norm() const { // Make things work with AD types diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index 62358e0917..536e39901a 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -737,7 +737,8 @@ namespace LinearAlgebra /** * Pointer to the array of local elements of this vector. */ - std::unique_ptr values; + std::unique_ptr + values; /** * For parallel loops with TBB, this member variable stores the affinity diff --git a/include/deal.II/physics/elasticity/standard_tensors.h b/include/deal.II/physics/elasticity/standard_tensors.h index 7facd3b6ea..550bb84c35 100644 --- a/include/deal.II/physics/elasticity/standard_tensors.h +++ b/include/deal.II/physics/elasticity/standard_tensors.h @@ -231,8 +231,8 @@ namespace Physics * @dealiiHolzapfelA{229,6.83} */ template - static DEAL_II_CONSTEXPR SymmetricTensor<4, dim, Number> - Dev_P(const Tensor<2, dim, Number> &F); + static DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim, Number> + Dev_P(const Tensor<2, dim, Number> &F); /** * Return the transpose of the fourth-order referential deviatoric tensor, @@ -246,8 +246,8 @@ namespace Physics * @f] */ template - static DEAL_II_CONSTEXPR SymmetricTensor<4, dim, Number> - Dev_P_T(const Tensor<2, dim, Number> &F); + static DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim, Number> + Dev_P_T(const Tensor<2, dim, Number> &F); /** @} */ @@ -273,8 +273,8 @@ namespace Physics * @dealiiHolzapfelA{228,6.82} */ template - static DEAL_II_CONSTEXPR SymmetricTensor<2, dim, Number> - ddet_F_dC(const Tensor<2, dim, Number> &F); + static DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<2, dim, Number> + ddet_F_dC(const Tensor<2, dim, Number> &F); /** @} */ @@ -298,8 +298,8 @@ namespace Physics * @dealiiWriggersA{76,3.255} */ template - static DEAL_II_CONSTEXPR SymmetricTensor<4, dim, Number> - dC_inv_dC(const Tensor<2, dim, Number> &F); + static DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<4, dim, Number> + dC_inv_dC(const Tensor<2, dim, Number> &F); /** @} */ }; @@ -316,7 +316,7 @@ namespace Physics template template -DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim, Number> +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor<4, dim, Number> Physics::Elasticity::StandardTensors::Dev_P( const Tensor<2, dim, Number> &F) { @@ -343,7 +343,7 @@ Physics::Elasticity::StandardTensors::Dev_P( template template -DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim, Number> +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor<4, dim, Number> Physics::Elasticity::StandardTensors::Dev_P_T( const Tensor<2, dim, Number> &F) { @@ -371,8 +371,8 @@ Physics::Elasticity::StandardTensors::Dev_P_T( template template -DEAL_II_CONSTEXPR SymmetricTensor<2, dim, Number> - Physics::Elasticity::StandardTensors::ddet_F_dC( +DEAL_II_CONSTEXPR_FUNCTION SymmetricTensor<2, dim, Number> + Physics::Elasticity::StandardTensors::ddet_F_dC( const Tensor<2, dim, Number> &F) { return internal::NumberType::value(0.5 * determinant(F)) * @@ -383,7 +383,7 @@ DEAL_II_CONSTEXPR SymmetricTensor<2, dim, Number> template template -DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim, Number> +DEAL_II_CONSTEXPR_FUNCTION inline SymmetricTensor<4, dim, Number> Physics::Elasticity::StandardTensors::dC_inv_dC( const Tensor<2, dim, Number> &F) { -- 2.39.5