From: David Wells Date: Mon, 29 Aug 2022 18:31:00 +0000 (-0400) Subject: Handle a test which fails under GCC 5.4 X-Git-Tag: v9.5.0-rc1~1006^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14211%2Fhead;p=dealii.git Handle a test which fails under GCC 5.4 --- diff --git a/tests/physics/notation-kelvin_01.cc b/tests/physics/notation-kelvin_01.cc index a6b59949f5..98adfd9627 100644 --- a/tests/physics/notation-kelvin_01.cc +++ b/tests/physics/notation-kelvin_01.cc @@ -147,9 +147,12 @@ test_rank_0_tensors() const Vector vA = Notation::Kelvin::to_vector(A); const FullMatrix mA = Notation::Kelvin::to_matrix(A); - using InpType = typename std::decay::type; - const auto vA_conv = Notation::Kelvin::to_tensor(vA); - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + using InpType = typename std::decay::type; + // Here and below we need both types to work around a problem present in GCC + // 5.4.0 in which the compiler does not correctly handle SFINAE with + // static_assert(). This was fixed by GCC 9. + const auto vA_conv = Notation::Kelvin::to_tensor(vA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert(std::abs(vA_conv - A) < 1e-12, ExcMessage("Different result for vector conversion")); @@ -167,7 +170,7 @@ test_rank_1_tensors() const Vector vA = Notation::Kelvin::to_vector(A); using InpType = typename std::decay::type; - const auto vA_conv = Notation::Kelvin::to_tensor(vA); + const auto vA_conv = Notation::Kelvin::to_tensor(vA); Assert((vA_conv - A).norm() < 1e-12, ExcMessage("Different result for vector conversion")); @@ -186,8 +189,8 @@ test_rank_2_tensors() const FullMatrix mA = Notation::Kelvin::to_matrix(A); using InpType = typename std::decay::type; - const auto vA_conv = Notation::Kelvin::to_tensor(vA); - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto vA_conv = Notation::Kelvin::to_tensor(vA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((vA_conv - A).norm() < 1e-12, ExcMessage("Different result for vector conversion")); @@ -204,8 +207,8 @@ test_rank_2_tensors() const FullMatrix mA = Notation::Kelvin::to_matrix(A); using InpType = typename std::decay::type; - const auto vA_conv = Notation::Kelvin::to_tensor(vA); - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto vA_conv = Notation::Kelvin::to_tensor(vA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((vA_conv - A).norm() < 1e-12, ExcMessage("Different result for vector conversion")); @@ -227,7 +230,7 @@ test_rank_3_tensors() Notation::Kelvin::to_matrix, Tensor<2, dim>>(A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); @@ -242,7 +245,7 @@ test_rank_3_tensors() Notation::Kelvin::to_matrix, Tensor<1, dim>>(A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); @@ -258,7 +261,7 @@ test_rank_3_tensors() A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); @@ -274,7 +277,7 @@ test_rank_3_tensors() A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); @@ -293,7 +296,7 @@ test_rank_4_tensors() const FullMatrix mA = Notation::Kelvin::to_matrix(A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); @@ -307,7 +310,7 @@ test_rank_4_tensors() const FullMatrix mA = Notation::Kelvin::to_matrix(A); using InpType = typename std::decay::type; - const auto mA_conv = Notation::Kelvin::to_tensor(mA); + const auto mA_conv = Notation::Kelvin::to_tensor(mA); Assert((mA_conv - A).norm() < 1e-12, ExcMessage("Different result for matrix conversion")); diff --git a/tests/physics/notation-kelvin_02.cc b/tests/physics/notation-kelvin_02.cc index 84756e39c3..1d0b4cc99b 100644 --- a/tests/physics/notation-kelvin_02.cc +++ b/tests/physics/notation-kelvin_02.cc @@ -135,12 +135,15 @@ test_scalars() Vector vB(mC.m()); mC.vmult(vB, vA); - using InpVecType = typename std::decay::type; - using ResVecType = typename std::decay::type; - using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + using InpVecType = typename std::decay::type; + using ResVecType = typename std::decay::type; + using InpMatType = typename std::decay::type; + // Here and below we need both types to work around a problem present in GCC + // 5.4.0 in which the compiler does not correctly handle SFINAE with + // static_assert(). This was fixed by GCC 9. + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Scalar" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -178,9 +181,9 @@ test_rank_0_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 0" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -222,9 +225,9 @@ test_rank_1_2_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 1 (non-symm)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -262,9 +265,9 @@ test_rank_1_2_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 1 (symm)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -307,9 +310,9 @@ test_rank_2_4_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 2 (non-symm)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -347,9 +350,9 @@ test_rank_2_4_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 2 (symm)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -390,9 +393,9 @@ test_rank_2_4_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 2 (non-symm from symm)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -437,9 +440,9 @@ test_rank_3_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 3 (non-symm 1)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -481,9 +484,9 @@ test_rank_3_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 3 (non-symm 2)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -526,9 +529,9 @@ test_rank_3_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 3 (symm 1)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl; @@ -571,9 +574,9 @@ test_rank_3_tensors() using InpVecType = typename std::decay::type; using ResVecType = typename std::decay::type; using InpMatType = typename std::decay::type; - const auto A_conv = Notation::Kelvin::to_tensor(vA); - const auto B_conv = Notation::Kelvin::to_tensor(vB); - const auto C_conv = Notation::Kelvin::to_tensor(mC); + const auto A_conv = Notation::Kelvin::to_tensor(vA); + const auto B_conv = Notation::Kelvin::to_tensor(vB); + const auto C_conv = Notation::Kelvin::to_tensor(mC); std::cout << "Rank 3 (symm 2)" << std::endl; std::cout << "A: " << A << " A_conv: " << A_conv << std::endl;