Skip to content

Commit

Permalink
Merge pull request #70 from Ondsel-Development/fix-compiler-warnings
Browse files Browse the repository at this point in the history
Fix various compiler warnings
  • Loading branch information
PaddleStroke authored Jul 5, 2024
2 parents 47f27dd + 2b48cda commit 64e546f
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 29 deletions.
4 changes: 2 additions & 2 deletions OndselSolver/ASMTAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ void MbD::ASMTAssembly::preMbDrun(std::shared_ptr<System> mbdSys)
std::static_pointer_cast<Part>(mbdObject)->asFixed();
}

void MbD::ASMTAssembly::preMbDrunDragStep(std::shared_ptr<System> mbdSys, std::shared_ptr<std::vector<std::shared_ptr<Part>>> dragParts)
void MbD::ASMTAssembly::preMbDrunDragStep(std::shared_ptr<System> mbdSys, std::shared_ptr<std::vector<std::shared_ptr<Part>>> /*dragParts*/)
{
for (auto& part : *parts) {
part->preMbDrunDragStep(mbdSys, mbdUnits);
Expand Down Expand Up @@ -1371,7 +1371,7 @@ void MbD::ASMTAssembly::runDragStep(
auto qEO2 = cqEO2->at(j);
std::shared_ptr<EulerParameters<double>> qEOmid;
auto cosHalfTheta = qEO1->dot(qEO2);
if (abs(cosHalfTheta) >= 1.0) {
if (std::abs(cosHalfTheta) >= 1.0) {
qEOmid = qEO1->copy();
}
else {
Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/ASMTPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include <ostream>
#include <fstream>
#include <ostream>
#include <fstream>

#include "ASMTPart.h"
#include "CREATE.h"
Expand Down Expand Up @@ -126,7 +126,7 @@ void MbD::ASMTPart::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Un
if (isFixed) std::static_pointer_cast<Part>(mbdObject)->asFixed();
}

void MbD::ASMTPart::preMbDrunDragStep(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits)
void MbD::ASMTPart::preMbDrunDragStep(std::shared_ptr<System> /*mbdSys*/, std::shared_ptr<Units> mbdUnits)
{
auto mbdPart = std::static_pointer_cast<Part>(mbdObject);
mbdPart->qX(rOcmO()->times(1.0 / mbdUnits->length));
Expand Down
6 changes: 4 additions & 2 deletions OndselSolver/ConstraintIJ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#include "ConstraintIJ.h"

#include <utility>
#include "EndFramec.h"

using namespace MbD;

ConstraintIJ::ConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj) : frmI(frmi), frmJ(frmj), Constraint()
ConstraintIJ::ConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj) : frmI(std::move(frmi)), frmJ(std::move(frmj))
{
}

Expand Down
4 changes: 2 additions & 2 deletions OndselSolver/ConstraintIJ.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
namespace MbD {
class EndFramec;
using EndFrmsptr = std::shared_ptr<EndFramec>;

class ConstraintIJ : public Constraint
{
//frmI frmJ aConstant
//frmI frmJ aConstant
public:
ConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj);

Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/GESpMatFullPv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void GESpMatFullPv::backSubstituteIntoDU()
for (auto const& keyValue : *rowi) {
auto jj = keyValue.first;
auto j = positionsOfOriginalCols->at(jj);
if (j > i) {
if ((int) j > i) {
duij = keyValue.second;
sum += answerX->at(jj) * duij;
}
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/GESpMatParPv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void GESpMatParPv::backSubstituteIntoDU()
sum = 0.0; // rhsZeroElement copy.
for (auto const& keyValue : *rowi) {
auto j = keyValue.first;
if (j > i) {
if ((int)j > i) {
duij = keyValue.second;
sum += answerX->at(j) * duij;
}
Expand Down
4 changes: 2 additions & 2 deletions OndselSolver/GeneralSpline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void MbD::GeneralSpline::computeDerivatives()
}
else {
//"Zero out higher derivatives at node n and node 1 to get the p end equations."
auto count = 0;
unsigned int count = 0;
auto npass = 0;
while (count < p) {
matrix->atijput(np - count, np - npass, 1.0);
Expand Down Expand Up @@ -149,7 +149,7 @@ double MbD::GeneralSpline::derivativeAt(size_t n, double xxx)
calcIndexAndDeltaFor(xxx);
auto& derivsi = derivs->at(index);
double sum = 0.0;
for (int j = (int)degree; j >= n + 1; j--) //Use int because of decrement
for (int j = (int)degree; j >= (int) n + 1; j--) //Use int because of decrement
{
sum = (sum + derivsi->at((size_t)j - 1)) * delta / (j - n);
}
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/LDUFullMat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void LDUFullMat::backSubstituteIntoDU()
{
auto& rowi = matrixA->at(i);
double sum = answerX->at((size_t)n - 1) * rowi->at((size_t)n - 1);
for (int j = i + 1; j < n - 1; j++)
for (int j = i + 1; j < (int)n - 1; j++)
{
sum += answerX->at(j) * rowi->at(j);
}
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/LDUSpMat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#include "LDUSpMat.h"
#include "FullColumn.h"

Expand Down
5 changes: 3 additions & 2 deletions OndselSolver/LDUSpMat.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#pragma once

#include "MatrixLDU.h"
Expand All @@ -14,8 +14,9 @@
namespace MbD {
class LDUSpMat : public MatrixLDU
{
//matrixL matrixD matrixU markowitzPivotRowCount markowitzPivotColCount privateIndicesOfNonZerosInPivotRow rowPositionsOfNonZerosInPivotColumn
//matrixL matrixD matrixU markowitzPivotRowCount markowitzPivotColCount privateIndicesOfNonZerosInPivotRow rowPositionsOfNonZerosInPivotColumn
public:
using MatrixSolver::basicSolvewithsaveOriginal;
FColDsptr basicSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr fullCol, bool saveOriginal) override;
void decomposesaveOriginal(FMatDsptr fullMat, bool saveOriginal);
void decomposesaveOriginal(SpMatDsptr spMat, bool saveOriginal);
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/LDUSpMatParPv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#include "LDUSpMatParPv.h"
2 changes: 1 addition & 1 deletion OndselSolver/MatrixDecomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#include "MatrixDecomposition.h"

using namespace MbD;
Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/MatrixDecomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#pragma once

#include "MatrixSolver.h"
Expand All @@ -19,9 +19,9 @@ namespace MbD {
virtual void applyRowOrderOnRightHandSideB();
virtual void forwardSubstituteIntoL();
virtual void backSubstituteIntoU();
virtual FColDsptr basicSolvewithsaveOriginal(FMatDsptr aMatrix, FColDsptr aVector, bool saveOriginal);
FColDsptr basicSolvewithsaveOriginal(FMatDsptr aMatrix, FColDsptr aVector, bool saveOriginal) override;
virtual void forwardSubstituteIntoLD();
virtual void postSolve();
void postSolve() override;
virtual void preSolvesaveOriginal(FMatDsptr aMatrix, bool saveOriginal);

};
Expand Down
6 changes: 4 additions & 2 deletions OndselSolver/MatrixSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/

#pragma once

#include "Solver.h"
Expand All @@ -17,7 +17,7 @@
namespace MbD {
class MatrixSolver : public Solver
{
//m n matrixA answerX rightHandSideB rowOrder colOrder rowScalings pivotValues singularPivotTolerance millisecondsToRun
//m n matrixA answerX rightHandSideB rowOrder colOrder rowScalings pivotValues singularPivotTolerance millisecondsToRun
public:
MatrixSolver(){}
virtual ~MatrixSolver() {}
Expand All @@ -27,8 +27,10 @@ namespace MbD {
virtual FColDsptr solvewithsaveOriginal(FMatDsptr fullMat, FColDsptr fullCol, bool saveOriginal);
virtual FColDsptr timedSolvewithsaveOriginal(FMatDsptr fullMat, FColDsptr fullCol, bool saveOriginal);
virtual FColDsptr timedSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr fullCol, bool saveOriginal);

virtual FColDsptr basicSolvewithsaveOriginal(FMatDsptr fullMat, FColDsptr fullCol, bool saveOriginal) = 0;
virtual FColDsptr basicSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr fullCol, bool saveOriginal) = 0;

virtual void preSolvewithsaveOriginal(FMatDsptr fullMat, FColDsptr fullCol, bool saveOriginal) = 0;
virtual void preSolvewithsaveOriginal(SpMatDsptr spMat, FColDsptr fullCol, bool saveOriginal) = 0;
virtual void doPivoting(size_t p) = 0;
Expand Down
6 changes: 4 additions & 2 deletions OndselSolver/NewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool NewtonRaphson::isConvergedToNumericalLimit()
auto tooLargeTol = 1.0e-2;
constexpr auto smallEnoughTol = std::numeric_limits<double>::epsilon();
auto nDecade = log10(tooLargeTol / smallEnoughTol);
auto nDivergenceMax = 3;
size_t nDivergenceMax = 3;
auto dxNormIterNo = dxNorms->at(iterNo);
if (iterNo > 0) {
auto dxNormIterNoOld = dxNorms->at(iterNo);
Expand All @@ -119,7 +119,9 @@ bool NewtonRaphson::isConvergedToNumericalLimit()
stillConverging = true;
}
else {
if (!farTooLargeError) nDivergence++;
if (!farTooLargeError) {
nDivergence++;
}
stillConverging = nDivergence < nDivergenceMax;
}
return !(farTooLargeError || (worthIterating && stillConverging));
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/PosKineNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PosKineNewtonRaphson::assignEquationNumbers()
// uHolder->iu(varNo);
// varNo += 1;
//}
auto eqnNo = 0;
size_t eqnNo = 0;
for (auto& con : *constraints) {
con->iG = eqnNo;
eqnNo += 1;
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/SparseMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,4 @@ namespace MbD {
this->at(i)->magnifySelf(factor);
}
}
}
}
2 changes: 1 addition & 1 deletion OndselSolver/VelKineSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void VelKineSolver::assignEquationNumbers()
// uHolder->iu(varNo);
// varNo += 1;
//}
auto eqnNo = 0;
size_t eqnNo = 0;
for (auto& con : *constraints) {
con->iG = eqnNo;
eqnNo += 1;
Expand Down

0 comments on commit 64e546f

Please sign in to comment.