diff --git a/Applications/FileIO/CsvInterface.h b/Applications/FileIO/CsvInterface.h index 265a83d222430bcdedadffc2bd7b3e28a6a767ce..3a27c978f89310430d9d54fa2f994c7706a45e47 100644 --- a/Applications/FileIO/CsvInterface.h +++ b/Applications/FileIO/CsvInterface.h @@ -67,8 +67,8 @@ public: std::vector<T> const& vec) { static_assert( - std::is_same<T, std::string>::value || - std::is_same<T, double>::value || std::is_same<T, int>::value, + std::is_same_v<T, std::string> || std::is_same_v<T, double> || + std::is_same_v<T, int>, "CsvInterface can only write vectors of strings, doubles or ints."); if (!_data.empty()) diff --git a/MathLib/LinAlg/GlobalMatrixVectorTypes.h b/MathLib/LinAlg/GlobalMatrixVectorTypes.h index afd1b5c13819e433231504a120084f770bff0f2e..dada4abe4630b30e662f7a920a6817a79929fe8c 100644 --- a/MathLib/LinAlg/GlobalMatrixVectorTypes.h +++ b/MathLib/LinAlg/GlobalMatrixVectorTypes.h @@ -51,12 +51,11 @@ /// A type used for indexing of global vectors and matrices. It is equal to the /// GlobalMatrix::IndexType and the GlobalVector::IndexType. -static_assert(std::is_integral<GlobalMatrix::IndexType>::value, +static_assert(std::is_integral_v<GlobalMatrix::IndexType>, "The index type for global matrices is not an integral type."); -static_assert(std::is_integral<GlobalVector::IndexType>::value, +static_assert(std::is_integral_v<GlobalVector::IndexType>, "The index type for global vectors is not an integral type."); -static_assert(std::is_same<GlobalMatrix::IndexType, - GlobalVector::IndexType>::value, +static_assert(std::is_same_v<GlobalMatrix::IndexType, GlobalVector::IndexType>, "The global matrix and vector index types do not match."); // Both types are integral types and equal, define a single GlobalIndexType. using GlobalIndexType = GlobalMatrix::IndexType; diff --git a/MathLib/Nonlinear/Root1D.h b/MathLib/Nonlinear/Root1D.h index 9deb624af9c0a75e859c7e41f2f8835dc8d4be20..10e81e5fcbefccb00e4768de9c85d081f4d9da58 100644 --- a/MathLib/Nonlinear/Root1D.h +++ b/MathLib/Nonlinear/Root1D.h @@ -51,10 +51,9 @@ public: RegulaFalsi(Function const& f, double a, double b) : _f(f), _a(a), _b(b), _fa(f(a)), _fb(f(b)) { - static_assert( - std::is_same<double, decltype(f(0.0))>::value, - "Using this class for functions that do not return double" - " involves a lot of casts. Hence it is disabled."); + static_assert(std::is_same_v<double, decltype(f(0.0))>, + "Using this class for functions that do not return double" + " involves a lot of casts. Hence it is disabled."); if (detail::almost_zero(_fa)) { _b = _a; diff --git a/MathLib/ODE/CVodeSolver.cpp b/MathLib/ODE/CVodeSolver.cpp index e44636730d54586518581299955a6fcb2b3eec7d..0b9d3c66ec7bed34e7aa9893f2584460884cf60d 100644 --- a/MathLib/ODE/CVodeSolver.cpp +++ b/MathLib/ODE/CVodeSolver.cpp @@ -83,7 +83,7 @@ namespace ODE */ class CVodeSolverImpl final { - static_assert(std::is_same<realtype, double>::value, + static_assert(std::is_same_v<realtype, double>, "CVode's realtype is not the same as double"); public: diff --git a/NumLib/Extrapolation/ExtrapolatableElementCollection.h b/NumLib/Extrapolation/ExtrapolatableElementCollection.h index fce0d10a8d5b8e2f322a9568bd20ef53a454d56a..ec14a203c22bd691630c327ca5f2fb5f2c170673 100644 --- a/NumLib/Extrapolation/ExtrapolatableElementCollection.h +++ b/NumLib/Extrapolation/ExtrapolatableElementCollection.h @@ -80,8 +80,8 @@ class ExtrapolatableLocalAssemblerCollection public: //! LocalAssemblerCollection contains many LocalAssembler's. using LocalAssembler = - typename std::decay<decltype(*std::declval<LocalAssemblerCollection>() - [static_cast<std::size_t>(0)])>::type; + typename std::decay_t<decltype(*std::declval<LocalAssemblerCollection>() + [static_cast<std::size_t>(0)])>; static_assert(std::is_base_of<ExtrapolatableElement, LocalAssembler>::value, "Local assemblers used for extrapolation must be derived " diff --git a/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h b/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h index b20825ecbfcf740a71f786b365ec6a3fba1e0223..08f084e39a51b590f23de63cd52572cddddb8a63 100644 --- a/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h +++ b/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h @@ -26,8 +26,8 @@ GenericNaturalBoundaryCondition<BoundaryConditionData, unsigned const global_dim, MeshLib::Mesh const& bc_mesh, Data&& data) : _data(std::forward<Data>(data)), _bc_mesh(bc_mesh) { - static_assert(std::is_same<typename std::decay<BoundaryConditionData>::type, - typename std::decay<Data>::type>::value, + static_assert(std::is_same_v<typename std::decay_t<BoundaryConditionData>, + typename std::decay_t<Data>>, "Type mismatch between declared and passed BC data."); // check basic data consistency diff --git a/ProcessLib/Output/SecondaryVariable.h b/ProcessLib/Output/SecondaryVariable.h index 4599f02025ea8c1e99d9a67f4111bb21076085d6..9a1c0974051f08b71ffa04854def70c881be466b 100644 --- a/ProcessLib/Output/SecondaryVariable.h +++ b/ProcessLib/Output/SecondaryVariable.h @@ -50,22 +50,22 @@ struct SecondaryVariableFunctions final { // Used to detect nasty implicit conversions. static_assert( - std::is_same< + std::is_same_v< GlobalVector const&, - typename std::invoke_result< + typename std::invoke_result_t< F1, double const, std::vector<GlobalVector*> const&, std::vector<NumLib::LocalToGlobalIndexMap const*> const&, - std::unique_ptr<GlobalVector>&>::type>::value, + std::unique_ptr<GlobalVector>&>>, "The function eval_field_ does not return a const reference" " to a GlobalVector"); static_assert( - std::is_same< + std::is_same_v< GlobalVector const&, - typename std::invoke_result< + typename std::invoke_result_t< F2, double const, std::vector<GlobalVector*> const&, std::vector<NumLib::LocalToGlobalIndexMap const*> const&, - std::unique_ptr<GlobalVector>&>::type>::value, + std::unique_ptr<GlobalVector>&>>, "The function eval_residuals_ does not return a const reference" " to a GlobalVector"); } @@ -78,12 +78,12 @@ struct SecondaryVariableFunctions final { // Used to detect nasty implicit conversions. static_assert( - std::is_same< + std::is_same_v< GlobalVector const&, - typename std::invoke_result< + typename std::invoke_result_t< F1, double const, std::vector<GlobalVector*> const&, std::vector<NumLib::LocalToGlobalIndexMap const*> const&, - std::unique_ptr<GlobalVector>&>::type>::value, + std::unique_ptr<GlobalVector>&>>, "The function eval_field_ does not return a const reference" " to a GlobalVector"); } diff --git a/ProcessLib/TES/TESLocalAssembler.h b/ProcessLib/TES/TESLocalAssembler.h index df5407737b0cb6218a0b06e7c66d32e94ddbbc55..f41cbcf06ee2b4c27bdbf4b1aa818ac3103b1012 100644 --- a/ProcessLib/TES/TESLocalAssembler.h +++ b/ProcessLib/TES/TESLocalAssembler.h @@ -145,13 +145,10 @@ private: using NodalMatrixType = typename LAT::LocalMatrix; using NodalVectorType = typename LAT::LocalVector; - static_assert( - std::is_same<NodalMatrixType, typename LAT::LocalMatrix>::value, - "local matrix and data traits matrix do not coincide"); - static_assert( - std::is_same<NodalVectorType, typename LAT::LocalVector>::value, - "local vector and data traits vector do not coincide"); - + static_assert(std::is_same_v<NodalMatrixType, typename LAT::LocalMatrix>, + "local matrix and data traits matrix do not coincide"); + static_assert(std::is_same_v<NodalVectorType, typename LAT::LocalVector>, + "local vector and data traits vector do not coincide"); }; } // namespace TES diff --git a/Tests/MathLib/TestNonlinear1D.cpp b/Tests/MathLib/TestNonlinear1D.cpp index c076a12e95995b09fa777fbdc17ac6b47c49a276..2173c444da5b91e22c3a12ae92d62f9ef5bfe1f5 100644 --- a/Tests/MathLib/TestNonlinear1D.cpp +++ b/Tests/MathLib/TestNonlinear1D.cpp @@ -53,10 +53,13 @@ TYPED_TEST(MathLibRegulaFalsi, QuadraticFunction) auto const error = std::abs(f(rf.getResult())); - if (!std::is_same<NL::Unmodified, TypeParam>::value) { + if (!std::is_same_v<NL::Unmodified, TypeParam>) + { EXPECT_GT(std::numeric_limits<double>::epsilon(), old_range); EXPECT_GT(std::numeric_limits<double>::epsilon(), error); - } else { + } + else + { // The unmodified regula falsi method converges very slowly. EXPECT_GT(100.0*std::numeric_limits<double>::epsilon(), error); } diff --git a/Tests/NumLib/TestODEInt.cpp b/Tests/NumLib/TestODEInt.cpp index d7fa999d1d02b4b9630d27b9795021868adb8186..47358596b3bb144f7d3f277be59b76f2d7497679 100644 --- a/Tests/NumLib/TestODEInt.cpp +++ b/Tests/NumLib/TestODEInt.cpp @@ -123,7 +123,7 @@ private: }; template <typename TimeDisc, typename ODE, NumLib::NonlinearSolverTag NLTag> -typename std::enable_if<std::is_same<TimeDisc, NumLib::BackwardEuler>::value, +typename std::enable_if<std::is_same_v<TimeDisc, NumLib::BackwardEuler>, Solution>::type run_test_case(const unsigned num_timesteps) { diff --git a/Tests/NumLib/TestShapeFunctions.cpp b/Tests/NumLib/TestShapeFunctions.cpp index aca35e3a76624f8738d364097423c69af2217f49..c6385761733b0f1b7c9bd9e671d590a6d19d9fd6 100644 --- a/Tests/NumLib/TestShapeFunctions.cpp +++ b/Tests/NumLib/TestShapeFunctions.cpp @@ -46,20 +46,20 @@ struct NaturalPointGenerator result_type intervalMap(result_type const& tuple) const { - if (std::is_same<ShapeFunction, NumLib::ShapeLine2>::value || - std::is_same<ShapeFunction, NumLib::ShapeLine3>::value || - std::is_same<ShapeFunction, NumLib::ShapeQuad4>::value || - std::is_same<ShapeFunction, NumLib::ShapeQuad8>::value || - std::is_same<ShapeFunction, NumLib::ShapeQuad9>::value || - std::is_same<ShapeFunction, NumLib::ShapeHex8>::value || - std::is_same<ShapeFunction, NumLib::ShapeHex20>::value) + if (std::is_same_v<ShapeFunction, NumLib::ShapeLine2> || + std::is_same_v<ShapeFunction, NumLib::ShapeLine3> || + std::is_same_v<ShapeFunction, NumLib::ShapeQuad4> || + std::is_same_v<ShapeFunction, NumLib::ShapeQuad8> || + std::is_same_v<ShapeFunction, NumLib::ShapeQuad9> || + std::is_same_v<ShapeFunction, NumLib::ShapeHex8> || + std::is_same_v<ShapeFunction, NumLib::ShapeHex20>) { return tuple; } - if (std::is_same<ShapeFunction, NumLib::ShapeTri3>::value || - std::is_same<ShapeFunction, NumLib::ShapeTri6>::value || - std::is_same<ShapeFunction, NumLib::ShapeTet4>::value || - std::is_same<ShapeFunction, NumLib::ShapeTet10>::value) + if (std::is_same_v<ShapeFunction, NumLib::ShapeTri3> || + std::is_same_v<ShapeFunction, NumLib::ShapeTri6> || + std::is_same_v<ShapeFunction, NumLib::ShapeTet4> || + std::is_same_v<ShapeFunction, NumLib::ShapeTet10>) { // Map square (x, y) \in [-1, 1]^2 to a triangle such that x,y // \in [0, 1], and x+y \in [0, 2/2].