From 3952f459457e339a0987ad2b271f3823b67323e7 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Tue, 21 Nov 2023 09:16:25 -0600 Subject: [PATCH] WIP: fixes mac errors and warnings (#34) * fixes mac errors and warnings; check on TODO items * renamed function as override was not of virtual * removed another using * experimental adjustment * move fcDot to public * renaming things --- CMakeLists.txt | 5 +++ OndselSolver/ASMTTime.h | 2 +- OndselSolver/AccNewtonRaphson.cpp | 11 +++--- OndselSolver/AngleZIecJec.cpp | 2 +- OndselSolver/DirectionCosineIecJec.cpp | 41 +++++++++++------------ OndselSolver/DirectionCosineIecJec.h | 7 ++-- OndselSolver/DirectionCosineIeqcJec.cpp | 2 +- OndselSolver/DirectionCosineIeqcJeqc.cpp | 4 +-- OndselSolver/DirectionCosineIeqctJeqc.cpp | 6 ++-- OndselSolver/DispCompIecJecIe.cpp | 2 +- OndselSolver/DispCompIecJecKeqc.cpp | 6 ++-- OndselSolver/DispCompIeqcJecIe.cpp | 6 ++-- OndselSolver/DispCompIeqcJecKeqc.cpp | 6 ++-- OndselSolver/DispCompIeqcJeqcIe.cpp | 4 +-- OndselSolver/DispCompIeqcJeqcKeqc.cpp | 6 ++-- OndselSolver/DispCompIeqcJeqcKeqct.cpp | 8 ++--- OndselSolver/DispCompIeqctJeqcIe.cpp | 11 +++--- OndselSolver/DispCompIeqctJeqcKeqct.cpp | 6 ++-- OndselSolver/DistIeqcJec.cpp | 2 +- OndselSolver/DistIeqcJeqc.cpp | 2 +- OndselSolver/FullColumn.cpp | 18 +--------- OndselSolver/FullColumn.h | 20 +++++++++-- OndselSolver/FullMatrix.cpp | 4 +-- OndselSolver/FullRow.cpp | 15 --------- OndselSolver/LDUFullMat.h | 2 +- OndselSolver/MBDynItem.cpp | 2 +- OndselSolver/MBDynMarker.h | 2 +- OndselSolver/MomentOfInertiaSolver.cpp | 6 ++-- OndselSolver/Numeric.cpp | 8 ++--- OndselSolver/OrbitAngleZIecJec.cpp | 2 +- OndselSolver/PosICNewtonRaphson.cpp | 15 ++++----- OndselSolver/ScrewConstraintIJ.cpp | 4 +-- OndselSolver/ScrewConstraintIqcJc.cpp | 8 ++--- OndselSolver/ScrewConstraintIqcJqc.cpp | 10 +++--- OndselSolver/StableBackwardDifference.cpp | 2 +- OndselSolver/StableBackwardDifference.h | 6 ++-- OndselSolver/SymbolicParser.cpp | 2 +- OndselSolver/SystemNewtonRaphson.cpp | 5 +-- OndselSolver/VectorNewtonRaphson.h | 2 +- OndselSolver/VelSolver.cpp | 5 +-- OndselSolver/corecrt_math_defines.h | 6 ++-- 41 files changed, 137 insertions(+), 146 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c440fb..12e4c98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,7 @@ set(ONDSELSOLVER_SRC OndselSolver/IndependentVariable.cpp OndselSolver/InLineJoint.cpp OndselSolver/InPlaneJoint.cpp + OndselSolver/Integral.cpp OndselSolver/Integrator.cpp OndselSolver/IntegratorInterface.cpp OndselSolver/Item.cpp @@ -220,6 +221,7 @@ set(ONDSELSOLVER_SRC OndselSolver/MBDynBody.cpp OndselSolver/MBDynControlData.cpp OndselSolver/MBDynData.cpp + OndselSolver/MBDynDrive.cpp OndselSolver/MBDynElement.cpp OndselSolver/MBDynInitialValue.cpp OndselSolver/MBDynItem.cpp @@ -244,9 +246,11 @@ set(ONDSELSOLVER_SRC OndselSolver/Part.cpp OndselSolver/PartFrame.cpp OndselSolver/PerpendicularJoint.cpp + OndselSolver/PiecewiseFunction.cpp OndselSolver/PlanarJoint.cpp OndselSolver/PointInLineJoint.cpp OndselSolver/PointInPlaneJoint.cpp + OndselSolver/Polynomial.cpp OndselSolver/PosICKineNewtonRaphson.cpp OndselSolver/PosICNewtonRaphson.cpp OndselSolver/PosKineNewtonRaphson.cpp @@ -260,6 +264,7 @@ set(ONDSELSOLVER_SRC OndselSolver/RackPinConstraintIqcJc.cpp OndselSolver/RackPinConstraintIqcJqc.cpp OndselSolver/RackPinJoint.cpp + OndselSolver/RampStepFunction.cpp OndselSolver/Reciprocal.cpp OndselSolver/RedundantConstraint.cpp OndselSolver/RevCylJoint.cpp diff --git a/OndselSolver/ASMTTime.h b/OndselSolver/ASMTTime.h index f0298ce..667e86e 100644 --- a/OndselSolver/ASMTTime.h +++ b/OndselSolver/ASMTTime.h @@ -18,7 +18,7 @@ namespace MbD { // public: void deleteMbD(); - void createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits); + void createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) override; Symsptr expandUntil(Symsptr sptr, std::shared_ptr> set) override; Symsptr simplifyUntil(Symsptr sptr, std::shared_ptr> set) override; bool isVariable() override; diff --git a/OndselSolver/AccNewtonRaphson.cpp b/OndselSolver/AccNewtonRaphson.cpp index 98d8ed5..90d5dbe 100644 --- a/OndselSolver/AccNewtonRaphson.cpp +++ b/OndselSolver/AccNewtonRaphson.cpp @@ -126,18 +126,17 @@ void AccNewtonRaphson::preRun() void MbD::AccNewtonRaphson::handleSingularMatrix() { - std::string str = typeid(*matrixSolver).name(); + auto& r = *matrixSolver; + std::string str = typeid(r).name(); if (str.find("GESpMatParPvMarkoFast") != std::string::npos) { matrixSolver = CREATE::With(); this->solveEquations(); - } - else { - str = typeid(*matrixSolver).name(); + } else { + str = typeid(r).name(); if (str.find("GESpMatParPvPrecise") != std::string::npos) { this->logSingularMatrixMessage(); matrixSolver->throwSingularMatrixError("AccAccNewtonRaphson"); - } - else { + } else { assert(false); } } diff --git a/OndselSolver/AngleZIecJec.cpp b/OndselSolver/AngleZIecJec.cpp index dbaa8fd..cc66bff 100644 --- a/OndselSolver/AngleZIecJec.cpp +++ b/OndselSolver/AngleZIecJec.cpp @@ -29,7 +29,7 @@ void MbD::AngleZIecJec::calcPostDynCorrectorIteration() auto diffOfSquares = sthez * sthez - (cthez * cthez); auto sumOfSquaresSquared = sumOfSquares * sumOfSquares; auto thez0to2pi = Numeric::arcTan0to2piYoverX(sthez, cthez); - thez = std::round(thez - thez0to2pi / (2.0 * M_PI)) * (2.0 * M_PI) + thez0to2pi; + thez = std::round(thez - thez0to2pi / (2.0 * OS_M_PI)) * (2.0 * OS_M_PI) + thez0to2pi; cosOverSSq = cthez / sumOfSquares; sinOverSSq = sthez / sumOfSquares; twoCosSinOverSSqSq = 2.0 * cthez * sthez / sumOfSquaresSquared; diff --git a/OndselSolver/DirectionCosineIecJec.cpp b/OndselSolver/DirectionCosineIecJec.cpp index 71ff884..b82f874 100644 --- a/OndselSolver/DirectionCosineIecJec.cpp +++ b/OndselSolver/DirectionCosineIecJec.cpp @@ -9,29 +9,28 @@ #include #include "DirectionCosineIecJec.h" -#include "FullColumn.h" #include "EndFramec.h" -using namespace MbD; +namespace MbD { + DirectionCosineIecJec::DirectionCosineIecJec() + = default; -DirectionCosineIecJec::DirectionCosineIecJec() -{ + DirectionCosineIecJec::DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) : + KinematicIeJe(frmi, frmj), axisI(axisi), axisJ(axisj) + { + + } + + void DirectionCosineIecJec::calcPostDynCorrectorIteration() + { + aAjOIe = frmI->aAjOe(axisI); + aAjOJe = frmJ->aAjOe(axisJ); + aAijIeJe = aAjOIe->dotVec(aAjOJe); + } + + double MbD::DirectionCosineIecJec::value() + { + return aAijIeJe; + } } -DirectionCosineIecJec::DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) : - KinematicIeJe(frmi, frmj), axisI(axisi), axisJ(axisj) -{ - -} - -void DirectionCosineIecJec::calcPostDynCorrectorIteration() -{ - aAjOIe = frmI->aAjOe(axisI); - aAjOJe = frmJ->aAjOe(axisJ); - aAijIeJe = aAjOIe->dot(aAjOJe); -} - -double MbD::DirectionCosineIecJec::value() -{ - return aAijIeJe; -} diff --git a/OndselSolver/DirectionCosineIecJec.h b/OndselSolver/DirectionCosineIecJec.h index aa2b067..1bf0257 100644 --- a/OndselSolver/DirectionCosineIecJec.h +++ b/OndselSolver/DirectionCosineIecJec.h @@ -10,11 +10,10 @@ #include +#include "FullColumn.h" #include "KinematicIeJe.h" namespace MbD { - template - class FullColumn; class DirectionCosineIecJec : public KinematicIeJe { @@ -26,8 +25,8 @@ namespace MbD { void calcPostDynCorrectorIteration() override; double value() override; - int axisI, axisJ; //0, 1, 2 = x, y, z - double aAijIeJe; + int axisI{}, axisJ{}; //0, 1, 2 = x, y, z + double aAijIeJe{}; FColDsptr aAjOIe, aAjOJe; }; } diff --git a/OndselSolver/DirectionCosineIeqcJec.cpp b/OndselSolver/DirectionCosineIeqcJec.cpp index eb64f73..80f438a 100644 --- a/OndselSolver/DirectionCosineIeqcJec.cpp +++ b/OndselSolver/DirectionCosineIeqcJec.cpp @@ -56,7 +56,7 @@ void DirectionCosineIeqcJec::calcPostDynCorrectorIteration() auto& ppAjOIepEIipEI = ppAjOIepEIpEI->at(i); for (int j = 0; j < 4; j++) { - ppAijIeJepEIipEI->at(j) = ppAjOIepEIipEI->at(j)->dot(aAjOJe); + ppAijIeJepEIipEI->at(j) = ppAjOIepEIipEI->at(j)->dotVec(aAjOJe); } } ppAijIeJepEIpEI->symLowerWithUpper(); diff --git a/OndselSolver/DirectionCosineIeqcJeqc.cpp b/OndselSolver/DirectionCosineIeqcJeqc.cpp index e01444f..e449642 100644 --- a/OndselSolver/DirectionCosineIeqcJeqc.cpp +++ b/OndselSolver/DirectionCosineIeqcJeqc.cpp @@ -45,7 +45,7 @@ void DirectionCosineIeqcJeqc::calcPostDynCorrectorIteration() pAjOJepEJT = std::static_pointer_cast(frmJ)->pAjOepET(axisJ); for (int i = 0; i < 4; i++) { - pAijIeJepEJ->at(i) = aAjOIe->dot(pAjOJepEJT->at(i)); + pAijIeJepEJ->at(i) = aAjOIe->dotVec(pAjOJepEJT->at(i)); } for (int i = 0; i < 4; i++) { @@ -61,7 +61,7 @@ void DirectionCosineIeqcJeqc::calcPostDynCorrectorIteration() auto& ppAjOJepEJipEJ = ppAjOJepEJpEJ->at(i); for (int j = 0; j < 4; j++) { - ppAijIeJepEJipEJ->at(j) = aAjOIe->dot(ppAjOJepEJipEJ->at(j)); + ppAijIeJepEJipEJ->at(j) = aAjOIe->dotVec(ppAjOJepEJipEJ->at(j)); } } ppAijIeJepEJpEJ->symLowerWithUpper(); diff --git a/OndselSolver/DirectionCosineIeqctJeqc.cpp b/OndselSolver/DirectionCosineIeqctJeqc.cpp index 6fb505c..5790b55 100644 --- a/OndselSolver/DirectionCosineIeqctJeqc.cpp +++ b/OndselSolver/DirectionCosineIeqctJeqc.cpp @@ -60,7 +60,7 @@ void DirectionCosineIeqctJeqc::preVelIC() { Item::preVelIC(); auto pAjOIept = std::static_pointer_cast(frmI)->pAjOept(axisI); - pAijIeJept = pAjOIept->dot(aAjOJe); + pAijIeJept = pAjOIept->dotVec(aAjOJe); } double DirectionCosineIeqctJeqc::pvaluept() @@ -82,7 +82,7 @@ void DirectionCosineIeqctJeqc::preAccIC() } for (int i = 0; i < 4; i++) { - ppAijIeJepEJpt->atiput(i, pAjOIept->dot(pAjOJepEJT->at(i))); + ppAijIeJepEJpt->atiput(i, pAjOIept->dotVec(pAjOJepEJT->at(i))); } - ppAijIeJeptpt = ppAjOIeptpt->dot(aAjOJe); + ppAijIeJeptpt = ppAjOIeptpt->dotVec(aAjOJe); } diff --git a/OndselSolver/DispCompIecJecIe.cpp b/OndselSolver/DispCompIecJecIe.cpp index 213a0ff..515a6fa 100644 --- a/OndselSolver/DispCompIecJecIe.cpp +++ b/OndselSolver/DispCompIecJecIe.cpp @@ -23,7 +23,7 @@ void MbD::DispCompIecJecIe::calc_value() { aAjOIe = frmI->aAjOe(axis); rIeJeO = frmJ->rOeO->minusFullColumn(frmI->rOeO); - riIeJeIe = aAjOIe->dot(rIeJeO); + riIeJeIe = aAjOIe->dotVec(rIeJeO); } void MbD::DispCompIecJecIe::calcPostDynCorrectorIteration() diff --git a/OndselSolver/DispCompIecJecKeqc.cpp b/OndselSolver/DispCompIecJecKeqc.cpp index b423512..7584dc6 100644 --- a/OndselSolver/DispCompIecJecKeqc.cpp +++ b/OndselSolver/DispCompIecJecKeqc.cpp @@ -37,7 +37,7 @@ void DispCompIecJecKeqc::calcPostDynCorrectorIteration() auto efrmKqc = std::static_pointer_cast(efrmK); aAjOKe = efrmKqc->aAjOe(axisK); rIeJeO = frmJqc->rOeO->minusFullColumn(frmIqc->rOeO); - riIeJeKe = aAjOKe->dot(rIeJeO); + riIeJeKe = aAjOKe->dotVec(rIeJeO); pAjOKepEKT = efrmKqc->pAjOepET(axisK); ppAjOKepEKpEK = efrmKqc->ppAjOepEpE(axisK); for (int i = 0; i < 4; i++) @@ -45,10 +45,10 @@ void DispCompIecJecKeqc::calcPostDynCorrectorIteration() priIeJeKepEK->at(i) = ((pAjOKepEKT->at(i))->dot(rIeJeO)); auto& ppAjOKepEKipEK = ppAjOKepEKpEK->at(i); auto& ppriIeJeKepEKipEK = ppriIeJeKepEKpEK->at(i); - ppriIeJeKepEKipEK->at(i) = ((ppAjOKepEKipEK->at(i))->dot(rIeJeO)); + ppriIeJeKepEKipEK->at(i) = ((ppAjOKepEKipEK->at(i))->dotVec(rIeJeO)); for (int j = i + 1; j < 4; j++) { - auto ppriIeJeKepEKipEKj = (ppAjOKepEKipEK->at(i))->dot(rIeJeO); + auto ppriIeJeKepEKipEKj = (ppAjOKepEKipEK->at(i))->dotVec(rIeJeO); ppriIeJeKepEKipEK->at(j) = ppriIeJeKepEKipEKj; ppriIeJeKepEKpEK->at(j)->at(i) = ppriIeJeKepEKipEKj; } diff --git a/OndselSolver/DispCompIeqcJecIe.cpp b/OndselSolver/DispCompIeqcJecIe.cpp index 4706787..a30a40e 100644 --- a/OndselSolver/DispCompIeqcJecIe.cpp +++ b/OndselSolver/DispCompIeqcJecIe.cpp @@ -31,10 +31,10 @@ void MbD::DispCompIeqcJecIe::calc_ppvaluepEIpEI() auto ppriIeJeIepEIipEI = ppriIeJeIepEIpEI->at(i); for (int j = i; j < 4; j++) { - auto term1 = ppAjOIepEIipEI->at(j)->dot(rIeJeO); + auto term1 = ppAjOIepEIipEI->at(j)->dotVec(rIeJeO); auto mterm2 = pAjOIepEIT->at(i)->dot(mprIeJeOpEIT->at(j)); auto mterm3 = (i == j) ? mterm2 : pAjOIepEIT->at(j)->dot(mprIeJeOpEIT->at(i)); - auto mterm4 = aAjOIe->dot(mpprIeJeOpEIipEI->at(j)); + auto mterm4 = aAjOIe->dotVec(mpprIeJeOpEIipEI->at(j)); ppriIeJeIepEIipEI->atiput(j, term1 - mterm2 - mterm3 - mterm4); } } @@ -60,7 +60,7 @@ void MbD::DispCompIeqcJecIe::calc_pvaluepEI() auto mprIeJeOpEIT = frmIeqc->prOeOpE->transpose(); for (int i = 0; i < 4; i++) { - priIeJeIepEI->atiput(i, pAjOIepEIT->at(i)->dot(rIeJeO) - aAjOIe->dot(mprIeJeOpEIT->at(i))); + priIeJeIepEI->atiput(i, pAjOIepEIT->at(i)->dot(rIeJeO) - aAjOIe->dotVec(mprIeJeOpEIT->at(i))); } } diff --git a/OndselSolver/DispCompIeqcJecKeqc.cpp b/OndselSolver/DispCompIeqcJecKeqc.cpp index 5d6c96f..b83fd54 100644 --- a/OndselSolver/DispCompIeqcJecKeqc.cpp +++ b/OndselSolver/DispCompIeqcJecKeqc.cpp @@ -41,7 +41,7 @@ void DispCompIeqcJecKeqc::calcPostDynCorrectorIteration() } for (int i = 0; i < 4; i++) { - priIeJeKepEI->at(i) = 0.0 - (aAjOKe->dot(mprIeJeOpEIT->at(i))); + priIeJeKepEI->at(i) = 0.0 - (aAjOKe->dotVec(mprIeJeOpEIT->at(i))); } for (int i = 0; i < 3; i++) { @@ -55,10 +55,10 @@ void DispCompIeqcJecKeqc::calcPostDynCorrectorIteration() { auto& mpprIeJeOpEIipEI = mpprIeJeOpEIpEI->at(i); auto& ppriIeJeKepEIipEI = ppriIeJeKepEIpEI->at(i); - ppriIeJeKepEIipEI->at(i) = 0.0 - (aAjOKe->dot(mpprIeJeOpEIipEI->at(i))); + ppriIeJeKepEIipEI->at(i) = 0.0 - (aAjOKe->dotVec(mpprIeJeOpEIipEI->at(i))); for (int j = 0; j < 4; j++) { - auto ppriIeJeKepEIipEIj = 0.0 - (aAjOKe->dot(mpprIeJeOpEIipEI->at(j))); + auto ppriIeJeKepEIipEIj = 0.0 - (aAjOKe->dotVec(mpprIeJeOpEIipEI->at(j))); ppriIeJeKepEIipEI->at(j) = ppriIeJeKepEIipEIj; ppriIeJeKepEIpEI->at(j)->at(i) = ppriIeJeKepEIipEIj; } diff --git a/OndselSolver/DispCompIeqcJeqcIe.cpp b/OndselSolver/DispCompIeqcJeqcIe.cpp index e02461f..09b542c 100644 --- a/OndselSolver/DispCompIeqcJeqcIe.cpp +++ b/OndselSolver/DispCompIeqcJeqcIe.cpp @@ -41,7 +41,7 @@ void MbD::DispCompIeqcJeqcIe::calc_ppvaluepEJpEJ() auto ppriIeJeIepEJipEJ = ppriIeJeIepEJpEJ->at(i); for (int j = i; j < 4; j++) { - auto term1 = aAjOIe->dot(pprIeJeOpEJipEJ->at(j)); + auto term1 = aAjOIe->dotVec(pprIeJeOpEJipEJ->at(j)); ppriIeJeIepEJipEJ->atiput(j, term1); } } @@ -54,7 +54,7 @@ void MbD::DispCompIeqcJeqcIe::calc_pvaluepEJ() auto prIeJeOpEJT = frmJeqc->prOeOpE->transpose(); for (int i = 0; i < 4; i++) { - priIeJeIepEJ->atiput(i, aAjOIe->dot(prIeJeOpEJT->at(i))); + priIeJeIepEJ->atiput(i, aAjOIe->dotVec(prIeJeOpEJT->at(i))); } } diff --git a/OndselSolver/DispCompIeqcJeqcKeqc.cpp b/OndselSolver/DispCompIeqcJeqcKeqc.cpp index 554585b..72210be 100644 --- a/OndselSolver/DispCompIeqcJeqcKeqc.cpp +++ b/OndselSolver/DispCompIeqcJeqcKeqc.cpp @@ -41,7 +41,7 @@ void DispCompIeqcJeqcKeqc::calcPostDynCorrectorIteration() } for (int i = 0; i < 4; i++) { - priIeJeKepEJ->atiput(i, aAjOKe->dot(prIeJeOpEJT->at(i))); + priIeJeKepEJ->atiput(i, aAjOKe->dotVec(prIeJeOpEJT->at(i))); } for (int i = 0; i < 3; i++) { @@ -55,10 +55,10 @@ void DispCompIeqcJeqcKeqc::calcPostDynCorrectorIteration() { auto& pprIeJeOpEJipEJ = pprIeJeOpEJpEJ->at(i); auto& ppriIeJeKepEJipEJ = ppriIeJeKepEJpEJ->at(i); - ppriIeJeKepEJipEJ->atiput(i, aAjOKe->dot(pprIeJeOpEJipEJ->at(i))); + ppriIeJeKepEJipEJ->atiput(i, aAjOKe->dotVec(pprIeJeOpEJipEJ->at(i))); for (int j = 0; j < 4; j++) { - auto ppriIeJeKepEJipEJj = (aAjOKe->dot(pprIeJeOpEJipEJ->at(j))); + auto ppriIeJeKepEJipEJj = (aAjOKe->dotVec(pprIeJeOpEJipEJ->at(j))); ppriIeJeKepEJipEJ->atiput(j, ppriIeJeKepEJipEJj); ppriIeJeKepEJpEJ->atijput(j, i, ppriIeJeKepEJipEJj); } diff --git a/OndselSolver/DispCompIeqcJeqcKeqct.cpp b/OndselSolver/DispCompIeqcJeqcKeqct.cpp index 0820af1..3a1b31a 100644 --- a/OndselSolver/DispCompIeqcJeqcKeqct.cpp +++ b/OndselSolver/DispCompIeqcJeqcKeqct.cpp @@ -47,7 +47,7 @@ void DispCompIeqcJeqcKeqct::preVelIC() { Item::preVelIC(); auto pAjOKept = std::static_pointer_cast(efrmK)->pAjOept(axisK); - priIeJeKept = pAjOKept->dot(rIeJeO); + priIeJeKept = pAjOKept->dotVec(rIeJeO); } double DispCompIeqcJeqcKeqct::pvaluept() @@ -100,9 +100,9 @@ void DispCompIeqcJeqcKeqct::preAccIC() } for (int i = 0; i < 4; i++) { - ppriIeJeKepEIpt->atiput(i, pAjOKept->dot(prIeJeOpEIT->at(i))); - ppriIeJeKepEJpt->atiput(i, pAjOKept->dot(prIeJeOpEJT->at(i))); + ppriIeJeKepEIpt->atiput(i, pAjOKept->dotVec(prIeJeOpEIT->at(i))); + ppriIeJeKepEJpt->atiput(i, pAjOKept->dotVec(prIeJeOpEJT->at(i))); ppriIeJeKepEKpt->atiput(i, ppAjOKepEKTpt->at(i)->dot(rIeJeO)); } - ppriIeJeKeptpt = ppAjOKeptpt->dot(rIeJeO); + ppriIeJeKeptpt = ppAjOKeptpt->dotVec(rIeJeO); } diff --git a/OndselSolver/DispCompIeqctJeqcIe.cpp b/OndselSolver/DispCompIeqctJeqcIe.cpp index 4eca3de..f7993a5 100644 --- a/OndselSolver/DispCompIeqctJeqcIe.cpp +++ b/OndselSolver/DispCompIeqctJeqcIe.cpp @@ -33,7 +33,9 @@ void MbD::DispCompIeqctJeqcIe::calc_ppvaluepEIpt() auto pAjOIepEITi = pAjOIepEIT->at(i); auto mprIeJeOpEITi = mprIeJeOpEIT->at(i); auto mpprIeJeOpEITpti = mpprIeJeOpEITpt->at(i); - auto ppriIeJeIepEIpti = ppAjOIepEITpti->dot(rIeJeO) - pAjOIepEITi->dot(mprIeJeOpt) - pAjOIept->dot(mprIeJeOpEITi) - aAjOIe->dot(mpprIeJeOpEITpti); + auto ppriIeJeIepEIpti = ppAjOIepEITpti->dot(rIeJeO) - pAjOIepEITi->dot(mprIeJeOpt) - + pAjOIept->dotVec(mprIeJeOpEITi) - + aAjOIe->dotVec(mpprIeJeOpEITpti); ppriIeJeIepEIpt->atiput(i, ppriIeJeIepEIpti); } } @@ -46,7 +48,7 @@ void MbD::DispCompIeqctJeqcIe::calc_ppvaluepEJpt() auto prIeJeOpEJT = frmJeqct->prOeOpE->transpose(); for (int i = 0; i < 4; i++) { - ppriIeJeIepEJpt->atiput(i, pAjOIept->dot(prIeJeOpEJT->at(i))); + ppriIeJeIepEJpt->atiput(i, pAjOIept->dotVec(prIeJeOpEJT->at(i))); } } @@ -57,7 +59,8 @@ void MbD::DispCompIeqctJeqcIe::calc_ppvalueptpt() auto ppAjOIeptpt = frmIeqct->ppAjOeptpt(axis); auto mprIeJeOpt = frmIeqct->prOeOpt; auto mpprIeJeOptpt = frmIeqct->pprOeOptpt; - ppriIeJeIeptpt = ppAjOIeptpt->dot(rIeJeO) - pAjOIept->dot(mprIeJeOpt) - pAjOIept->dot(mprIeJeOpt) - aAjOIe->dot(mpprIeJeOptpt); + ppriIeJeIeptpt = ppAjOIeptpt->dotVec(rIeJeO) - pAjOIept->dotVec(mprIeJeOpt) - pAjOIept->dotVec(mprIeJeOpt) - + aAjOIe->dotVec(mpprIeJeOptpt); } void MbD::DispCompIeqctJeqcIe::calc_ppvaluepXIpt() @@ -85,7 +88,7 @@ void MbD::DispCompIeqctJeqcIe::calc_pvaluept() auto frmIeqct = std::static_pointer_cast(frmI); auto pAjOIept = frmIeqct->pAjOept(axis); auto mprIeJeOpt = frmIeqct->prOeOpt; - priIeJeIept = pAjOIept->dot(rIeJeO) - aAjOIe->dot(mprIeJeOpt); + priIeJeIept = pAjOIept->dotVec(rIeJeO) - aAjOIe->dotVec(mprIeJeOpt); } void MbD::DispCompIeqctJeqcIe::calcPostDynCorrectorIteration() diff --git a/OndselSolver/DispCompIeqctJeqcKeqct.cpp b/OndselSolver/DispCompIeqctJeqcKeqct.cpp index 6546987..e3013e6 100644 --- a/OndselSolver/DispCompIeqctJeqcKeqct.cpp +++ b/OndselSolver/DispCompIeqctJeqcKeqct.cpp @@ -23,7 +23,7 @@ void DispCompIeqctJeqcKeqct::preVelIC() { DispCompIeqcJeqcKeqct::preVelIC(); auto& mprIeJeOpt = std::static_pointer_cast(frmI)->prOeOpt; - priIeJeKept -= aAjOKe->dot(mprIeJeOpt); + priIeJeKept -= aAjOKe->dotVec(mprIeJeOpt); } void DispCompIeqctJeqcKeqct::preAccIC() @@ -36,8 +36,8 @@ void DispCompIeqctJeqcKeqct::preAccIC() auto& mpprIeJeOptpt = efrmIqct->pprOeOptpt; for (int i = 0; i < 4; i++) { - ppriIeJeKepEIpt->atiminusNumber(i, aAjOKe->dot(mpprIeJeOpEITpt->at(i))); + ppriIeJeKepEIpt->atiminusNumber(i, aAjOKe->dotVec(mpprIeJeOpEITpt->at(i))); ppriIeJeKepEKpt->atiminusNumber(i, pAjOKepEKT->at(i)->dot(mprIeJeOpt)); } - ppriIeJeKeptpt += -(2.0 * pAjOKept->dot(mprIeJeOpt)) - aAjOKe->dot(mpprIeJeOptpt); + ppriIeJeKeptpt += -(2.0 * pAjOKept->dotVec(mprIeJeOpt)) - aAjOKe->dotVec(mpprIeJeOptpt); } diff --git a/OndselSolver/DistIeqcJec.cpp b/OndselSolver/DistIeqcJec.cpp index d53f49c..282b52f 100644 --- a/OndselSolver/DistIeqcJec.cpp +++ b/OndselSolver/DistIeqcJec.cpp @@ -63,7 +63,7 @@ void MbD::DistIeqcJec::calcPrivate() for (int j = 0; j < 4; j++) { auto element = mprIeJeOpEIiT->dot(mprIeJeOpEIT->at(j)) - - mpprIeJeOpEIipEI->at(j)->dot(rIeJeO) - prIeJepEIi * prIeJepEI->at(j); + - mpprIeJeOpEIipEI->at(j)->dotVec(rIeJeO) - prIeJepEIi * prIeJepEI->at(j); pprIeJepEIipEI->atiput(j, element / rIeJe); } } diff --git a/OndselSolver/DistIeqcJeqc.cpp b/OndselSolver/DistIeqcJeqc.cpp index f8e565f..d7fdb1c 100644 --- a/OndselSolver/DistIeqcJeqc.cpp +++ b/OndselSolver/DistIeqcJeqc.cpp @@ -111,7 +111,7 @@ void MbD::DistIeqcJeqc::calcPrivate() for (int j = 0; j < 4; j++) { auto element = prIeJeOpEJiT->dot(prIeJeOpEJT->at(j)) - + pprIeJeOpEJipEJ->at(j)->dot(rIeJeO) - prIeJepEJi * prIeJepEJ->at(j); + + pprIeJeOpEJipEJ->at(j)->dotVec(rIeJeO) - prIeJepEJi * prIeJepEJ->at(j); pprIeJepEJipEJ->atiput(j, element / rIeJe); } } diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index 9e760e4..d8747dd 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -126,7 +126,7 @@ namespace MbD { template T FullColumn::transposeTimesFullColumn(const FColsptr fullCol) { - return this->dot(fullCol); + return this->dotVec(fullCol); } template void FullColumn::equalSelfPlusFullColumntimes(FColsptr fullCol, T factor) @@ -170,16 +170,6 @@ namespace MbD { template class FullColumn; template class FullColumn; template - double FullColumn::dot(std::shared_ptr> vec) - { - int n = (int)this->size(); - double answer = 0.0; - for (int i = 0; i < n; i++) { - answer += this->at(i) * vec->at(i); - } - return answer; - } - template std::shared_ptr> FullColumn::dot(std::shared_ptr>>> vecvec) { int ncol = (int)this->size(); @@ -195,10 +185,4 @@ namespace MbD { } return answer; } - template - std::shared_ptr> FullColumn::clonesptr() - { - return std::make_shared>(*this); - } - } \ No newline at end of file diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 70b6fd1..509c6fa 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -47,8 +47,8 @@ namespace MbD { void equalSelfPlusFullColumntimes(FColsptr fullCol, T factor); FColsptr cross(FColsptr fullCol); FColsptr simplified(); - std::shared_ptr> clonesptr(); - double dot(std::shared_ptr> vec); + std::shared_ptr> cloneFcSptr(); + double dotVec(std::shared_ptr> vec); std::shared_ptr> dot(std::shared_ptr>>> vecvec); std::ostream& printOn(std::ostream& s) const override; @@ -66,4 +66,20 @@ namespace MbD { s << "}"; return s; } + template + std::shared_ptr> FullColumn::cloneFcSptr() + { + return std::make_shared>(*this); + } + template + double FullColumn::dotVec(std::shared_ptr> vec) + { + int n = (int)this->size(); + double answer = 0.0; + for (int i = 0; i < n; i++) { + answer += this->at(i) * vec->at(i); + } + return answer; + } + } diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 978b71b..b12d2ba 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -602,12 +602,12 @@ namespace MbD { if (std::abs(sthe1y) > 0.9999) { if (sthe1y > 0.0) { the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); - the1y = M_PI / 2.0; + the1y = OS_M_PI / 2.0; the2z = 0.0; } else { the0x = std::atan2(this->at(2)->at(1), this->at(2)->at(0)); - the1y = M_PI / -2.0; + the1y = OS_M_PI / -2.0; the2z = 0.0; } } diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index 1c8a877..a50f787 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -47,21 +47,6 @@ namespace MbD { return answer; } -// TODO: can't get the following to work, but CLion says the routine that calls it in FullMatrixFullMatrixDouble is also -// never called. -// template<> -// FRowsptr> FullRow>::timesTransposeFullMatrixForFMFMDsptr( -// std::shared_ptr fullMat) -// { -// //"a*bT = a(1,j)b(k,j)" -// int ncol = fullMat->nrow(); -// auto answer = std::make_shared>>(ncol); -// for (int k = 0; k < ncol; k++) { -// answer->at(k) = this->dot(fullMat->at(k)); -// } -// return answer; -// } - template<> FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) { diff --git a/OndselSolver/LDUFullMat.h b/OndselSolver/LDUFullMat.h index e5d7298..5a75d9e 100644 --- a/OndselSolver/LDUFullMat.h +++ b/OndselSolver/LDUFullMat.h @@ -22,7 +22,7 @@ namespace MbD { void forwardEliminateWithPivot(int p) override; void postSolve() override; - void preSolvesaveOriginal(FMatDsptr fullMat, bool saveOriginal); + void preSolvesaveOriginal(FMatDsptr fullMat, bool saveOriginal) override; void decomposesaveOriginal(SpMatDsptr spMat, bool saveOriginal); void decomposesaveOriginal(FMatDsptr fullMat, bool saveOriginal); FMatDsptr inversesaveOriginal(FMatDsptr fullMat, bool saveOriginal); diff --git a/OndselSolver/MBDynItem.cpp b/OndselSolver/MBDynItem.cpp index 401dd5a..89f1c55 100644 --- a/OndselSolver/MBDynItem.cpp +++ b/OndselSolver/MBDynItem.cpp @@ -65,7 +65,7 @@ std::vector MbD::MBDynItem::collectArgumentsFor(std::string title, //Need to find matching '"' auto it = std::find_if(arguments.begin() + 1, arguments.end(), [](const std::string& s) { auto nn = std::count(s.begin(), s.end(), '"'); - if ((nn % 2) == 1) return true; + return ((nn % 2) == 1); }); std::vector needToCombineArgs(arguments.begin(), it + 1); arguments.erase(arguments.begin(), it + 1); diff --git a/OndselSolver/MBDynMarker.h b/OndselSolver/MBDynMarker.h index 34dbf85..307ca16 100644 --- a/OndselSolver/MBDynMarker.h +++ b/OndselSolver/MBDynMarker.h @@ -14,7 +14,7 @@ namespace MbD { class MBDynMarker : public MBDynItem { public: - void parseMBDyn(std::vector& args); + void parseMBDyn(std::vector& args) override; void parseMBDynClamp(std::vector& args); void createASMT() override; diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index 6a6e43e..81dc8aa 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -15,7 +15,7 @@ void MbD::MomentOfInertiaSolver::example1() auto rpPp = std::make_shared>(ListD{ 0, 0, 1 }); auto rotAxis = std::make_shared>(ListD{ 0, 0, 1 }); - auto aApP = std::make_shared>(rotAxis, M_PI*10/180)->aA; + auto aApP = std::make_shared>(rotAxis, OS_M_PI * 10 / 180)->aA; auto solver = std::make_shared(); solver->setm(4.0); solver->setJPP(aJpp); @@ -350,7 +350,7 @@ void MbD::MomentOfInertiaSolver::calcJppFromFullJcmP() auto q = (c + (2.0 * aDiv3 * aDiv3 * aDiv3) - (aDiv3 * b)) / 2.0; auto phiDiv3 = modifiedArcCos(-q / std::sqrt(-p * p * p)) / 3.0; auto twoSqrtMinusp = 2.0 * std::sqrt(-p); - auto piDiv3 = M_PI / 3.0; + auto piDiv3 = OS_M_PI / 3.0; auto sortedJ = std::make_shared(); sortedJ->push_back(twoSqrtMinusp * std::cos(phiDiv3)); sortedJ->push_back(twoSqrtMinusp * -std::cos(phiDiv3 + piDiv3)); @@ -392,7 +392,7 @@ double MbD::MomentOfInertiaSolver::modifiedArcCos(double val) } else { if (val < -1.0) { - return M_PI; + return OS_M_PI; } else { return std::acos(val); diff --git a/OndselSolver/Numeric.cpp b/OndselSolver/Numeric.cpp index b1fc9a2..08e8175 100644 --- a/OndselSolver/Numeric.cpp +++ b/OndselSolver/Numeric.cpp @@ -26,22 +26,22 @@ double MbD::Numeric::arcTan0to2piYoverX(double y, double x) } else { //"Forth quadrant." - return 2.0 * M_PI + std::atan2(y, x); + return 2.0 * OS_M_PI + std::atan2(y, x); } } else { if (x < 0.0) { //"Second and Third quadrants." - return M_PI + std::atan2(y, x); + return OS_M_PI + std::atan2(y, x); } else { //"x = 0" if (y > 0.0) { - return M_PI / 2.0; + return OS_M_PI / 2.0; } else { if (y < 0.0) { - return 1.5 * M_PI; + return 1.5 * OS_M_PI; } else { throw std::invalid_argument("atan2(0, 0) is not defined."); diff --git a/OndselSolver/OrbitAngleZIecJec.cpp b/OndselSolver/OrbitAngleZIecJec.cpp index 7395dfa..398563e 100644 --- a/OndselSolver/OrbitAngleZIecJec.cpp +++ b/OndselSolver/OrbitAngleZIecJec.cpp @@ -29,7 +29,7 @@ void MbD::OrbitAngleZIecJec::calcPostDynCorrectorIteration() auto diffOfSquares = y * y - (x * x); auto sumOfSquaresSquared = sumOfSquares * sumOfSquares; auto thez0to2pi = Numeric::arcTan0to2piYoverX(y, x); - thez = std::round((thez - thez0to2pi) / (2.0 * M_PI)) * (2.0 * M_PI) + thez0to2pi; + thez = std::round((thez - thez0to2pi) / (2.0 * OS_M_PI)) * (2.0 * OS_M_PI) + thez0to2pi; auto cosOverSSq = x / sumOfSquares; auto sinOverSSq = y / sumOfSquares; twoCosSinOverSSqSq = 2.0 * x * y / sumOfSquaresSquared; diff --git a/OndselSolver/PosICNewtonRaphson.cpp b/OndselSolver/PosICNewtonRaphson.cpp index 0c84dfc..aa7ea1a 100644 --- a/OndselSolver/PosICNewtonRaphson.cpp +++ b/OndselSolver/PosICNewtonRaphson.cpp @@ -102,18 +102,17 @@ void PosICNewtonRaphson::handleSingularMatrix() matrixSolver = this->matrixSolverClassNew(); } else { - std::string str = typeid(*matrixSolver).name(); + auto& r = *matrixSolver; + std::string str = typeid(r).name(); if (str.find("GESpMatParPvMarkoFast") != std::string::npos) { - matrixSolver = CREATE::With(); - this->solveEquations(); - } - else { - str = typeid(*matrixSolver).name(); + matrixSolver = CREATE::With(); + this->solveEquations(); + } else { + str = typeid(r).name(); if (str.find("GESpMatParPvPrecise") != std::string::npos) { this->lookForRedundantConstraints(); matrixSolver = this->matrixSolverClassNew(); - } - else { + } else { assert(false); } } diff --git a/OndselSolver/ScrewConstraintIJ.cpp b/OndselSolver/ScrewConstraintIJ.cpp index cbfd4e7..391cd76 100644 --- a/OndselSolver/ScrewConstraintIJ.cpp +++ b/OndselSolver/ScrewConstraintIJ.cpp @@ -20,7 +20,7 @@ void MbD::ScrewConstraintIJ::calcPostDynCorrectorIteration() { auto z = zIeJeIe->value(); auto thez = thezIeJe->value(); - aG = (2.0 * M_PI * z) - (pitch * thez) - aConstant; + aG = (2.0 * OS_M_PI * z) - (pitch * thez) - aConstant; } void MbD::ScrewConstraintIJ::init_zthez() @@ -50,7 +50,7 @@ void MbD::ScrewConstraintIJ::postInput() { zIeJeIe->postInput(); thezIeJe->postInput(); - aConstant = (2.0 * M_PI * zIeJeIe->value()) - (thezIeJe->value() * pitch); + aConstant = (2.0 * OS_M_PI * zIeJeIe->value()) - (thezIeJe->value() * pitch); ConstraintIJ::postInput(); } diff --git a/OndselSolver/ScrewConstraintIqcJc.cpp b/OndselSolver/ScrewConstraintIqcJc.cpp index 7cb3a1d..0a2a04c 100644 --- a/OndselSolver/ScrewConstraintIqcJc.cpp +++ b/OndselSolver/ScrewConstraintIqcJc.cpp @@ -45,23 +45,23 @@ void MbD::ScrewConstraintIqcJc::addToJointTorqueI(FColDsptr jointTorque) void MbD::ScrewConstraintIqcJc::calc_pGpEI() { - pGpEI = zIeJeIe->pvaluepEI()->times(2.0 * M_PI)->minusFullRow(thezIeJe->pvaluepEI()->times(pitch)); + pGpEI = zIeJeIe->pvaluepEI()->times(2.0 * OS_M_PI)->minusFullRow(thezIeJe->pvaluepEI()->times(pitch)); } void MbD::ScrewConstraintIqcJc::calc_pGpXI() { - pGpXI = zIeJeIe->pvaluepXI()->times(2.0 * M_PI)->minusFullRow(thezIeJe->pvaluepXI()->times(pitch)); + pGpXI = zIeJeIe->pvaluepXI()->times(2.0 * OS_M_PI)->minusFullRow(thezIeJe->pvaluepXI()->times(pitch)); } void MbD::ScrewConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI) + ppGpEIpEI = zIeJeIe->ppvaluepEIpEI()->times(2.0 * OS_M_PI) ->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch)); } void MbD::ScrewConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI) + ppGpXIpEI = zIeJeIe->ppvaluepXIpEI()->times(2.0 * OS_M_PI) ->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch)); } diff --git a/OndselSolver/ScrewConstraintIqcJqc.cpp b/OndselSolver/ScrewConstraintIqcJqc.cpp index c56c15d..c3d6956 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.cpp +++ b/OndselSolver/ScrewConstraintIqcJqc.cpp @@ -22,29 +22,29 @@ MbD::ScrewConstraintIqcJqc::ScrewConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr fr void MbD::ScrewConstraintIqcJqc::calc_pGpEJ() { - pGpEJ = zIeJeIe->pvaluepEJ()->times(2.0 * M_PI)->minusFullRow(thezIeJe->pvaluepEJ()->times(pitch)); + pGpEJ = zIeJeIe->pvaluepEJ()->times(2.0 * OS_M_PI)->minusFullRow(thezIeJe->pvaluepEJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_pGpXJ() { - pGpXJ = zIeJeIe->pvaluepXJ()->times(2.0 * M_PI)->minusFullRow(thezIeJe->pvaluepXJ()->times(pitch)); + pGpXJ = zIeJeIe->pvaluepXJ()->times(2.0 * OS_M_PI)->minusFullRow(thezIeJe->pvaluepXJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI) + ppGpEIpEJ = zIeJeIe->ppvaluepEIpEJ()->times(2.0 * OS_M_PI) ->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI) + ppGpEIpXJ = zIeJeIe->ppvaluepEIpXJ()->times(2.0 * OS_M_PI) ->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI) + ppGpEJpEJ = zIeJeIe->ppvaluepEJpEJ()->times(2.0 * OS_M_PI) ->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch)); } diff --git a/OndselSolver/StableBackwardDifference.cpp b/OndselSolver/StableBackwardDifference.cpp index 31f6c14..cc66ef2 100644 --- a/OndselSolver/StableBackwardDifference.cpp +++ b/OndselSolver/StableBackwardDifference.cpp @@ -79,7 +79,7 @@ FColDsptr MbD::StableBackwardDifference::derivativepresentpast(int deriv, FColDs //"Answer ith derivative given present value and past values." if (deriv == 0) { - return y->clonesptr(); + return y->cloneFcSptr(); } else { if (deriv <= order) { diff --git a/OndselSolver/StableBackwardDifference.h b/OndselSolver/StableBackwardDifference.h index 1c1fe42..ac4f5ed 100644 --- a/OndselSolver/StableBackwardDifference.h +++ b/OndselSolver/StableBackwardDifference.h @@ -17,13 +17,13 @@ namespace MbD { // public: FColDsptr derivativepresentpast(int order, FColDsptr y, std::shared_ptr> ypast) override; - void instantiateTaylorMatrix(); - void formTaylorRowwithTimeNodederivative(int i, int ii, int k); + void instantiateTaylorMatrix() override; + void formTaylorRowwithTimeNodederivative(int i, int ii, int k) override; void formTaylorMatrix() override; double pvdotpv() override; FColDsptr derivativepresentpastpresentDerivativepastDerivative(int n, FColDsptr y, std::shared_ptr> ypast, - FColDsptr ydot, std::shared_ptr> ydotpast); + FColDsptr ydot, std::shared_ptr> ydotpast) override; FColDsptr derivativewith(int deriv, std::shared_ptr> series); }; diff --git a/OndselSolver/SymbolicParser.cpp b/OndselSolver/SymbolicParser.cpp index d939468..5e2e449 100644 --- a/OndselSolver/SymbolicParser.cpp +++ b/OndselSolver/SymbolicParser.cpp @@ -330,7 +330,7 @@ bool MbD::SymbolicParser::constant() return true; } if (peekForTypevalue("word", "pi")) { - auto symconst = std::make_shared(M_PI); + auto symconst = std::make_shared(OS_M_PI); stack->push(symconst); return true; } diff --git a/OndselSolver/SystemNewtonRaphson.cpp b/OndselSolver/SystemNewtonRaphson.cpp index d569297..db428d5 100644 --- a/OndselSolver/SystemNewtonRaphson.cpp +++ b/OndselSolver/SystemNewtonRaphson.cpp @@ -51,13 +51,14 @@ void SystemNewtonRaphson::basicSolveEquations() void SystemNewtonRaphson::handleSingularMatrix() { - std::string str = typeid(*matrixSolver).name(); + auto& r = *matrixSolver; + std::string str = typeid(r).name(); if (str.find("GESpMatParPvMarkoFast") != std::string::npos) { matrixSolver = CREATE::With(); this->solveEquations(); } else { - str = typeid(*matrixSolver).name(); + str = typeid(r).name(); if (str.find("GESpMatParPvPrecise") != std::string::npos) { str = "MbD: Singular Matrix Error. "; system->logString(str); diff --git a/OndselSolver/VectorNewtonRaphson.h b/OndselSolver/VectorNewtonRaphson.h index ff63474..c4b0a05 100644 --- a/OndselSolver/VectorNewtonRaphson.h +++ b/OndselSolver/VectorNewtonRaphson.h @@ -27,7 +27,7 @@ namespace MbD { bool isConverged() override; void xEqualxoldPlusdx() override; virtual void basicSolveEquations() = 0; - virtual void handleSingularMatrix(); + virtual void handleSingularMatrix() override; std::shared_ptr matrixSolver; int n; diff --git a/OndselSolver/VelSolver.cpp b/OndselSolver/VelSolver.cpp index e85d4db..72b5f1e 100644 --- a/OndselSolver/VelSolver.cpp +++ b/OndselSolver/VelSolver.cpp @@ -24,13 +24,14 @@ void VelSolver::basicSolveEquations() void VelSolver::handleSingularMatrix() { - std::string str = typeid(*matrixSolver).name(); + auto& r = *matrixSolver; + std::string str = typeid(r).name(); if (str.find("GESpMatParPvMarkoFast") != std::string::npos) { matrixSolver = CREATE::With(); this->solveEquations(); } else { - str = typeid(*matrixSolver).name(); + str = typeid(r).name(); if (str.find("GESpMatParPvPrecise") != std::string::npos) { this->logSingularMatrixMessage(); matrixSolver = this->matrixSolverClassNew(); diff --git a/OndselSolver/corecrt_math_defines.h b/OndselSolver/corecrt_math_defines.h index d8c0560..0ae075c 100644 --- a/OndselSolver/corecrt_math_defines.h +++ b/OndselSolver/corecrt_math_defines.h @@ -19,12 +19,12 @@ // #define M_LOG10E 0.434294481903251827651 // log10(e) // #define M_LN2 0.693147180559945309417 // ln(2) // #define M_LN10 2.30258509299404568402 // ln(10) -#define M_PI 3.14159265358979323846 // pi +#define OS_M_PI 3.14159265358979323846264338327950288 // pi // #define M_PI_2 1.57079632679489661923 // pi/2 // #define M_PI_4 0.785398163397448309616 // pi/4 // #define M_1_PI 0.318309886183790671538 // 1/pi // #define M_2_PI 0.636619772367581343076 // 2/pi -#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi) -#define M_SQRT2 1.41421356237309504880 // sqrt(2) +#define OS_M_2_SQRTPI 1.12837916709551257389615890312154517 // 2/sqrt(pi) +#define OS_M_SQRT2 1.41421356237309504880168872420969808 // sqrt(2) // #define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2) #endif \ No newline at end of file