Skip to content

Commit

Permalink
fixes mac errors and warnings; check on TODO items
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnAD committed Nov 20, 2023
1 parent 6f4fca7 commit 4c41bf9
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 37 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/ASMTTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace MbD {
//
public:
void deleteMbD();
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits);
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
Symsptr expandUntil(Symsptr sptr, std::shared_ptr<std::unordered_set<Symsptr>> set) override;
Symsptr simplifyUntil(Symsptr sptr, std::shared_ptr<std::unordered_set<Symsptr>> set) override;
bool isVariable() override;
Expand Down
11 changes: 5 additions & 6 deletions OndselSolver/AccNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,17 @@ void AccNewtonRaphson::preRun()

void MbD::AccNewtonRaphson::handleSingularMatrix()
{
std::string str = typeid(*matrixSolver).name();
auto& r = *matrixSolver; // TODO: correct?
std::string str = typeid(r).name();
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::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);
}
}
Expand Down
6 changes: 0 additions & 6 deletions OndselSolver/FullColumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,4 @@ namespace MbD {
}
return answer;
}
template<typename T>
std::shared_ptr<FullColumn<T>> FullColumn<T>::clonesptr()
{
return std::make_shared<FullColumn<T>>(*this);
}

}
7 changes: 6 additions & 1 deletion OndselSolver/FullColumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace MbD {
void equalSelfPlusFullColumntimes(FColsptr<T> fullCol, T factor);
FColsptr<T> cross(FColsptr<T> fullCol);
FColsptr<T> simplified();
std::shared_ptr<FullColumn<T>> clonesptr();
std::shared_ptr<FullColumn<T>> cloneFcSptr();
double dot(std::shared_ptr<FullVector<T>> vec);
std::shared_ptr<FullVector<T>> dot(std::shared_ptr<std::vector<std::shared_ptr<FullColumn<T>>>> vecvec);

Expand All @@ -66,4 +66,9 @@ namespace MbD {
s << "}";
return s;
}
template<typename T>
std::shared_ptr<FullColumn<T>> FullColumn<T>::cloneFcSptr()
{
return std::make_shared<FullColumn<T>>(*this);
}
}
2 changes: 1 addition & 1 deletion OndselSolver/LDUFullMat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/MBDynItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ std::vector<std::string> 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); // TODO: valid?
});
std::vector<std::string> needToCombineArgs(arguments.begin(), it + 1);
arguments.erase(arguments.begin(), it + 1);
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/MBDynMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace MbD {
class MBDynMarker : public MBDynItem
{
public:
void parseMBDyn(std::vector<std::string>& args);
void parseMBDyn(std::vector<std::string>& args) override;
void parseMBDynClamp(std::vector<std::string>& args);
void createASMT() override;

Expand Down
15 changes: 7 additions & 8 deletions OndselSolver/PosICNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,17 @@ void PosICNewtonRaphson::handleSingularMatrix()
matrixSolver = this->matrixSolverClassNew();
}
else {
std::string str = typeid(*matrixSolver).name();
auto& r = *matrixSolver; // TODO: correct?
std::string str = typeid(r).name();
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
}
else {
str = typeid(*matrixSolver).name();
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
} else {
str = typeid(r).name();
if (str.find("GESpMatParPvPrecise") != std::string::npos) {
this->lookForRedundantConstraints();
matrixSolver = this->matrixSolverClassNew();
}
else {
} else {
assert(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/StableBackwardDifference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/StableBackwardDifference.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ namespace MbD {
//
public:
FColDsptr derivativepresentpast(int order, FColDsptr y, std::shared_ptr<std::vector<FColDsptr>> 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<std::vector<FColDsptr>> ypast,
FColDsptr ydot, std::shared_ptr<std::vector<FColDsptr>> ydotpast);
FColDsptr ydot, std::shared_ptr<std::vector<FColDsptr>> ydotpast) override;
FColDsptr derivativewith(int deriv, std::shared_ptr<std::vector<FColDsptr>> series);

};
Expand Down
5 changes: 3 additions & 2 deletions OndselSolver/SystemNewtonRaphson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ void SystemNewtonRaphson::basicSolveEquations()

void SystemNewtonRaphson::handleSingularMatrix()
{
std::string str = typeid(*matrixSolver).name();
auto& r = *matrixSolver; // TODO: correct?
std::string str = typeid(r).name();
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::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);
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/VectorNewtonRaphson.h
Original file line number Diff line number Diff line change
Expand Up @@ -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> matrixSolver;
int n;
Expand Down
5 changes: 3 additions & 2 deletions OndselSolver/VelSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ void VelSolver::basicSolveEquations()

void VelSolver::handleSingularMatrix()
{
std::string str = typeid(*matrixSolver).name();
auto& r = *matrixSolver; // TODO: correct?
std::string str = typeid(r).name();
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
}
else {
str = typeid(*matrixSolver).name();
str = typeid(r).name();
if (str.find("GESpMatParPvPrecise") != std::string::npos) {
this->logSingularMatrixMessage();
matrixSolver = this->matrixSolverClassNew();
Expand Down
6 changes: 3 additions & 3 deletions OndselSolver/corecrt_math_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 M_2_SQRTPI 1.12837916709551257389615890312154517 // 2/sqrt(pi)
#define M_SQRT2 1.41421356237309504880168872420969808 // sqrt(2)
// #define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
#endif

0 comments on commit 4c41bf9

Please sign in to comment.