From 0016dfbc4c9126251ed8938ac902556b552272ec Mon Sep 17 00:00:00 2001 From: Hugh Carson Date: Thu, 3 Aug 2023 14:03:20 -0400 Subject: [PATCH] Change to using std::max_element to calculate Lc --- palace/utils/iodata.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/palace/utils/iodata.cpp b/palace/utils/iodata.cpp index d766df879..573fd18d1 100644 --- a/palace/utils/iodata.cpp +++ b/palace/utils/iodata.cpp @@ -400,17 +400,9 @@ void IoData::NondimensionalizeInputs(mfem::ParMesh &mesh) { mfem::Vector bbmin, bbmax; mesh.GetBoundingBox(bbmin, bbmax); - bbmin *= model.L0; // [m] - bbmax *= model.L0; - Lc = -mfem::infinity(); - for (int d = 0; d < mesh.SpaceDimension(); d++) - { - double l = bbmax(d) - bbmin(d); - if (Lc < l) - { - Lc = l; // [m] - } - } + bbmax -= bbmin; + bbmax *= model.L0; // [m] + Lc = *std::max_element(bbmax.begin(), bbmax.end()); } tc = 1.0e9 * Lc / electromagnetics::c0_; // [ns]