From 20845a39ccbea33a1d8f04d93be2369fb3786229 Mon Sep 17 00:00:00 2001 From: huguesdpdn Date: Fri, 16 Aug 2024 00:38:24 +0200 Subject: [PATCH] Correct compilation warnings with exceptions (#76) --- OndselSolver/ASMTAssembly.cpp | 2 +- OndselSolver/DifferenceOperator.cpp | 2 +- OndselSolver/PosICNewtonRaphson.cpp | 2 +- OndselSolver/QuasiIntegrator.cpp | 6 +++--- OndselSolver/SystemSolver.cpp | 4 ++-- OndselSolver/VectorNewtonRaphson.cpp | 2 +- OndselSolver/VelSolver.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index 053e182..1517862 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -1434,7 +1434,7 @@ void MbD::ASMTAssembly::runKINEMATIC() try { mbdSystem->runKINEMATIC(mbdSystem); } - catch (SimulationStoppingError ex) { + catch (const SimulationStoppingError& ex) { } } diff --git a/OndselSolver/DifferenceOperator.cpp b/OndselSolver/DifferenceOperator.cpp index 4951ac6..fb457bc 100644 --- a/OndselSolver/DifferenceOperator.cpp +++ b/OndselSolver/DifferenceOperator.cpp @@ -36,7 +36,7 @@ void DifferenceOperator::calcOperatorMatrix() try { operatorMatrix = CREATE::With()->inversesaveOriginal(taylorMatrix, false); } - catch (SingularMatrixError ex) { + catch (const SingularMatrixError& ex) { } } diff --git a/OndselSolver/PosICNewtonRaphson.cpp b/OndselSolver/PosICNewtonRaphson.cpp index d97779d..14ce0d3 100644 --- a/OndselSolver/PosICNewtonRaphson.cpp +++ b/OndselSolver/PosICNewtonRaphson.cpp @@ -32,7 +32,7 @@ void PosICNewtonRaphson::run() postRun(); break; } - catch (SingularMatrixError ex) { + catch (const SingularMatrixError& ex) { auto redundantEqnNos = ex.getRedundantEqnNos(); system->partsJointsMotionsLimitsDo([&](std::shared_ptr item) { item->removeRedundantConstraints(redundantEqnNos); }); system->partsJointsMotionsLimitsDo([&](std::shared_ptr item) { item->constraintsReport(); }); diff --git a/OndselSolver/QuasiIntegrator.cpp b/OndselSolver/QuasiIntegrator.cpp index 9b8d7c0..4bb6075 100644 --- a/OndselSolver/QuasiIntegrator.cpp +++ b/OndselSolver/QuasiIntegrator.cpp @@ -41,7 +41,7 @@ void QuasiIntegrator::run() try { IntegratorInterface::run(); } - catch (SingularMatrixError ex) { + catch (const SingularMatrixError& ex) { std::stringstream ss; ss << "MbD: Solver has encountered a singular matrix." << std::endl; ss << "MbD: Check to see if a massless or a very low mass part is under constrained." << std::endl; @@ -53,7 +53,7 @@ void QuasiIntegrator::run() throw SimulationStoppingError("singular matrix"); } } - catch (TooSmallStepSizeError ex) { + catch (const TooSmallStepSizeError& ex) { std::stringstream ss; ss << "MbD: Step size is prevented from going below the user specified minimum." << std::endl; ss << "MbD: Check to see if the system is in a locked position." << std::endl; @@ -64,7 +64,7 @@ void QuasiIntegrator::run() throw SimulationStoppingError("stepSize < stepSizeMin"); } } - catch (TooManyTriesError ex) { + catch (const TooManyTriesError& ex) { std::stringstream ss; ss << "MbD: Check to see if the error tolerance is too demanding." << std::endl; auto str = ss.str(); diff --git a/OndselSolver/SystemSolver.cpp b/OndselSolver/SystemSolver.cpp index c5b0e01..7926f17 100644 --- a/OndselSolver/SystemSolver.cpp +++ b/OndselSolver/SystemSolver.cpp @@ -161,7 +161,7 @@ void SystemSolver::runBasicKinematic() basicIntegrator->setSystem(this); basicIntegrator->run(); } - catch (NotKinematicError ex) { + catch (const NotKinematicError& ex) { this->runQuasiKinematic(); } } @@ -186,7 +186,7 @@ void SystemSolver::runQuasiKinematic() basicIntegrator->setSystem(this); basicIntegrator->run(); } - catch (DiscontinuityError ex) { + catch (const DiscontinuityError& ex) { this->discontinuityBlock(); } } diff --git a/OndselSolver/VectorNewtonRaphson.cpp b/OndselSolver/VectorNewtonRaphson.cpp index eadafa8..ed2d5ca 100644 --- a/OndselSolver/VectorNewtonRaphson.cpp +++ b/OndselSolver/VectorNewtonRaphson.cpp @@ -53,7 +53,7 @@ void VectorNewtonRaphson::solveEquations() try { this->basicSolveEquations(); } - catch (SingularMatrixError ex) { + catch (const SingularMatrixError& ex) { this->handleSingularMatrix(); } } diff --git a/OndselSolver/VelSolver.cpp b/OndselSolver/VelSolver.cpp index 3987b47..4853f8b 100644 --- a/OndselSolver/VelSolver.cpp +++ b/OndselSolver/VelSolver.cpp @@ -58,7 +58,7 @@ void VelSolver::solveEquations() try { this->basicSolveEquations(); } - catch (SingularMatrixError ex) { + catch (const SingularMatrixError& ex) { this->handleSingularMatrix(); } }