From 60fc139d3da2f99b9c8b49cb3d9a34844da267ae Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Wed, 22 Nov 2023 23:05:59 -0600 Subject: [PATCH] fix possible subtle conversions --- OndselSolver/EulerParameters.cpp | 3 +++ OndselSolver/FullColumn.cpp | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 77434db..871a41b 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -16,6 +16,7 @@ namespace MbD { FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) { (void) col; // to suppress compiler warning of unused parameters assert(false); + return {}; } template<> FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) @@ -65,6 +66,7 @@ namespace MbD { { (void) col; // to suppress compiler warning of unused parameters assert(false); + return {}; } template<> FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) @@ -135,6 +137,7 @@ namespace MbD { { (void) mat; // to suppress compiler warning of unused parameters assert(false); + return {}; } template<> FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index 9e47b6b..cd8ab1e 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -59,7 +59,8 @@ namespace MbD { template void FullColumn::atiputFullColumn(int i, FColsptr fullCol) { - for (size_t ii = 0; ii < fullCol->size(); ii++) + int n = (int)fullCol->size(); + for (int ii = 0; ii < n; ii++) { this->at(i + ii) = fullCol->at(ii); } @@ -67,7 +68,8 @@ namespace MbD { template void FullColumn::atiplusFullColumn(int i, FColsptr fullCol) { - for (size_t ii = 0; ii < fullCol->size(); ii++) + int n = (int)fullCol->size(); + for (int ii = 0; ii < n; ii++) { this->at(i + ii) += fullCol->at(ii); } @@ -76,7 +78,8 @@ namespace MbD { void FullColumn::equalSelfPlusFullColumnAt(FColsptr fullCol, int ii) { //self is subcolumn of fullCol - for (size_t i = 0; i < this->size(); i++) + int n = (int) this->size(); + for (int i = 0; i < n; i++) { this->at(i) += fullCol->at(ii + i); } @@ -84,7 +87,8 @@ namespace MbD { template void FullColumn::atiminusFullColumn(int i1, FColsptr fullCol) { - for (size_t ii = 0; ii < fullCol->size(); ii++) + int n = fullCol->size(); + for (int ii = 0; ii < n; ii++) { int i = i1 + ii; this->at(i) -= fullCol->at(ii); @@ -94,7 +98,7 @@ namespace MbD { void FullColumn::equalFullColumnAt(FColsptr fullCol, int i) { this->equalArrayAt(fullCol, i); - //for (size_t ii = 0; ii < this->size(); ii++) + //for (int ii = 0; ii < this->size(); ii++) //{ // this->at(ii) = fullCol->at(i + ii); //} @@ -102,7 +106,7 @@ namespace MbD { template<> FColDsptr FullColumn::copy() { - auto n = (int) this->size(); + int n = (int) this->size(); auto answer = std::make_shared>(n); for (int i = 0; i < n; i++) { @@ -129,7 +133,8 @@ namespace MbD { template void FullColumn::atiplusFullColumntimes(int i1, FColsptr fullCol, T factor) { - for (size_t ii = 0; ii < fullCol->size(); ii++) + int n = fullCol->size(); + for (int ii = 0; ii < n; ii++) { int i = i1 + ii; this->at(i) += fullCol->at(ii) * factor;