Fix various compiler warnings

This commit is contained in:
Pieter Hijma
2024-06-27 20:45:29 +02:00
parent d50532d3e7
commit 2b48cda825
18 changed files with 36 additions and 29 deletions

View File

@@ -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);
@@ -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 {

View File

@@ -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"
@@ -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));

View File

@@ -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))
{
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
@@ -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);
}

View File

@@ -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);
}

View File

@@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "LDUSpMat.h"
#include "FullColumn.h"

View File

@@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "MatrixLDU.h"
@@ -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);

View File

@@ -5,5 +5,5 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "LDUSpMatParPv.h"

View File

@@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "MatrixDecomposition.h"
using namespace MbD;

View File

@@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "MatrixSolver.h"
@@ -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);
};

View File

@@ -5,7 +5,7 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "Solver.h"
@@ -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() {}
@@ -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;

View File

@@ -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);
@@ -119,7 +119,9 @@ bool NewtonRaphson::isConvergedToNumericalLimit()
stillConverging = true;
}
else {
if (!farTooLargeError) nDivergence++;
if (!farTooLargeError) {
nDivergence++;
}
stillConverging = nDivergence < nDivergenceMax;
}
return !(farTooLargeError || (worthIterating && stillConverging));

View File

@@ -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;

View File

@@ -247,4 +247,4 @@ namespace MbD {
this->at(i)->magnifySelf(factor);
}
}
}
}

View File

@@ -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;