* put at position <tt>position</tt>. The remaining indices remain in
* invalid state.
*/
- DEAL_II_CONSTEXPR inline TableIndices<2>
- merge(const TableIndices<2> &previous_indices,
- const unsigned int new_index,
- const unsigned int position)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<2>
+ merge(const TableIndices<2> &previous_indices,
+ const unsigned int new_index,
+ const unsigned int position)
{
Assert(position < 2, ExcIndexRange(position, 0, 2));
* put at position <tt>position</tt>. The remaining indices remain in
* invalid state.
*/
- DEAL_II_CONSTEXPR inline TableIndices<4>
- merge(const TableIndices<4> &previous_indices,
- const unsigned int new_index,
- const unsigned int position)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<4>
+ merge(const TableIndices<4> &previous_indices,
+ const unsigned int new_index,
+ const unsigned int position)
{
Assert(position < 4, ExcIndexRange(position, 0, 4));
/**
* Copy constructor.
*/
- constexpr Accessor(const Accessor &) = default;
+ constexpr DEAL_II_ALWAYS_INLINE
+ Accessor(const Accessor &) = default;
public:
/**
/**
* Copy constructor.
*/
- constexpr Accessor(const Accessor &) = default;
+ constexpr DEAL_II_ALWAYS_INLINE
+ Accessor(const Accessor &) = default;
public:
/**
/**
* Default constructor. Creates a tensor with all entries equal to zero.
*/
- constexpr SymmetricTensor() = default;
+ constexpr DEAL_II_ALWAYS_INLINE
+ SymmetricTensor() = default;
/**
* Constructor. Generate a symmetric tensor from a general one. Assumes that
namespace SymmetricTensorAccessors
{
template <int rank_, int dim, bool constness, int P, typename Number>
- constexpr Accessor<rank_, dim, constness, P, Number>::Accessor(
+ constexpr DEAL_II_ALWAYS_INLINE
+ Accessor<rank_, dim, constness, P, Number>::Accessor(
tensor_type & tensor,
const TableIndices<rank_> &previous_indices)
: tensor(tensor)
template <int rank_, int dim, bool constness, int P, typename Number>
- DEAL_II_CONSTEXPR inline Accessor<rank_, dim, constness, P - 1, Number>
- Accessor<rank_, dim, constness, P, Number>::
- operator[](const unsigned int i)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ Accessor<rank_, dim, constness, P - 1, Number>
+ Accessor<rank_, dim, constness, P, Number>::
+ operator[](const unsigned int i)
{
return Accessor<rank_, dim, constness, P - 1, Number>(
tensor, merge(previous_indices, i, rank_ - P));
template <int rank_, int dim, bool constness, int P, typename Number>
- constexpr Accessor<rank_, dim, constness, P - 1, Number>
- Accessor<rank_, dim, constness, P, Number>::
- operator[](const unsigned int i) const
+ constexpr DEAL_II_ALWAYS_INLINE
+ Accessor<rank_, dim, constness, P - 1, Number>
+ Accessor<rank_, dim, constness, P, Number>::
+ operator[](const unsigned int i) const
{
return Accessor<rank_, dim, constness, P - 1, Number>(
tensor, merge(previous_indices, i, rank_ - P));
template <int rank_, int dim, bool constness, typename Number>
- constexpr Accessor<rank_, dim, constness, 1, Number>::Accessor(
+ constexpr DEAL_II_ALWAYS_INLINE
+ Accessor<rank_, dim, constness, 1, Number>::Accessor(
tensor_type & tensor,
const TableIndices<rank_> &previous_indices)
: tensor(tensor)
template <int rank_, int dim, bool constness, typename Number>
- DEAL_II_CONSTEXPR inline
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
typename Accessor<rank_, dim, constness, 1, Number>::reference
Accessor<rank_, dim, constness, 1, Number>::
operator[](const unsigned int i)
template <int rank_, int dim, bool constness, typename Number>
- constexpr typename Accessor<rank_, dim, constness, 1, Number>::reference
- Accessor<rank_, dim, constness, 1, Number>::
- operator[](const unsigned int i) const
+ constexpr DEAL_II_ALWAYS_INLINE
+ typename Accessor<rank_, dim, constness, 1, Number>::reference
+ Accessor<rank_, dim, constness, 1, Number>::
+ operator[](const unsigned int i) const
{
return tensor(merge(previous_indices, i, rank_ - 1));
}
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
const Tensor<2, dim, OtherNumber> &t)
{
Assert(rank == 2, ExcNotImplemented());
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-constexpr SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
+constexpr DEAL_II_ALWAYS_INLINE
+SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
const SymmetricTensor<rank_, dim, OtherNumber> &initializer)
: data(initializer.data)
{}
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
const Number (&array)[n_independent_components])
: data(
*reinterpret_cast<const typename base_tensor_type::array_type *>(array))
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim, Number> &
-SymmetricTensor<rank_, dim, Number>::
-operator=(const SymmetricTensor<rank_, dim, OtherNumber> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ SymmetricTensor<rank_, dim, Number> &
+ SymmetricTensor<rank_, dim, Number>::
+ operator=(const SymmetricTensor<rank_, dim, OtherNumber> &t)
{
data = t.data;
return *this;
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim, Number> &
-SymmetricTensor<rank_, dim, Number>::operator=(const Number &d)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ SymmetricTensor<rank_, dim, Number> &
+ SymmetricTensor<rank_, dim, Number>::operator=(const Number &d)
{
Assert(numbers::value_is_zero(d),
ExcMessage("Only assignment with zero is allowed"));
template <typename Number>
struct Inverse<2, 1, Number>
{
- DEAL_II_CONSTEXPR static inline dealii::SymmetricTensor<2, 1, Number>
- value(const dealii::SymmetricTensor<2, 1, Number> &t)
+ DEAL_II_CONSTEXPR static inline DEAL_II_ALWAYS_INLINE
+ dealii::SymmetricTensor<2, 1, Number>
+ value(const dealii::SymmetricTensor<2, 1, Number> &t)
{
dealii::SymmetricTensor<2, 1, Number> tmp;
template <typename Number>
struct Inverse<2, 2, Number>
{
- DEAL_II_CONSTEXPR static inline dealii::SymmetricTensor<2, 2, Number>
- value(const dealii::SymmetricTensor<2, 2, Number> &t)
+ DEAL_II_CONSTEXPR static inline DEAL_II_ALWAYS_INLINE
+ dealii::SymmetricTensor<2, 2, Number>
+ value(const dealii::SymmetricTensor<2, 2, Number> &t)
{
dealii::SymmetricTensor<2, 2, Number> tmp;
template <int dim, typename Number, typename OtherNumber = Number>
- DEAL_II_CONSTEXPR inline typename SymmetricTensorAccessors::
- double_contraction_result<4, 2, dim, Number, OtherNumber>::type
- perform_double_contraction(
- const typename SymmetricTensorAccessors::StorageType<4, dim, Number>::
- base_tensor_type &data,
- const typename SymmetricTensorAccessors::
- StorageType<2, dim, OtherNumber>::base_tensor_type &sdata)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ typename SymmetricTensorAccessors::
+ double_contraction_result<4, 2, dim, Number, OtherNumber>::type
+ perform_double_contraction(
+ const typename SymmetricTensorAccessors::StorageType<4, dim, Number>::
+ base_tensor_type &data,
+ const typename SymmetricTensorAccessors::
+ StorageType<2, dim, OtherNumber>::base_tensor_type &sdata)
{
using result_type = typename SymmetricTensorAccessors::
double_contraction_result<4, 2, dim, Number, OtherNumber>::type;
template <int dim, typename Number, typename OtherNumber = Number>
- DEAL_II_CONSTEXPR inline typename SymmetricTensorAccessors::StorageType<
- 2,
- dim,
- typename SymmetricTensorAccessors::
- double_contraction_result<2, 4, dim, Number, OtherNumber>::value_type>::
- base_tensor_type
- perform_double_contraction(
- const typename SymmetricTensorAccessors::StorageType<2, dim, Number>::
- base_tensor_type &data,
- const typename SymmetricTensorAccessors::
- StorageType<4, dim, OtherNumber>::base_tensor_type &sdata)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ typename SymmetricTensorAccessors::StorageType<
+ 2,
+ dim,
+ typename SymmetricTensorAccessors::
+ double_contraction_result<2, 4, dim, Number, OtherNumber>::value_type>::
+ base_tensor_type
+ perform_double_contraction(
+ const typename SymmetricTensorAccessors::StorageType<2, dim, Number>::
+ base_tensor_type &data,
+ const typename SymmetricTensorAccessors::
+ StorageType<4, dim, OtherNumber>::base_tensor_type &sdata)
{
using value_type = typename SymmetricTensorAccessors::
double_contraction_result<2, 4, dim, Number, OtherNumber>::value_type;
template <int dim, typename Number, typename OtherNumber = Number>
- DEAL_II_CONSTEXPR inline typename SymmetricTensorAccessors::StorageType<
- 4,
- dim,
- typename SymmetricTensorAccessors::
- double_contraction_result<4, 4, dim, Number, OtherNumber>::value_type>::
- base_tensor_type
- perform_double_contraction(
- const typename SymmetricTensorAccessors::StorageType<4, dim, Number>::
- base_tensor_type &data,
- const typename SymmetricTensorAccessors::
- StorageType<4, dim, OtherNumber>::base_tensor_type &sdata)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ typename SymmetricTensorAccessors::StorageType<
+ 4,
+ dim,
+ typename SymmetricTensorAccessors::
+ double_contraction_result<4, 4, dim, Number, OtherNumber>::value_type>::
+ base_tensor_type
+ perform_double_contraction(
+ const typename SymmetricTensorAccessors::StorageType<4, dim, Number>::
+ base_tensor_type &data,
+ const typename SymmetricTensorAccessors::
+ StorageType<4, dim, OtherNumber>::base_tensor_type &sdata)
{
using value_type = typename SymmetricTensorAccessors::
double_contraction_result<4, 4, dim, Number, OtherNumber>::value_type;
Type Uninitialized<Type>::value;
template <int dim, typename Number>
- DEAL_II_CONSTEXPR inline Number &
- symmetric_tensor_access(const TableIndices<2> &indices,
- typename SymmetricTensorAccessors::
- StorageType<2, dim, Number>::base_tensor_type &data)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number &
+ symmetric_tensor_access(const TableIndices<2> &indices,
+ typename SymmetricTensorAccessors::
+ StorageType<2, dim, Number>::base_tensor_type &data)
{
// 1d is very simple and done first
if (dim == 1)
template <int dim, typename Number>
- DEAL_II_CONSTEXPR inline const Number &
- symmetric_tensor_access(const TableIndices<2> &indices,
- const typename SymmetricTensorAccessors::
- StorageType<2, dim, Number>::base_tensor_type &data)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE const Number &
+ symmetric_tensor_access(const TableIndices<2> &indices,
+ const typename SymmetricTensorAccessors::
+ StorageType<2, dim, Number>::base_tensor_type &data)
{
// 1d is very simple and done first
if (dim == 1)
template <int dim, typename Number>
- DEAL_II_CONSTEXPR inline const Number &
- symmetric_tensor_access(const TableIndices<4> &indices,
- const typename SymmetricTensorAccessors::
- StorageType<4, dim, Number>::base_tensor_type &data)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE const Number &
+ symmetric_tensor_access(const TableIndices<4> &indices,
+ const typename SymmetricTensorAccessors::
+ StorageType<4, dim, Number>::base_tensor_type &data)
{
switch (dim)
{
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline Number &
-SymmetricTensor<rank_, dim, Number>::
-operator()(const TableIndices<rank_> &indices)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number &
+ SymmetricTensor<rank_, dim, Number>::
+ operator()(const TableIndices<rank_> &indices)
{
for (unsigned int r = 0; r < rank; ++r)
Assert(indices[r] < dimension, ExcIndexRange(indices[r], 0, dimension));
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline const Number &
-SymmetricTensor<rank_, dim, Number>::
-operator()(const TableIndices<rank_> &indices) const
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE const Number &
+ SymmetricTensor<rank_, dim, Number>::
+ operator()(const TableIndices<rank_> &indices) const
{
for (unsigned int r = 0; r < rank; ++r)
Assert(indices[r] < dimension, ExcIndexRange(indices[r], 0, dimension));
template <int rank_, int dim, typename Number>
-constexpr internal::SymmetricTensorAccessors::
+constexpr DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors::
Accessor<rank_, dim, true, rank_ - 1, Number>
SymmetricTensor<rank_, dim, Number>::
operator[](const unsigned int row) const
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline internal::SymmetricTensorAccessors::
- Accessor<rank_, dim, false, rank_ - 1, Number>
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE internal::
+ SymmetricTensorAccessors::Accessor<rank_, dim, false, rank_ - 1, Number>
SymmetricTensor<rank_, dim, Number>::operator[](const unsigned int row)
{
return internal::SymmetricTensorAccessors::
template <int rank_, int dim, typename Number>
-constexpr const Number &SymmetricTensor<rank_, dim, Number>::
- operator[](const TableIndices<rank_> &indices) const
+constexpr DEAL_II_ALWAYS_INLINE const Number &
+ SymmetricTensor<rank_, dim, Number>::
+ operator[](const TableIndices<rank_> &indices) const
{
return operator()(indices);
}
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline Number &SymmetricTensor<rank_, dim, Number>::
- operator[](const TableIndices<rank_> &indices)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number &
+ SymmetricTensor<rank_, dim, Number>::
+ operator[](const TableIndices<rank_> &indices)
{
return operator()(indices);
}
//
// this function is for rank-2 tensors
template <int dim>
- DEAL_II_CONSTEXPR inline unsigned int
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE unsigned int
component_to_unrolled_index(const TableIndices<2> &indices)
{
Assert(indices[0] < dim, ExcIndexRange(indices[0], 0, dim));
//
// this function is for rank-2 tensors
template <int dim>
- DEAL_II_CONSTEXPR inline TableIndices<2>
- unrolled_to_component_indices(const unsigned int i,
- const std::integral_constant<int, 2> &)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<2>
+ unrolled_to_component_indices(const unsigned int i,
+ const std::integral_constant<int, 2> &)
{
Assert(
(i < dealii::SymmetricTensor<2, dim, double>::n_independent_components),
} // namespace internal
template <int rank_, int dim, typename Number>
-constexpr TableIndices<rank_>
-SymmetricTensor<rank_, dim, Number>::unrolled_to_component_indices(
+constexpr DEAL_II_ALWAYS_INLINE TableIndices<rank_>
+ SymmetricTensor<rank_, dim, Number>::unrolled_to_component_indices(
const unsigned int i)
{
return internal::SymmetricTensorImplementation::unrolled_to_component_indices<
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<
- rank_,
- dim,
- typename ProductType<Number, OtherNumber>::type>
-operator+(const SymmetricTensor<rank_, dim, Number> & left,
- const SymmetricTensor<rank_, dim, OtherNumber> &right)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ SymmetricTensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator+(const SymmetricTensor<rank_, dim, Number> & left,
+ const SymmetricTensor<rank_, dim, OtherNumber> &right)
{
SymmetricTensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
tmp = left;
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<
- rank_,
- dim,
- typename ProductType<Number, OtherNumber>::type>
-operator-(const SymmetricTensor<rank_, dim, Number> & left,
- const SymmetricTensor<rank_, dim, OtherNumber> &right)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ SymmetricTensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator-(const SymmetricTensor<rank_, dim, Number> & left,
+ const SymmetricTensor<rank_, dim, OtherNumber> &right)
{
SymmetricTensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
tmp = left;
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-constexpr Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
-operator+(const SymmetricTensor<rank_, dim, Number> &left,
- const Tensor<rank_, dim, OtherNumber> & right)
+constexpr DEAL_II_ALWAYS_INLINE
+ Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator+(const SymmetricTensor<rank_, dim, Number> &left,
+ const Tensor<rank_, dim, OtherNumber> & right)
{
return Tensor<rank_, dim, Number>(left) + right;
}
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-constexpr Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
-operator+(const Tensor<rank_, dim, Number> & left,
- const SymmetricTensor<rank_, dim, OtherNumber> &right)
+constexpr DEAL_II_ALWAYS_INLINE
+ Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator+(const Tensor<rank_, dim, Number> & left,
+ const SymmetricTensor<rank_, dim, OtherNumber> &right)
{
return left + Tensor<rank_, dim, OtherNumber>(right);
}
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-constexpr Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
-operator-(const SymmetricTensor<rank_, dim, Number> &left,
- const Tensor<rank_, dim, OtherNumber> & right)
+constexpr DEAL_II_ALWAYS_INLINE
+ Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator-(const SymmetricTensor<rank_, dim, Number> &left,
+ const Tensor<rank_, dim, OtherNumber> & right)
{
return Tensor<rank_, dim, Number>(left) - right;
}
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-constexpr Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
-operator-(const Tensor<rank_, dim, Number> & left,
- const SymmetricTensor<rank_, dim, OtherNumber> &right)
+constexpr DEAL_II_ALWAYS_INLINE
+ Tensor<rank_, dim, typename ProductType<Number, OtherNumber>::type>
+ operator-(const Tensor<rank_, dim, Number> & left,
+ const SymmetricTensor<rank_, dim, OtherNumber> &right)
{
return left - Tensor<rank_, dim, OtherNumber>(right);
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline Number
-determinant(const SymmetricTensor<2, dim, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number
+ determinant(const SymmetricTensor<2, dim, Number> &t)
{
switch (dim)
{
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-constexpr Number
-third_invariant(const SymmetricTensor<2, dim, Number> &t)
+constexpr DEAL_II_ALWAYS_INLINE Number
+ third_invariant(const SymmetricTensor<2, dim, Number> &t)
{
return determinant(t);
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR Number
- trace(const SymmetricTensor<2, dim, Number> &d)
+DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE Number
+ trace(const SymmetricTensor<2, dim, Number> &d)
{
Number t = d.data[0];
for (unsigned int i = 1; i < dim; ++i)
* @author Wolfgang Bangerth, 2005, 2010
*/
template <typename Number>
-constexpr Number
-second_invariant(const SymmetricTensor<2, 1, Number> &)
+constexpr DEAL_II_ALWAYS_INLINE Number
+ second_invariant(const SymmetricTensor<2, 1, Number> &)
{
return internal::NumberType<Number>::value(0.0);
}
* @author Wolfgang Bangerth, 2005, 2010
*/
template <typename Number>
-constexpr Number
-second_invariant(const SymmetricTensor<2, 2, Number> &t)
+constexpr 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];
}
* @author Wolfgang Bangerth, 2005, 2010
*/
template <typename Number>
-constexpr Number
-second_invariant(const SymmetricTensor<2, 3, Number> &t)
+constexpr 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] -
t[0][1] * t[0][1] - t[0][2] * t[0][2] - t[1][2] * t[1][2]);
* @author Wolfgang Bangerth, 2005
*/
template <int rank_, int dim, typename Number>
-constexpr SymmetricTensor<rank_, dim, Number>
-transpose(const SymmetricTensor<rank_, dim, Number> &t)
+constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<rank_, dim, Number>
+ transpose(const SymmetricTensor<rank_, dim, Number> &t)
{
return t;
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<2, dim, Number>
-deviator(const SymmetricTensor<2, dim, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number>
+ deviator(const SymmetricTensor<2, dim, Number> &t)
{
SymmetricTensor<2, dim, Number> tmp = t;
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<2, dim, Number>
-unit_symmetric_tensor()
+DEAL_II_CONSTEXPR 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
switch (dim)
{
case 1:
- tmp.data[0] = 1;
+ tmp.data[0] = Number(1);
break;
case 2:
- tmp.data[0] = tmp.data[1] = 1;
+ tmp.data[0] = tmp.data[1] = Number(1);
break;
case 3:
- tmp.data[0] = tmp.data[1] = tmp.data[2] = 1;
+ tmp.data[0] = tmp.data[1] = tmp.data[2] = Number(1);
break;
default:
for (unsigned int d = 0; d < dim; ++d)
- tmp.data[d] = 1;
+ tmp.data[d] = Number(1);
}
return tmp;
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim>
-DEAL_II_CONSTEXPR inline SymmetricTensor<2, dim>
-unit_symmetric_tensor()
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim>
+ unit_symmetric_tensor()
{
return unit_symmetric_tensor<dim, double>();
}
// fill the elements treating the diagonal
for (unsigned int i = 0; i < dim; ++i)
for (unsigned int j = 0; j < dim; ++j)
- tmp.data[i][j] = (i == j ? 1 : 0) - 1. / dim;
+ tmp.data[i][j] = Number((i == j ? 1 : 0) - 1. / dim);
// then fill the ones that copy over the
// non-diagonal elements. note that during
i < internal::SymmetricTensorAccessors::StorageType<4, dim, Number>::
n_rank2_components;
++i)
- tmp.data[i][i] = 0.5;
+ tmp.data[i][i] = Number(0.5);
return tmp;
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim>
-DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim>
-deviator_tensor()
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim>
+ deviator_tensor()
{
return deviator_tensor<dim, double>();
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim, Number>
-identity_tensor()
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number>
+ identity_tensor()
{
SymmetricTensor<4, dim, Number> tmp;
// fill the elements treating the diagonal
for (unsigned int i = 0; i < dim; ++i)
- tmp.data[i][i] = 1;
+ tmp.data[i][i] = Number(1);
// then fill the ones that copy over the
// non-diagonal elements. note that during
i < internal::SymmetricTensorAccessors::StorageType<4, dim, Number>::
n_rank2_components;
++i)
- tmp.data[i][i] = 0.5;
+ tmp.data[i][i] = Number(0.5);
return tmp;
}
* @author Wolfgang Bangerth, 2005
*/
template <int dim>
-DEAL_II_CONSTEXPR inline SymmetricTensor<4, dim>
-identity_tensor()
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim>
+ identity_tensor()
{
return identity_tensor<dim, double>();
}
* @author Jean-Paul Pelteret, 2016
*/
template <int dim, typename Number>
-constexpr SymmetricTensor<2, dim, Number>
-invert(const SymmetricTensor<2, dim, Number> &t)
+constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number>
+ invert(const SymmetricTensor<2, dim, Number> &t)
{
return internal::SymmetricTensorImplementation::Inverse<2, dim, Number>::
value(t);
* @author Wolfgang Bangerth, 2005
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<2, dim, Number>
-symmetrize(const Tensor<2, dim, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number>
+ symmetrize(const Tensor<2, dim, Number> &t)
{
Number array[(dim * dim + dim) / 2];
for (unsigned int d = 0; d < dim; ++d)
array[d] = t[d][d];
- for (unsigned int d = 0, c = 0; d < dim; ++d)
+ Number half = {};
+ half = 0.5;
+ for (unsigned int d = 0, c = dim; d < dim; ++d)
for (unsigned int e = d + 1; e < dim; ++e, ++c)
- array[dim + c] = (t[d][e] + t[e][d]) * 0.5;
+ array[c] = (t[d][e] + t[e][d]) * half;
return SymmetricTensor<2, dim, Number>(array);
}
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim, Number>
-operator*(const SymmetricTensor<rank_, dim, Number> &t, const Number &factor)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ SymmetricTensor<rank_, dim, Number>
+ operator*(const SymmetricTensor<rank_, dim, Number> &t, const Number &factor)
{
SymmetricTensor<rank_, dim, Number> tt = t;
tt *= factor;
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim, typename Number>
-constexpr SymmetricTensor<rank_, dim, Number>
-operator*(const Number &factor, const SymmetricTensor<rank_, dim, Number> &t)
+constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<rank_, dim, Number>
+ operator*(const Number &factor, const SymmetricTensor<rank_, dim, Number> &t)
{
// simply forward to the other operator
return t * factor;
* @relatesalso EnableIfScalar
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<
rank_,
dim,
typename ProductType<Number,
* @relatesalso EnableIfScalar
*/
template <int rank_, int dim, typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline SymmetricTensor<
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<
rank_,
dim,
typename ProductType<OtherNumber,
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim>
-operator*(const SymmetricTensor<rank_, dim> &t, const double factor)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<rank_, dim>
+ operator*(const SymmetricTensor<rank_, dim> &t, const double factor)
{
SymmetricTensor<rank_, dim> tt = t;
tt *= factor;
* @relatesalso SymmetricTensor
*/
template <int rank_, int dim>
-DEAL_II_CONSTEXPR inline SymmetricTensor<rank_, dim>
-operator*(const double factor, const SymmetricTensor<rank_, dim> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE SymmetricTensor<rank_, dim>
+ operator*(const double factor, const SymmetricTensor<rank_, dim> &t)
{
SymmetricTensor<rank_, dim> tt = t;
tt *= factor;
* @relatesalso SymmetricTensor
*/
template <int dim, typename Number, typename OtherNumber>
-constexpr typename ProductType<Number, OtherNumber>::type
+constexpr DEAL_II_ALWAYS_INLINE typename ProductType<Number, OtherNumber>::type
scalar_product(const SymmetricTensor<2, dim, Number> & t1,
const SymmetricTensor<2, dim, OtherNumber> &t2)
{
* @relatesalso Tensor @relatesalso SymmetricTensor
*/
template <int dim, typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline typename ProductType<Number, OtherNumber>::type
-scalar_product(const SymmetricTensor<2, dim, Number> &t1,
- const Tensor<2, dim, OtherNumber> & t2)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ typename ProductType<Number, OtherNumber>::type
+ scalar_product(const SymmetricTensor<2, dim, Number> &t1,
+ const Tensor<2, dim, OtherNumber> & t2)
{
typename ProductType<Number, OtherNumber>::type s = internal::NumberType<
typename ProductType<Number, OtherNumber>::type>::value(0.0);
* @relatesalso Tensor @relatesalso SymmetricTensor
*/
template <int dim, typename Number, typename OtherNumber>
-constexpr typename ProductType<Number, OtherNumber>::type
+constexpr DEAL_II_ALWAYS_INLINE typename ProductType<Number, OtherNumber>::type
scalar_product(const Tensor<2, dim, Number> & t1,
const SymmetricTensor<2, dim, OtherNumber> &t2)
{
* @author Wolfgang Bangerth, 2005
*/
template <typename Number, typename OtherNumber>
-DEAL_II_CONSTEXPR inline void double_contract(
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE void double_contract(
SymmetricTensor<2, 1, typename ProductType<Number, OtherNumber>::type> &tmp,
const SymmetricTensor<4, 1, Number> & t,
const SymmetricTensor<2, 1, OtherNumber> & s)
*
* @note This function can also be used in CUDA device code.
*/
- constexpr DEAL_II_CUDA_HOST_DEV
- Tensor() = default;
+ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor() = default;
/**
* Constructor, where the data is copied from a C-style array.
template <int rank, int dim, typename T>
struct NumberType<Tensor<rank, dim, T>>
{
- static constexpr const Tensor<rank, dim, T> &
- value(const Tensor<rank, dim, T> &t)
+ static constexpr DEAL_II_ALWAYS_INLINE const Tensor<rank, dim, T> &
+ value(const Tensor<rank, dim, T> &t)
{
return t;
}
- static DEAL_II_CONSTEXPR Tensor<rank, dim, T>
- value(const T &t)
+ static DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE Tensor<rank, dim, T>
+ value(const T &t)
{
Tensor<rank, dim, T> tmp;
tmp = t;
template <int rank, int dim, typename T, int width>
struct NumberType<Tensor<rank, dim, VectorizedArray<T, width>>>
{
- static constexpr const Tensor<rank, dim, VectorizedArray<T, width>> &
- value(const Tensor<rank, dim, VectorizedArray<T, width>> &t)
+ static constexpr DEAL_II_ALWAYS_INLINE const
+ Tensor<rank, dim, VectorizedArray<T, width>> &
+ value(const Tensor<rank, dim, VectorizedArray<T, width>> &t)
{
return t;
}
- static DEAL_II_CONSTEXPR Tensor<rank, dim, VectorizedArray<T, width>>
- value(const T &t)
+ static DEAL_II_CONSTEXPR
+ DEAL_II_ALWAYS_INLINE Tensor<rank, dim, VectorizedArray<T, width>>
+ value(const T &t)
{
Tensor<rank, dim, VectorizedArray<T, width>> tmp;
tmp = internal::NumberType<VectorizedArray<T, width>>::value(t);
return tmp;
}
- static DEAL_II_CONSTEXPR Tensor<rank, dim, VectorizedArray<T, width>>
- value(const VectorizedArray<T, width> &t)
+ static DEAL_II_CONSTEXPR
+ DEAL_II_ALWAYS_INLINE Tensor<rank, dim, VectorizedArray<T, width>>
+ value(const VectorizedArray<T, width> &t)
{
Tensor<rank, dim, VectorizedArray<T, width>> tmp;
tmp = t;
template <int dim, typename Number>
-constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<0, dim, Number>::Tensor()
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<0, dim, Number>::Tensor()
// Some auto-differentiable numbers need explicit
// zero initialization such as adtl::adouble.
: Tensor{0.0}
template <int dim, typename Number>
template <typename OtherNumber>
-constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<0, dim, Number>::Tensor(const OtherNumber &initializer)
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<0, dim, Number>::Tensor(const OtherNumber &initializer)
: value(internal::NumberType<Number>::value(initializer))
{}
template <int dim, typename Number>
template <typename OtherNumber>
-constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, OtherNumber> &p)
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, OtherNumber> &p)
: Tensor{p.value}
{}
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>::
- operator Number &()
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>::operator Number &()
{
// We cannot use Assert inside a CUDA kernel
#ifndef __CUDA_ARCH__
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>::
- operator const Number &() const
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>::operator const Number &() const
{
// We cannot use Assert inside a CUDA kernel
#ifndef __CUDA_ARCH__
template <int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator=(const Tensor<0, dim, OtherNumber> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator=(const Tensor<0, dim, OtherNumber> &p)
{
value = internal::NumberType<Number>::value(p);
return *this;
#ifdef __INTEL_COMPILER
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator=(const Tensor<0, dim, Number> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator=(const Tensor<0, dim, Number> &p)
{
value = p.value;
return *this;
template <int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator=(const OtherNumber &d)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator=(const OtherNumber &d)
{
value = internal::NumberType<Number>::value(d);
return *this;
template <int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator+=(const Tensor<0, dim, OtherNumber> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator+=(const Tensor<0, dim, OtherNumber> &p)
{
value += p.value;
return *this;
template <int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator-=(const Tensor<0, dim, OtherNumber> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator-=(const Tensor<0, dim, OtherNumber> &p)
{
value -= p.value;
return *this;
namespace ComplexWorkaround
{
template <typename Number, typename OtherNumber>
- DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV void
- multiply_assign_scalar(Number &val, const OtherNumber &s)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV void
+ multiply_assign_scalar(Number &val, const OtherNumber &s)
{
val *= s;
}
#ifdef __CUDA_ARCH__
template <typename Number, typename OtherNumber>
- DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV void
- multiply_assign_scalar(std::complex<Number> &, const OtherNumber &)
+ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV void
+ multiply_assign_scalar(std::complex<Number> &, const OtherNumber &)
{
printf("This function is not implemented for std::complex<Number>!\n");
assert(false);
template <int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
-Tensor<0, dim, Number>::operator*=(const OtherNumber &s)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> &
+ Tensor<0, dim, Number>::operator*=(const OtherNumber &s)
{
internal::ComplexWorkaround::multiply_assign_scalar(value, s);
return *this;
template <int dim, typename Number>
-constexpr DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>
Tensor<0, dim, Number>::operator-() const
{
return -value;
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline typename Tensor<0, dim, Number>::real_type
-Tensor<0, dim, Number>::norm() const
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ typename Tensor<0, dim, Number>::real_type
+ Tensor<0, dim, Number>::norm() const
{
Assert(dim != 0,
ExcMessage("Cannot access an object of type Tensor<0,0,Number>"));
template <int dim, typename Number>
-DEAL_II_CUDA_HOST_DEV inline typename Tensor<0, dim, Number>::real_type
-Tensor<0, dim, Number>::norm_square() const
+DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE
+ typename Tensor<0, dim, Number>::real_type
+ Tensor<0, dim, Number>::norm_square() const
{
// We cannot use Assert inside a CUDA kernel
#ifndef __CUDA_ARCH__
}
+
/*-------------------- Inline functions: Tensor<rank,dim> --------------------*/
template <int rank_, int dim, typename Number>
template <typename ArrayLike, std::size_t... indices>
-DEAL_II_ALWAYS_INLINE constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<rank_, dim, Number>::Tensor(const ArrayLike &initializer,
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<rank_, dim, Number>::Tensor(const ArrayLike &initializer,
std_cxx14::index_sequence<indices...>)
: values{Tensor<rank_ - 1, dim, Number>(initializer[indices])...}
{
template <int rank_, int dim, typename Number>
-DEAL_II_ALWAYS_INLINE constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<rank_, dim, Number>::Tensor(const array_type &initializer)
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<rank_, dim, Number>::Tensor(const array_type &initializer)
: Tensor(initializer, std_cxx14::make_index_sequence<dim>{})
{}
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_ALWAYS_INLINE constexpr DEAL_II_CUDA_HOST_DEV
-Tensor<rank_, dim, Number>::Tensor(
+constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+ Tensor<rank_, dim, Number>::Tensor(
const Tensor<rank_, dim, OtherNumber> &initializer)
: Tensor(initializer, std_cxx14::make_index_sequence<dim>{})
{}
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_ALWAYS_INLINE constexpr Tensor<rank_, dim, Number>::Tensor(
+constexpr DEAL_II_ALWAYS_INLINE
+Tensor<rank_, dim, Number>::Tensor(
const Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>> &initializer)
: Tensor(initializer, std_cxx14::make_index_sequence<dim>{})
{}
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_ALWAYS_INLINE constexpr Tensor<rank_, dim, Number>::
-operator Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>>() const
+constexpr DEAL_II_ALWAYS_INLINE Tensor<rank_, dim, Number>::
+ operator Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>>() const
{
return Tensor<1, dim, Tensor<rank_ - 1, dim, Number>>(values);
}
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV //
typename Tensor<rank_, dim, Number>::value_type &Tensor<rank_, dim, Number>::
operator[](const unsigned int i)
{
template <int rank_, int dim, typename Number>
-DEAL_II_ALWAYS_INLINE constexpr DEAL_II_CUDA_HOST_DEV const typename Tensor<
- rank_,
- dim,
- Number>::value_type &Tensor<rank_, dim, Number>::
- operator[](const unsigned int i) const
+constexpr DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV const typename Tensor<rank_, dim, Number>::value_type &
+ Tensor<rank_, dim, Number>::operator[](const unsigned int i) const
{
return values[i];
}
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline const Number &Tensor<rank_, dim, Number>::
- operator[](const TableIndices<rank_> &indices) const
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE const Number &
+ Tensor<rank_, dim, Number>::
+ operator[](const TableIndices<rank_> &indices) const
{
Assert(dim != 0,
ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline Number &Tensor<rank_, dim, Number>::
- operator[](const TableIndices<rank_> &indices)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number &
+ Tensor<rank_, dim, Number>::operator[](const TableIndices<rank_> &indices)
{
Assert(dim != 0,
ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
-Tensor<rank_, dim, Number>::operator+=(const Tensor<rank_, dim, OtherNumber> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
+ Tensor<rank_, dim, Number>::
+ operator+=(const Tensor<rank_, dim, OtherNumber> &p)
{
for (unsigned int i = 0; i < dim; ++i)
values[i] += p.values[i];
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
-Tensor<rank_, dim, Number>::operator-=(const Tensor<rank_, dim, OtherNumber> &p)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
+ Tensor<rank_, dim, Number>::
+ operator-=(const Tensor<rank_, dim, OtherNumber> &p)
{
for (unsigned int i = 0; i < dim; ++i)
values[i] -= p.values[i];
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
-Tensor<rank_, dim, Number>::operator*=(const OtherNumber &s)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
+ Tensor<rank_, dim, Number>::operator*=(const OtherNumber &s)
{
for (unsigned int i = 0; i < dim; ++i)
values[i] *= s;
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
-Tensor<rank_, dim, Number>::operator/=(const OtherNumber &s)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number> &
+ Tensor<rank_, dim, Number>::operator/=(const OtherNumber &s)
{
for (unsigned int i = 0; i < dim; ++i)
values[i] /= s;
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number>
-Tensor<rank_, dim, Number>::operator-() const
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE
+ DEAL_II_CUDA_HOST_DEV Tensor<rank_, dim, Number>
+ Tensor<rank_, dim, Number>::operator-() const
{
Tensor<rank_, dim, Number> tmp;
template <int rank_, int dim, typename Number>
-DEAL_II_CONSTEXPR inline DEAL_II_CUDA_HOST_DEV
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
typename numbers::NumberTraits<Number>::real_type
Tensor<rank_, dim, Number>::norm_square() const
{
* @author Wolfgang Bangerth, 2009
*/
template <int dim, typename Number>
-DEAL_II_CONSTEXPR inline Number
-determinant(const Tensor<2, dim, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Number
+ determinant(const Tensor<2, dim, Number> &t)
{
// Compute the determinant using the Laplace expansion of the
// determinant. We expand along the last row.
* @relatesalso Tensor
*/
template <typename Number>
-constexpr Number
-determinant(const Tensor<2, 1, Number> &t)
+constexpr DEAL_II_ALWAYS_INLINE Number
+ determinant(const Tensor<2, 1, Number> &t)
{
return t[0][0];
}
#ifndef DOXYGEN
template <typename Number>
-DEAL_II_CONSTEXPR inline Tensor<2, 1, Number>
-invert(const Tensor<2, 1, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Tensor<2, 1, Number>
+ invert(const Tensor<2, 1, Number> &t)
{
Tensor<2, 1, Number> return_tensor;
template <typename Number>
-DEAL_II_CONSTEXPR inline Tensor<2, 2, Number>
-invert(const Tensor<2, 2, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Tensor<2, 2, Number>
+ invert(const Tensor<2, 2, Number> &t)
{
Tensor<2, 2, Number> return_tensor;
template <typename Number>
-DEAL_II_CONSTEXPR inline Tensor<2, 3, Number>
-invert(const Tensor<2, 3, Number> &t)
+DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE Tensor<2, 3, Number>
+ invert(const Tensor<2, 3, Number> &t)
{
Tensor<2, 3, Number> return_tensor;