From 3008122f7cf8385b19c07ccf74cccc77247df5f4 Mon Sep 17 00:00:00 2001 From: uujsm <uujsm@student.kit.edu> Date: Mon, 16 Dec 2024 21:31:59 +0100 Subject: [PATCH] [789-deprecate-content-of-globaldefinitions] {min,max} -> std::{min,max} --- src/CardiacAssemble.hpp | 2 +- src/CardiacInterpolation.cpp | 3 ++- src/coupled/solvers/CellModelSolver.hpp | 2 +- src/elasticity/assemble/DGElasticity.cpp | 12 +++++++----- src/elasticity/assemble/EGElasticity.cpp | 14 ++++++-------- src/elasticity/assemble/LagrangeElasticity.cpp | 12 ++++++------ test/cellmodels/TestElphyModels.cpp | 2 +- test/cellmodels/TestSolvers.cpp | 4 ++-- test/elasticity/materials/TestDefaultMaterial.hpp | 6 ++++-- tools/geometries/vtu/ConvertCardiacVtu.cpp | 3 ++- 10 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/CardiacAssemble.hpp b/src/CardiacAssemble.hpp index 57f794183..df092a4e2 100644 --- a/src/CardiacAssemble.hpp +++ b/src/CardiacAssemble.hpp @@ -20,7 +20,7 @@ protected: void setVtkSteps(const std::string& configString){ Config::Get(configString, vtksteps); - vtksteps = max(vtksteps, 1); + vtksteps = std::max(vtksteps, 1); } public: explicit ICardiacAssemble(const std::string& plotEntry= "PlotVTK", const std::string& stepEntry = "PlottingSteps") { diff --git a/src/CardiacInterpolation.cpp b/src/CardiacInterpolation.cpp index a9c8afdc6..70de09f7d 100644 --- a/src/CardiacInterpolation.cpp +++ b/src/CardiacInterpolation.cpp @@ -398,7 +398,8 @@ void smoothMeshData(const Mesh &mesh, Vector &vec) { } if (max_exc_time >= 0.0 && max_amplitude > 0.0) { for (int i = 0; i < c.Corners(); ++i) { - double amplitude = min(mesh.find_vertex(c.Corner(i)).GetData()[2], max_amplitude); + double amplitude = + std::min(mesh.find_vertex(c.Corner(i)).GetData()[2], max_amplitude); DataContainer exc_data({max_exc_time, max_duration, amplitude}); row cornerRow = vec.find_row(c.Corner(i)); mesh.find_vertex(c.Corner(i)).SetData(exc_data); diff --git a/src/coupled/solvers/CellModelSolver.hpp b/src/coupled/solvers/CellModelSolver.hpp index fd15ae633..1dc4c9359 100644 --- a/src/coupled/solvers/CellModelSolver.hpp +++ b/src/coupled/solvers/CellModelSolver.hpp @@ -11,7 +11,7 @@ class CellModelSolver : public CardiacSolver { int plottingsteps; void setPlottingSteps(const std::string& configString = "PlottingSteps"){ Config::Get(configString, plottingsteps); - plottingsteps = min(plottingsteps, 1); + plottingsteps = std::min(plottingsteps, 1); } public: explicit CellModelSolver(IElphyAssemble &A, ElphySolver &eSolver) : elphyA(A), elphySolver(eSolver) { diff --git a/src/elasticity/assemble/DGElasticity.cpp b/src/elasticity/assemble/DGElasticity.cpp index 5bb32a867..32d1b519f 100644 --- a/src/elasticity/assemble/DGElasticity.cpp +++ b/src/elasticity/assemble/DGElasticity.cpp @@ -966,7 +966,7 @@ double DGElasticity::MaxStress(const Vector &U) const { cellS += w * Frobenius(P, P); } - maxS = max(maxS, cellS); + maxS = std::max(maxS, cellS); } return maxS; @@ -1103,8 +1103,10 @@ void DGElasticity::PlotBoundary(const Vector &U, const Vector &scal) const { for (int face = 0; face < c.Faces(); ++face) { DGVectorFieldFaceElement FE(U, *c, face); int bc = u_c.bc(face); - bnd(c(), 0) = max(bnd(c(), 0), (double) bc); - bnd(c(), 1) = max(bnd(c(), 1), bc == 199 ? 1.0 : 0.0); // Fixation Boundary bc == 199 + bnd(c(), 0) = std::max(bnd(c(), 0), (double)bc); + bnd(c(), 1) = + std::max(bnd(c(), 1), + bc == 199 ? 1.0 : 0.0); // Fixation Boundary bc == 199 } } plot.AddData("Boundary", bnd, 0); @@ -1267,8 +1269,8 @@ std::pair<double, double> DGElasticity::detF(const Vector &u) const { for (int q = 0; q < E.nQ(); ++q) { Tensor DU = E.VectorGradient(q, u); double J = det(One + DU); - Jmin = min(Jmin, J); - Jmax = max(Jmax, J); + Jmin = std::min(Jmin, J); + Jmax = std::max(Jmax, J); } } Jmin = PPM->Min(Jmin); diff --git a/src/elasticity/assemble/EGElasticity.cpp b/src/elasticity/assemble/EGElasticity.cpp index 9ac265445..e318f377c 100644 --- a/src/elasticity/assemble/EGElasticity.cpp +++ b/src/elasticity/assemble/EGElasticity.cpp @@ -36,11 +36,9 @@ void EGElasticity::Energy(const cell &c, const Vector &U, double &energy) const // energy += w * rho * (v * v); // energy += w * cellMat.TotalEnergy(F, Q); - - //energy = min(energy,det(F)); + // energy = std::min(energy,det(F)); - energy = max(energy,cellMat.q(E, Q[0])); - + energy = std::max(energy, cellMat.q(E, Q[0])); } return; @@ -852,7 +850,7 @@ double EGElasticity::MaxStress(const Vector &U) const { cellS += w * Frobenius(P, P); } - maxS = max(maxS, cellS); + maxS = std::max(maxS, cellS); } return maxS; @@ -980,7 +978,7 @@ void EGElasticity::PlotBoundary(const Vector &U, const Vector &scal) const { for (int i = 0; i < c.Faces(); ++i) { for (int j = 0; j < U.NumberOfNodalPointsOnFace(*c, i); ++j) { int id = U.IdOfNodalPointOnFace(*c, i, j); - u_c(id, 0) = max(u_c(id, 0), u_c.bc(i) == 199 ? 1.0 : 0.0); + u_c(id, 0) = std::max(u_c(id, 0), u_c.bc(i) == 199 ? 1.0 : 0.0); } } } @@ -1234,8 +1232,8 @@ std::pair<double, double> EGElasticity::detF(const Vector &u) const { for (int q = 0; q < E.nQ(); ++q) { Tensor DU = E.VectorGradient(q, u); double J = det(One + DU); - Jmin = min(Jmin, J); - Jmax = max(Jmax, J); + Jmin = std::min(Jmin, J); + Jmax = std::max(Jmax, J); } } Jmin = PPM->Min(Jmin); diff --git a/src/elasticity/assemble/LagrangeElasticity.cpp b/src/elasticity/assemble/LagrangeElasticity.cpp index 9c262f1e4..ecd738354 100644 --- a/src/elasticity/assemble/LagrangeElasticity.cpp +++ b/src/elasticity/assemble/LagrangeElasticity.cpp @@ -918,7 +918,7 @@ double LagrangeElasticity::MaxStress(const Vector &U) const { cellS += w * Frobenius(P, P); } - maxS = max(maxS, cellS); + maxS = std::max(maxS, cellS); } return maxS; @@ -1124,7 +1124,7 @@ void LagrangeElasticity::PlotBoundary(const Vector &U, const Vector &scal) const for (int i = 0; i < c.Faces(); ++i) { for (int j = 0; j < U.NumberOfNodalPointsOnFace(*c, i); ++j) { int id = U.IdOfNodalPointOnFace(*c, i, j); - u_c(id, 0) = max(u_c(id, 0), u_c.bc(i) == 199 ? 1.0 : 0.0); + u_c(id, 0) = std::max(u_c(id, 0), u_c.bc(i) == 199 ? 1.0 : 0.0); } } } @@ -1338,8 +1338,8 @@ void LagrangeElasticity::EvaluateTractionStiffness(Vector &u) const { double Un = faceElem.QNormal(q) * faceElem.VectorValue(q,u); double w = faceElem.QWeight(q); - s_max = max(s_max,abs(Un)); - s += w * Un * Un; + s_max = std::max(s_max, abs(Un)); + s += w * Un * Un; } } } @@ -1395,8 +1395,8 @@ std::pair<double, double> LagrangeElasticity::detF(const Vector &u) const { for (int q = 0; q < E.nQ(); ++q) { Tensor DU = E.VectorGradient(q, u); double J = det(One + DU); - Jmin = min(Jmin, J); - Jmax = max(Jmax, J); + Jmin = std::min(Jmin, J); + Jmax = std::max(Jmax, J); } } Jmin = PPM->Min(Jmin); diff --git a/test/cellmodels/TestElphyModels.cpp b/test/cellmodels/TestElphyModels.cpp index fbed6f106..c8d3f241a 100644 --- a/test/cellmodels/TestElphyModels.cpp +++ b/test/cellmodels/TestElphyModels.cpp @@ -66,7 +66,7 @@ protected: double v = value[n - O][i]; double r = ref[dn * i]; - e = max(e, abs(v - r)); + e = std::max(e, abs(v - r)); } error[n - O] = e; } diff --git a/test/cellmodels/TestSolvers.cpp b/test/cellmodels/TestSolvers.cpp index 6da3b6741..40acaf6bd 100644 --- a/test/cellmodels/TestSolvers.cpp +++ b/test/cellmodels/TestSolvers.cpp @@ -67,7 +67,7 @@ TEST_P(MCellSolverTest, WithExactSolution) { for (int i = 0; i < value[n - O].size(); ++i) { double t = time[n - O][i]; double v = value[n - O][i]; - e = max(e, v - cellModel->Value(t, std::vector<double>{v})); + e = std::max(e, v - cellModel->Value(t, std::vector<double>{v})); } error[n - O] = e; } @@ -127,7 +127,7 @@ TEST_P(MCellSolverTest, WithoutExactSolution) { double v = value[n - O][i]; double r = ref[dn * i]; - e = max(e, abs(v - r)); + e = std::max(e, abs(v - r)); } error[n - O] = e; } diff --git a/test/elasticity/materials/TestDefaultMaterial.hpp b/test/elasticity/materials/TestDefaultMaterial.hpp index 57e27e97a..1c5111d54 100644 --- a/test/elasticity/materials/TestDefaultMaterial.hpp +++ b/test/elasticity/materials/TestDefaultMaterial.hpp @@ -151,7 +151,8 @@ TYPED_TEST_P(MaterialTest, DerivativeConsistency) { double isoder = mat.IsotropicDerivative(F, H) + mat.AnisotropicDerivative(F, One, H); double numder = numMatDerivative(mat, F, One, H); - EXPECT_NEAR(isoder, numder, 1e-6 * max(1.0, abs(max(isoder, numder)))); + EXPECT_NEAR(isoder, numder, + 1e-6 * std::max(1.0, abs(std::max(isoder, numder)))); } @@ -168,7 +169,8 @@ TYPED_TEST_P(MaterialTest, SecondDerivativeConsistency) { mat.IsotropicSecondDerivative(F, H, G) + mat.AnisotropicSecondDerivative(F, One, H, G); double numder = numMatSecondDerivative(mat, F, One, H, G); - EXPECT_NEAR(isoder, numder, 1e-6 * max(1.0, abs(max(isoder, numder)))); + EXPECT_NEAR(isoder, numder, + 1e-6 * std::max(1.0, abs(std::max(isoder, numder)))); } REGISTER_TYPED_TEST_SUITE_P(MaterialTest, DefaultInstantiation, MoveInstantiation, diff --git a/tools/geometries/vtu/ConvertCardiacVtu.cpp b/tools/geometries/vtu/ConvertCardiacVtu.cpp index 97c98a297..5ef2969e7 100644 --- a/tools/geometries/vtu/ConvertCardiacVtu.cpp +++ b/tools/geometries/vtu/ConvertCardiacVtu.cpp @@ -17,7 +17,8 @@ void smoothMeshData(const Mesh &mesh) { } if (max_exc_time >= 0.0 && max_amplitude > 0.0) { for (int i = 0; i < c.Corners(); ++i) { - double amplitude = min(mesh.find_vertex(c.Corner(i)).GetData()[2], max_amplitude); + double amplitude = + std::min(mesh.find_vertex(c.Corner(i)).GetData()[2], max_amplitude); DataContainer exc_data({max_exc_time, max_duration, amplitude}); mesh.find_vertex(c.Corner(i)).SetData(exc_data); } -- GitLab