From: Jean-Paul Pelteret Date: Sun, 16 May 2021 11:37:58 +0000 (+0200) Subject: Specify scalar operation result type X-Git-Tag: v9.3.0-rc1~64^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00445bc96f03cac6cf64625a87a824ac6fec522d;p=dealii.git Specify scalar operation result type Fixes issue with Sacado expression templates, where we do not know how to multiply a Sacado math operation result (expression template) with a Tensor or SymmetricTensor. --- diff --git a/include/deal.II/physics/elasticity/kinematics.h b/include/deal.II/physics/elasticity/kinematics.h index 059cb72ebf..1f5dcbe454 100644 --- a/include/deal.II/physics/elasticity/kinematics.h +++ b/include/deal.II/physics/elasticity/kinematics.h @@ -34,15 +34,14 @@ namespace Physics /** * A collection of tensor definitions for deformation and strain measures, * as well as a few special transformations, that conform to notation used - in - * standard scientific literature, in particular the books of + * in standard scientific literature, in particular the books of * Holzapfel (2007) and Wriggers (2008). The citation for these references, * as well as other notation used here, can be found in the description for * the Physics::Elasticity namespace. - * @note These hold specifically for the codimension - * 0 case, where the metric tensor is the identity tensor. -*/ + * @note These hold specifically for the codimension 0 case, + * where the metric tensor is the identity tensor. + */ namespace Kinematics { /** @@ -289,7 +288,9 @@ template inline Tensor<2, dim, Number> Physics::Elasticity::Kinematics::F_iso(const Tensor<2, dim, Number> &F) { - return std::pow(determinant(F), -1.0 / dim) * F; + return internal::NumberType::value( + std::pow(determinant(F), -1.0 / dim)) * + F; } diff --git a/include/deal.II/physics/elasticity/standard_tensors.h b/include/deal.II/physics/elasticity/standard_tensors.h index 8ae642a4ef..86b0512e42 100644 --- a/include/deal.II/physics/elasticity/standard_tensors.h +++ b/include/deal.II/physics/elasticity/standard_tensors.h @@ -373,7 +373,8 @@ DEAL_II_CONSTEXPR SymmetricTensor<2, dim, Number> Physics::Elasticity::StandardTensors::ddet_F_dC( const Tensor<2, dim, Number> &F) { - return Number(0.5) * determinant(F) * symmetrize(invert(transpose(F) * F)); + return internal::NumberType::value(0.5 * determinant(F)) * + symmetrize(invert(transpose(F) * F)); } diff --git a/tests/ad_common_tests/symmetric_tensor_functions_04.h b/tests/ad_common_tests/symmetric_tensor_functions_04.h index a62d9a8ef4..6c6739e847 100644 --- a/tests/ad_common_tests/symmetric_tensor_functions_04.h +++ b/tests/ad_common_tests/symmetric_tensor_functions_04.h @@ -110,7 +110,8 @@ struct IncompressibleNeoHookeanPrincipalStretches { const NumberType & lambda_squared = eig_C[d].first; const Tensor<1, dim, NumberType> &N = eig_C[d].second; - C_inv += (1.0 / lambda_squared) * symmetrize(outer_product(N, N)); + C_inv += + NumberType(1.0 / lambda_squared) * symmetrize(outer_product(N, N)); } const SymmetricTensor<2, dim, NumberType> I =