From d9ad3290c02d4c4970bb229a9a7a1af2ddd79bb6 Mon Sep 17 00:00:00 2001 From: Aik-Siong Koh Date: Tue, 12 Aug 2025 18:06:00 -0600 Subject: [PATCH] constraintSpecs and constraintSpec and clean up. --- OndselSolver/AbsConstraint.cpp | 5 ++++ OndselSolver/AbsConstraint.h | 1 + .../AllowZRotationConstraintIqctJqc.cpp | 5 ++++ .../AllowZRotationConstraintIqctJqc.h | 1 + OndselSolver/AngleJoint.cpp | 2 +- OndselSolver/AngleZConstraintIJ.cpp | 5 ++++ OndselSolver/AngleZConstraintIJ.h | 1 + OndselSolver/AngleZConstraintIqcJqc.cpp | 5 ++++ OndselSolver/AngleZConstraintIqcJqc.h | 1 + OndselSolver/AtPointConstraintIJ.h | 1 - OndselSolver/AtPointConstraintIqcJqc.cpp | 5 ++++ OndselSolver/AtPointConstraintIqcJqc.h | 1 + OndselSolver/AtPointConstraintIqctJqc.cpp | 5 ++++ OndselSolver/AtPointConstraintIqctJqc.h | 1 + OndselSolver/AtPointJoint.cpp | 20 +++++++++++-- OndselSolver/AtPointJoint.h | 2 ++ OndselSolver/CADSystem.cpp | 14 +++++++++- OndselSolver/CREATE.h | 10 +++---- OndselSolver/ConstVelConstraintIqcJqc.cpp | 5 ++++ OndselSolver/ConstVelConstraintIqcJqc.h | 1 + OndselSolver/Constraint.h | 1 + OndselSolver/ConstraintSet.cpp | 9 ++++++ OndselSolver/ConstraintSet.h | 2 +- OndselSolver/CylindricalJoint.cpp | 4 +-- .../DirectionCosineConstraintIqcJqc.cpp | 5 ++++ .../DirectionCosineConstraintIqcJqc.h | 1 + .../DirectionCosineConstraintIqctJqc.cpp | 5 ++++ .../DirectionCosineConstraintIqctJqc.h | 1 + OndselSolver/DistanceConstraintIqcJc.h | 3 +- OndselSolver/DistanceConstraintIqcJqc.cpp | 5 ++++ OndselSolver/DistanceConstraintIqcJqc.h | 3 +- OndselSolver/DistanceConstraintIqctJqc.cpp | 5 ++++ OndselSolver/DistanceConstraintIqctJqc.h | 1 + OndselSolver/DistancexyConstraintIqcJc.h | 2 +- OndselSolver/DistancexyConstraintIqcJqc.cpp | 5 ++++ OndselSolver/DistancexyConstraintIqcJqc.h | 3 +- OndselSolver/EulerConstraint.cpp | 5 ++++ OndselSolver/EulerConstraint.h | 1 + OndselSolver/FixedJoint.cpp | 6 ++-- OndselSolver/FullMotion.cpp | 14 +++++----- OndselSolver/GearConstraintIqcJqc.cpp | 5 ++++ OndselSolver/GearConstraintIqcJqc.h | 1 + OndselSolver/GearJoint.cpp | 2 +- OndselSolver/InLineJoint.cpp | 6 ++-- OndselSolver/InPlaneJoint.cpp | 4 +-- OndselSolver/Joint.cpp | 2 +- OndselSolver/LineInPlaneJoint.cpp | 4 +-- OndselSolver/MbDMath.cpp | 28 +++++++++++++++++++ OndselSolver/MbDMath.h | 4 ++- OndselSolver/NoRotationJoint.cpp | 8 +++--- OndselSolver/Orientation.cpp | 8 +++--- OndselSolver/ParallelAxesJoint.cpp | 6 ++-- OndselSolver/PerpendicularJoint.cpp | 4 +-- OndselSolver/PlanarJoint.cpp | 6 ++-- OndselSolver/PointInPlaneJoint.cpp | 2 +- OndselSolver/RackPinConstraintIqcJqc.cpp | 5 ++++ OndselSolver/RackPinConstraintIqcJqc.h | 1 + OndselSolver/RedundantConstraint.cpp | 7 ++++- OndselSolver/RedundantConstraint.h | 1 + OndselSolver/RevCylJoint.cpp | 4 +-- OndselSolver/RevRevJoint.cpp | 6 ++-- OndselSolver/RevoluteJoint.cpp | 4 +-- OndselSolver/ScrewConstraintIqcJqc.cpp | 5 ++++ OndselSolver/ScrewConstraintIqcJqc.h | 1 + OndselSolver/Translation.cpp | 8 +++--- OndselSolver/TranslationConstraintIqcJqc.cpp | 5 ++++ OndselSolver/TranslationConstraintIqcJqc.h | 1 + OndselSolver/TranslationConstraintIqctJqc.cpp | 5 ++++ OndselSolver/TranslationConstraintIqctJqc.h | 1 + OndselSolver/TranslationalJoint.cpp | 6 ++-- OndselSolver/UniversalJoint.cpp | 2 +- OndselSolver/ZRotation.cpp | 2 +- OndselSolver/ZTranslation.cpp | 4 +-- 73 files changed, 256 insertions(+), 74 deletions(-) diff --git a/OndselSolver/AbsConstraint.cpp b/OndselSolver/AbsConstraint.cpp index 7eebc71..f323a4c 100644 --- a/OndselSolver/AbsConstraint.cpp +++ b/OndselSolver/AbsConstraint.cpp @@ -35,6 +35,11 @@ void AbsConstraint::useEquationNumbers() iqXminusOnePlusAxis = static_cast(owner)->iqX + axis; } +std::string MbD::AbsConstraint::constraintSpec() +{ + return "AbsConstraint" + MbDMath::XYZFromInt(axis); +} + void AbsConstraint::fillPosICJacob(SpMatDsptr mat) { mat->atijplusNumber(iG, iqXminusOnePlusAxis, 1.0); diff --git a/OndselSolver/AbsConstraint.h b/OndselSolver/AbsConstraint.h index e0a9127..58debf2 100644 --- a/OndselSolver/AbsConstraint.h +++ b/OndselSolver/AbsConstraint.h @@ -27,6 +27,7 @@ namespace MbD { void fillPosKineJacob(SpMatDsptr mat) override; void fillVelICJacob(SpMatDsptr mat) override; void useEquationNumbers() override; + std::string constraintSpec() override; size_t axis = SIZE_MAX; size_t iqXminusOnePlusAxis = SIZE_MAX; diff --git a/OndselSolver/AllowZRotationConstraintIqctJqc.cpp b/OndselSolver/AllowZRotationConstraintIqctJqc.cpp index 3918e20..e72851a 100644 --- a/OndselSolver/AllowZRotationConstraintIqctJqc.cpp +++ b/OndselSolver/AllowZRotationConstraintIqctJqc.cpp @@ -52,3 +52,8 @@ void MbD::AllowZRotationConstraintIqctJqc::postPosIC() //self becomeRedundantConstraint assert(false); } + +std::string MbD::AllowZRotationConstraintIqctJqc::constraintSpec() +{ + return "AllowZRotationConstraintIJ"; +} diff --git a/OndselSolver/AllowZRotationConstraintIqctJqc.h b/OndselSolver/AllowZRotationConstraintIqctJqc.h index e62bd38..1635c7f 100644 --- a/OndselSolver/AllowZRotationConstraintIqctJqc.h +++ b/OndselSolver/AllowZRotationConstraintIqctJqc.h @@ -20,6 +20,7 @@ namespace MbD { void postInput() override; void postPosIC() override; + std::string constraintSpec() override; }; } \ No newline at end of file diff --git a/OndselSolver/AngleJoint.cpp b/OndselSolver/AngleJoint.cpp index c84161b..42f3556 100644 --- a/OndselSolver/AngleJoint.cpp +++ b/OndselSolver/AngleJoint.cpp @@ -25,7 +25,7 @@ void MbD::AngleJoint::initializeGlobally() { if (constraints->empty()) { - auto dirCosIzJz = CREATE::ConstraintWith(frmI, frmJ, 2, 2); + auto dirCosIzJz = CREATE::ConstraintWith(frmI, frmJ, 2, 2); dirCosIzJz->setConstant(std::cos(theIzJz)); addConstraint(dirCosIzJz); this->root()->hasChanged = true; diff --git a/OndselSolver/AngleZConstraintIJ.cpp b/OndselSolver/AngleZConstraintIJ.cpp index 7a65dfa..2e6a271 100644 --- a/OndselSolver/AngleZConstraintIJ.cpp +++ b/OndselSolver/AngleZConstraintIJ.cpp @@ -92,3 +92,8 @@ ConstraintType MbD::AngleZConstraintIJ::type() { return essential; } + +std::string MbD::AngleZConstraintIJ::constraintSpec() +{ + return "AngleZConstraintIJ"; +} diff --git a/OndselSolver/AngleZConstraintIJ.h b/OndselSolver/AngleZConstraintIJ.h index 94c85b0..1b28781 100644 --- a/OndselSolver/AngleZConstraintIJ.h +++ b/OndselSolver/AngleZConstraintIJ.h @@ -32,6 +32,7 @@ namespace MbD { void preVelIC() override; void simUpdateAll() override; ConstraintType type() override; + std::string constraintSpec() override; std::shared_ptr thezIeJe; }; diff --git a/OndselSolver/AngleZConstraintIqcJqc.cpp b/OndselSolver/AngleZConstraintIqcJqc.cpp index 8025682..c70c4bc 100644 --- a/OndselSolver/AngleZConstraintIqcJqc.cpp +++ b/OndselSolver/AngleZConstraintIqcJqc.cpp @@ -91,3 +91,8 @@ void MbD::AngleZConstraintIqcJqc::useEquationNumbers() auto frmJeqc = std::static_pointer_cast(frmJ); iqEJ = frmJeqc->iqE(); } + +std::string MbD::AngleZConstraintIqcJqc::constraintSpec() +{ + return "AngleZConstraintIJ"; +} diff --git a/OndselSolver/AngleZConstraintIqcJqc.h b/OndselSolver/AngleZConstraintIqcJqc.h index 7f0c8b9..35c63b1 100644 --- a/OndselSolver/AngleZConstraintIqcJqc.h +++ b/OndselSolver/AngleZConstraintIqcJqc.h @@ -30,6 +30,7 @@ namespace MbD { void fillPosKineJacob(SpMatDsptr mat) override; void fillVelICJacob(SpMatDsptr mat) override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpEJ; FMatDsptr ppGpEIpEJ, ppGpEJpEJ; diff --git a/OndselSolver/AtPointConstraintIJ.h b/OndselSolver/AtPointConstraintIJ.h index 55ea1a6..4d4918a 100644 --- a/OndselSolver/AtPointConstraintIJ.h +++ b/OndselSolver/AtPointConstraintIJ.h @@ -30,7 +30,6 @@ namespace MbD { void prePosIC() override; void preVelIC() override; ConstraintType type() override; - size_t axis; std::shared_ptr riIeJeO; diff --git a/OndselSolver/AtPointConstraintIqcJqc.cpp b/OndselSolver/AtPointConstraintIqcJqc.cpp index eb670b2..e97a42f 100644 --- a/OndselSolver/AtPointConstraintIqcJqc.cpp +++ b/OndselSolver/AtPointConstraintIqcJqc.cpp @@ -43,6 +43,11 @@ void AtPointConstraintIqcJqc::useEquationNumbers() iqEJ = frmJeqc->iqE(); } +std::string MbD::AtPointConstraintIqcJqc::constraintSpec() +{ + return "AtPointConstraintIJ" + MbDMath::XYZFromInt(axis); +} + void AtPointConstraintIqcJqc::fillPosICError(FColDsptr col) { AtPointConstraintIqcJc::fillPosICError(col); diff --git a/OndselSolver/AtPointConstraintIqcJqc.h b/OndselSolver/AtPointConstraintIqcJqc.h index dd2b42b..2d20f3a 100644 --- a/OndselSolver/AtPointConstraintIqcJqc.h +++ b/OndselSolver/AtPointConstraintIqcJqc.h @@ -28,6 +28,7 @@ namespace MbD { void fillPosKineJacob(SpMatDsptr mat) override; void fillVelICJacob(SpMatDsptr mat) override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpEJ; FMatDsptr ppGpEJpEJ; diff --git a/OndselSolver/AtPointConstraintIqctJqc.cpp b/OndselSolver/AtPointConstraintIqctJqc.cpp index 528b030..3784fa4 100644 --- a/OndselSolver/AtPointConstraintIqctJqc.cpp +++ b/OndselSolver/AtPointConstraintIqctJqc.cpp @@ -41,6 +41,11 @@ ConstraintType AtPointConstraintIqctJqc::type() return essential; } +std::string MbD::AtPointConstraintIqctJqc::constraintSpec() +{ + return AtPointConstraintIqcJqc::constraintSpec(); +} + void AtPointConstraintIqctJqc::preVelIC() { AtPointConstraintIqcJqc::preVelIC(); diff --git a/OndselSolver/AtPointConstraintIqctJqc.h b/OndselSolver/AtPointConstraintIqctJqc.h index cb83ce7..e71be2d 100644 --- a/OndselSolver/AtPointConstraintIqctJqc.h +++ b/OndselSolver/AtPointConstraintIqctJqc.h @@ -25,6 +25,7 @@ namespace MbD { void preAccIC() override; void preVelIC() override; ConstraintType type() override; + std::string constraintSpec() override; double pGpt; FRowDsptr ppGpEIpt; diff --git a/OndselSolver/AtPointJoint.cpp b/OndselSolver/AtPointJoint.cpp index 5726695..4c27eae 100644 --- a/OndselSolver/AtPointJoint.cpp +++ b/OndselSolver/AtPointJoint.cpp @@ -20,9 +20,23 @@ MbD::AtPointJoint::AtPointJoint(const std::string& str) : Joint(str) { } +std::shared_ptr MbD::AtPointJoint::With() +{ + auto inst = std::make_shared(); + inst->initialize(); + return inst; +} + +std::shared_ptr MbD::AtPointJoint::With(const char* str) +{ + auto inst = std::make_shared(str); + inst->initialize(); + return inst; +} + void MbD::AtPointJoint::createAtPointConstraints() { - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); } diff --git a/OndselSolver/AtPointJoint.h b/OndselSolver/AtPointJoint.h index 8651ba2..fbd7046 100644 --- a/OndselSolver/AtPointJoint.h +++ b/OndselSolver/AtPointJoint.h @@ -17,6 +17,8 @@ namespace MbD { public: AtPointJoint(); AtPointJoint(const std::string& str); + static std::shared_ptr With(); + static std::shared_ptr With(const char* str); void createAtPointConstraints(); diff --git a/OndselSolver/CADSystem.cpp b/OndselSolver/CADSystem.cpp index 22b3014..d3652ae 100644 --- a/OndselSolver/CADSystem.cpp +++ b/OndselSolver/CADSystem.cpp @@ -5,7 +5,7 @@ * * * See LICENSE file for details about copyright. * ***************************************************************************/ - + #include #include @@ -595,6 +595,18 @@ void CADSystem::runOndselPiston() TheSystem->addJoint(rotMotion1); // TheSystem->runKINEMATIC(TheSystem); + str = ""; + TheSystem->jointsMotionsDo([&](std::shared_ptr jm) { + str += jm->constraintSpecs(); + }); + str = ""; + TheSystem->jointsMotionsDo([&](std::shared_ptr jm) { + str += jm->name + " constraints\n"; + jm->constraintsDo([&](std::shared_ptr con) { + str += " " + con->constraintSpec() + "\n"; + }); + }); + std::cout << str << std::endl; } void CADSystem::runPiston() diff --git a/OndselSolver/CREATE.h b/OndselSolver/CREATE.h index 22fe226..0c6fc96 100644 --- a/OndselSolver/CREATE.h +++ b/OndselSolver/CREATE.h @@ -70,8 +70,8 @@ namespace MbD { } static std::shared_ptr ConstraintWith(std::shared_ptr frmi, std::shared_ptr frmj, size_t axis) { std::shared_ptr inst; - std::string str = typeid(T(frmi, frmj, axis)).name(); - if (str.find("AtPointConstraintIJ") != std::string::npos) { + std::string str = typeid(T).name(); + if (str.find("AtPointConstraintIqcJqc") != std::string::npos) { if (std::dynamic_pointer_cast(frmi)) { inst = std::make_shared(frmi, frmj, axis); } @@ -79,7 +79,7 @@ namespace MbD { inst = std::make_shared(frmi, frmj, axis); } } - else if(str.find("TranslationConstraintIJ") != std::string::npos) { + else if(str.find("TranslationConstraintIqcJqc") != std::string::npos) { if (std::dynamic_pointer_cast(frmi)) { inst = std::make_shared(frmi, frmj, axis); } @@ -97,8 +97,8 @@ namespace MbD { } static std::shared_ptr ConstraintWith(std::shared_ptr frmi, std::shared_ptr frmj, size_t axisi, size_t axisj) { std::shared_ptr inst; - std::string str = typeid(T(frmi, frmj, axisi, axisj)).name(); - if (str.find("DirectionCosineConstraintIJ") != std::string::npos) { + std::string str = typeid(T).name(); + if (str.find("DirectionCosineConstraintIqcJqc") != std::string::npos) { if (std::dynamic_pointer_cast(frmi)) { inst = std::make_shared(frmi, frmj, axisi, axisj); } diff --git a/OndselSolver/ConstVelConstraintIqcJqc.cpp b/OndselSolver/ConstVelConstraintIqcJqc.cpp index 16f02ff..c7e3aff 100644 --- a/OndselSolver/ConstVelConstraintIqcJqc.cpp +++ b/OndselSolver/ConstVelConstraintIqcJqc.cpp @@ -130,3 +130,8 @@ void MbD::ConstVelConstraintIqcJqc::useEquationNumbers() ConstVelConstraintIqcJc::useEquationNumbers(); iqEJ = std::static_pointer_cast(frmJ)->iqE(); } + +std::string MbD::ConstVelConstraintIqcJqc::constraintSpec() +{ + return "ConstVelConstraintIJ"; +} diff --git a/OndselSolver/ConstVelConstraintIqcJqc.h b/OndselSolver/ConstVelConstraintIqcJqc.h index 6ea25cc..7623796 100644 --- a/OndselSolver/ConstVelConstraintIqcJqc.h +++ b/OndselSolver/ConstVelConstraintIqcJqc.h @@ -29,6 +29,7 @@ namespace MbD { void initA10IeJe() override; void initialize() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpEJ; FMatDsptr ppGpEIpEJ; diff --git a/OndselSolver/Constraint.h b/OndselSolver/Constraint.h index a7409a8..9a52387 100644 --- a/OndselSolver/Constraint.h +++ b/OndselSolver/Constraint.h @@ -53,6 +53,7 @@ namespace MbD { void setqsuddotlam(FColDsptr col) override; void setqsulam(FColDsptr col) override; virtual ConstraintType type(); + virtual std::string constraintSpec() = 0; size_t iG = SIZE_MAX; double aG = 0.0; //Constraint function diff --git a/OndselSolver/ConstraintSet.cpp b/OndselSolver/ConstraintSet.cpp index 5fad7dc..59865c4 100644 --- a/OndselSolver/ConstraintSet.cpp +++ b/OndselSolver/ConstraintSet.cpp @@ -94,6 +94,15 @@ void MbD::ConstraintSet::useEquationNumbers() constraintsDo([](std::shared_ptr constraint) { constraint->useEquationNumbers(); }); } +std::string MbD::ConstraintSet::constraintSpecs() +{ + std::stringstream ss; + constraintsDo([&](std::shared_ptr con) { + ss << con->constraintSpec() << std::endl; + }); + return ss.str(); +} + void MbD::ConstraintSet::setqsulam(FColDsptr col) { constraintsDo([&](std::shared_ptr con) { con->setqsulam(col); }); diff --git a/OndselSolver/ConstraintSet.h b/OndselSolver/ConstraintSet.h index d75968d..66b7a17 100644 --- a/OndselSolver/ConstraintSet.h +++ b/OndselSolver/ConstraintSet.h @@ -53,7 +53,7 @@ namespace MbD { void setqsudotlam(FColDsptr col) override; void setqsulam(FColDsptr col) override; void useEquationNumbers() override; - + std::string constraintSpecs(); std::shared_ptr>> constraints; diff --git a/OndselSolver/CylindricalJoint.cpp b/OndselSolver/CylindricalJoint.cpp index b101bb8..08ae509 100644 --- a/OndselSolver/CylindricalJoint.cpp +++ b/OndselSolver/CylindricalJoint.cpp @@ -27,8 +27,8 @@ void CylindricalJoint::initializeGlobally() if (constraints->empty()) { createInLineConstraints(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/DirectionCosineConstraintIqcJqc.cpp b/OndselSolver/DirectionCosineConstraintIqcJqc.cpp index aee00bc..64cfef8 100644 --- a/OndselSolver/DirectionCosineConstraintIqcJqc.cpp +++ b/OndselSolver/DirectionCosineConstraintIqcJqc.cpp @@ -38,6 +38,11 @@ void DirectionCosineConstraintIqcJqc::useEquationNumbers() iqEJ = std::static_pointer_cast(frmJ)->iqE(); } +std::string MbD::DirectionCosineConstraintIqcJqc::constraintSpec() +{ + return "DirectionCosineConstraintI" + MbDMath::xyzFromInt(axisI) + "J" + MbDMath::xyzFromInt(axisJ); +} + void DirectionCosineConstraintIqcJqc::fillPosICError(FColDsptr col) { DirectionCosineConstraintIqcJc::fillPosICError(col); diff --git a/OndselSolver/DirectionCosineConstraintIqcJqc.h b/OndselSolver/DirectionCosineConstraintIqcJqc.h index d76e34c..3643913 100644 --- a/OndselSolver/DirectionCosineConstraintIqcJqc.h +++ b/OndselSolver/DirectionCosineConstraintIqcJqc.h @@ -27,6 +27,7 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void initaAijIeJe() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpEJ; FMatDsptr ppGpEIpEJ; diff --git a/OndselSolver/DirectionCosineConstraintIqctJqc.cpp b/OndselSolver/DirectionCosineConstraintIqctJqc.cpp index cc4c800..3c88a2e 100644 --- a/OndselSolver/DirectionCosineConstraintIqctJqc.cpp +++ b/OndselSolver/DirectionCosineConstraintIqctJqc.cpp @@ -27,6 +27,11 @@ ConstraintType DirectionCosineConstraintIqctJqc::type() return essential; } +std::string MbD::DirectionCosineConstraintIqctJqc::constraintSpec() +{ + return DirectionCosineConstraintIqcJqc::constraintSpec(); +} + void DirectionCosineConstraintIqctJqc::preVelIC() { DirectionCosineConstraintIJ::preVelIC(); diff --git a/OndselSolver/DirectionCosineConstraintIqctJqc.h b/OndselSolver/DirectionCosineConstraintIqctJqc.h index 2738722..a2629c0 100644 --- a/OndselSolver/DirectionCosineConstraintIqctJqc.h +++ b/OndselSolver/DirectionCosineConstraintIqctJqc.h @@ -23,6 +23,7 @@ namespace MbD { void preAccIC() override; void preVelIC() override; ConstraintType type() override; + std::string constraintSpec() override; double pGpt = std::numeric_limits::min(); FRowDsptr ppGpEIpt; diff --git a/OndselSolver/DistanceConstraintIqcJc.h b/OndselSolver/DistanceConstraintIqcJc.h index fdec00f..c0f4d1c 100644 --- a/OndselSolver/DistanceConstraintIqcJc.h +++ b/OndselSolver/DistanceConstraintIqcJc.h @@ -30,7 +30,8 @@ namespace MbD { FRowDsptr pGpXI, pGpEI; FMatDsptr ppGpXIpXI, ppGpXIpEI, ppGpEIpEI; - size_t iqXI, iqEI; + size_t iqXI = SIZE_MAX, iqEI = SIZE_MAX; + }; } diff --git a/OndselSolver/DistanceConstraintIqcJqc.cpp b/OndselSolver/DistanceConstraintIqcJqc.cpp index a5cb8fb..fbb4b93 100644 --- a/OndselSolver/DistanceConstraintIqcJqc.cpp +++ b/OndselSolver/DistanceConstraintIqcJqc.cpp @@ -116,3 +116,8 @@ void MbD::DistanceConstraintIqcJqc::useEquationNumbers() iqXJ = frmJeqc->iqX(); iqEJ = frmJeqc->iqE(); } + +std::string MbD::DistanceConstraintIqcJqc::constraintSpec() +{ + return "DistanceConstraintIJ"; +} diff --git a/OndselSolver/DistanceConstraintIqcJqc.h b/OndselSolver/DistanceConstraintIqcJqc.h index e788133..18987ce 100644 --- a/OndselSolver/DistanceConstraintIqcJqc.h +++ b/OndselSolver/DistanceConstraintIqcJqc.h @@ -25,10 +25,11 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void init_distIeJe() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpXIpXJ, ppGpEIpXJ, ppGpXJpXJ, ppGpXIpEJ, ppGpEIpEJ, ppGpXJpEJ, ppGpEJpEJ; - size_t iqXJ, iqEJ; + size_t iqXJ = SIZE_MAX, iqEJ = SIZE_MAX; }; } diff --git a/OndselSolver/DistanceConstraintIqctJqc.cpp b/OndselSolver/DistanceConstraintIqctJqc.cpp index 5cb790b..2808dcf 100644 --- a/OndselSolver/DistanceConstraintIqctJqc.cpp +++ b/OndselSolver/DistanceConstraintIqctJqc.cpp @@ -19,3 +19,8 @@ ConstraintType MbD::DistanceConstraintIqctJqc::type() { return essential; } + +std::string MbD::DistanceConstraintIqctJqc::constraintSpec() +{ + return DistanceConstraintIqcJqc::constraintSpec(); +} diff --git a/OndselSolver/DistanceConstraintIqctJqc.h b/OndselSolver/DistanceConstraintIqctJqc.h index eb905c7..bbf0ea8 100644 --- a/OndselSolver/DistanceConstraintIqctJqc.h +++ b/OndselSolver/DistanceConstraintIqctJqc.h @@ -17,6 +17,7 @@ namespace MbD { public: DistanceConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj); ConstraintType type() override; + std::string constraintSpec() override; double pGpt, ppGptpt; FRowDsptr ppGpXIpt, ppGpEIpt, ppGpXJpt, ppGpEJpt; diff --git a/OndselSolver/DistancexyConstraintIqcJc.h b/OndselSolver/DistancexyConstraintIqcJc.h index be02041..6358e5f 100644 --- a/OndselSolver/DistancexyConstraintIqcJc.h +++ b/OndselSolver/DistancexyConstraintIqcJc.h @@ -36,7 +36,7 @@ namespace MbD { FRowDsptr pGpXI, pGpEI; FMatDsptr ppGpXIpXI, ppGpXIpEI, ppGpEIpEI; - size_t iqXI, iqEI; + size_t iqXI = SIZE_MAX, iqEI = SIZE_MAX; }; } diff --git a/OndselSolver/DistancexyConstraintIqcJqc.cpp b/OndselSolver/DistancexyConstraintIqcJqc.cpp index 59d8ee3..b7de8d2 100644 --- a/OndselSolver/DistancexyConstraintIqcJqc.cpp +++ b/OndselSolver/DistancexyConstraintIqcJqc.cpp @@ -192,3 +192,8 @@ void MbD::DistancexyConstraintIqcJqc::useEquationNumbers() iqXJ = frmJeqc->iqX(); iqEJ = frmJeqc->iqE(); } + +std::string MbD::DistancexyConstraintIqcJqc::constraintSpec() +{ + return "DistancexyConstraintIJ"; +} diff --git a/OndselSolver/DistancexyConstraintIqcJqc.h b/OndselSolver/DistancexyConstraintIqcJqc.h index 4150533..7358d29 100644 --- a/OndselSolver/DistancexyConstraintIqcJqc.h +++ b/OndselSolver/DistancexyConstraintIqcJqc.h @@ -34,10 +34,11 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void init_xyIeJeIe() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpXIpXJ, ppGpEIpXJ, ppGpXJpXJ, ppGpXIpEJ, ppGpEIpEJ, ppGpXJpEJ, ppGpEJpEJ; - size_t iqXJ, iqEJ; + size_t iqXJ = SIZE_MAX, iqEJ = SIZE_MAX; }; } diff --git a/OndselSolver/EulerConstraint.cpp b/OndselSolver/EulerConstraint.cpp index 7ef6b73..23d5b5a 100644 --- a/OndselSolver/EulerConstraint.cpp +++ b/OndselSolver/EulerConstraint.cpp @@ -83,3 +83,8 @@ void EulerConstraint::fillAccICIterError(FColDsptr col) sum += 2.0 * partFrame->qEdot->sumOfSquares(); col->atiplusNumber(iG, sum); } + +std::string MbD::EulerConstraint::constraintSpec() +{ + return "EulerConstraint"; +} diff --git a/OndselSolver/EulerConstraint.h b/OndselSolver/EulerConstraint.h index 583d068..bd6a9c3 100644 --- a/OndselSolver/EulerConstraint.h +++ b/OndselSolver/EulerConstraint.h @@ -30,6 +30,7 @@ namespace MbD { void fillPosKineJacob(SpMatDsptr mat) override; void fillVelICJacob(SpMatDsptr mat) override; void fillAccICIterError(FColDsptr col) override; + std::string constraintSpec() override; FRowDsptr pGpE; //partial derivative of G wrt pE size_t iqE = SIZE_MAX; diff --git a/OndselSolver/FixedJoint.cpp b/OndselSolver/FixedJoint.cpp index 8a42bb0..2884e80 100644 --- a/OndselSolver/FixedJoint.cpp +++ b/OndselSolver/FixedJoint.cpp @@ -25,9 +25,9 @@ void MbD::FixedJoint::initializeGlobally() if (constraints->empty()) { createAtPointConstraints(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/FullMotion.cpp b/OndselSolver/FullMotion.cpp index a67ca70..869da64 100644 --- a/OndselSolver/FullMotion.cpp +++ b/OndselSolver/FullMotion.cpp @@ -16,7 +16,7 @@ MbD::FullMotion::FullMotion() { } -MbD::FullMotion::FullMotion(const std::string&) +MbD::FullMotion::FullMotion(const std::string& str) : PrescribedMotion(str) { } @@ -30,12 +30,12 @@ void MbD::FullMotion::initializeGlobally() { if (constraints->empty()) { initMotions(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/GearConstraintIqcJqc.cpp b/OndselSolver/GearConstraintIqcJqc.cpp index 0793ed6..571d6e9 100644 --- a/OndselSolver/GearConstraintIqcJqc.cpp +++ b/OndselSolver/GearConstraintIqcJqc.cpp @@ -162,3 +162,8 @@ void MbD::GearConstraintIqcJqc::useEquationNumbers() iqXJ = frmJeqc->iqX(); iqEJ = frmJeqc->iqE(); } + +std::string MbD::GearConstraintIqcJqc::constraintSpec() +{ + return "GearConstraintIJ"; +} diff --git a/OndselSolver/GearConstraintIqcJqc.h b/OndselSolver/GearConstraintIqcJqc.h index 20b1557..d2eaecb 100644 --- a/OndselSolver/GearConstraintIqcJqc.h +++ b/OndselSolver/GearConstraintIqcJqc.h @@ -34,6 +34,7 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void initorbitsIJ() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpXIpXJ, ppGpXIpEJ, ppGpEIpXJ, ppGpEIpEJ, ppGpXJpXJ, ppGpXJpEJ, ppGpEJpEJ; diff --git a/OndselSolver/GearJoint.cpp b/OndselSolver/GearJoint.cpp index 1e3a855..babe791 100644 --- a/OndselSolver/GearJoint.cpp +++ b/OndselSolver/GearJoint.cpp @@ -17,7 +17,7 @@ MbD::GearJoint::GearJoint() { } -MbD::GearJoint::GearJoint(const std::string&) +MbD::GearJoint::GearJoint(const std::string& str) : Joint(str) { } // diff --git a/OndselSolver/InLineJoint.cpp b/OndselSolver/InLineJoint.cpp index c30396b..c6b5819 100644 --- a/OndselSolver/InLineJoint.cpp +++ b/OndselSolver/InLineJoint.cpp @@ -13,12 +13,12 @@ MbD::InLineJoint::InLineJoint() { } -MbD::InLineJoint::InLineJoint(const std::string&) +MbD::InLineJoint::InLineJoint(const std::string& str) : Joint(str) { } void MbD::InLineJoint::createInLineConstraints() { - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); } diff --git a/OndselSolver/InPlaneJoint.cpp b/OndselSolver/InPlaneJoint.cpp index 7c7feba..7f0d526 100644 --- a/OndselSolver/InPlaneJoint.cpp +++ b/OndselSolver/InPlaneJoint.cpp @@ -13,13 +13,13 @@ MbD::InPlaneJoint::InPlaneJoint() { } -MbD::InPlaneJoint::InPlaneJoint(const std::string&) +MbD::InPlaneJoint::InPlaneJoint(const std::string& str) : Joint(str) { } void MbD::InPlaneJoint::createInPlaneConstraint() { - auto tranCon = CREATE::ConstraintWith(frmI, frmJ, 2); + auto tranCon = CREATE::ConstraintWith(frmI, frmJ, 2); tranCon->setConstant(offset); addConstraint(tranCon); } diff --git a/OndselSolver/Joint.cpp b/OndselSolver/Joint.cpp index 80de74f..bd5fe61 100644 --- a/OndselSolver/Joint.cpp +++ b/OndselSolver/Joint.cpp @@ -97,7 +97,7 @@ void Joint::constraintsReport() std::string str = "MbD: " + this->classname() + std::string(" ") + this->name + " has the following constraint(s) removed: "; this->logString(str); std::for_each(redunCons->begin(), redunCons->end(), [&](auto& con) { - str = "MbD: " + std::string(" ") + con->classname(); + str = "MbD: " + std::string(" ") + con->constraintSpec(); this->logString(str); }); } diff --git a/OndselSolver/LineInPlaneJoint.cpp b/OndselSolver/LineInPlaneJoint.cpp index 5cf740e..22f4de5 100644 --- a/OndselSolver/LineInPlaneJoint.cpp +++ b/OndselSolver/LineInPlaneJoint.cpp @@ -16,7 +16,7 @@ MbD::LineInPlaneJoint::LineInPlaneJoint() { } -MbD::LineInPlaneJoint::LineInPlaneJoint(const std::string&) +MbD::LineInPlaneJoint::LineInPlaneJoint(const std::string& str) : InPlaneJoint(str) { } @@ -25,7 +25,7 @@ void MbD::LineInPlaneJoint::initializeGlobally() if (constraints->empty()) { this->createInPlaneConstraint(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/MbDMath.cpp b/OndselSolver/MbDMath.cpp index 632aaa5..394ac24 100644 --- a/OndselSolver/MbDMath.cpp +++ b/OndselSolver/MbDMath.cpp @@ -12,3 +12,31 @@ void MbD::MbDMath::noop() { //No Operations } + +std::string MbD::MbDMath::xyzFromInt(int i) +{ + switch (i) { + case 0: + return "x"; + case 1: + return "y"; + case 2: + return "z"; + default: + return std::to_string(i); + } +} + +std::string MbD::MbDMath::XYZFromInt(int i) +{ + switch (i) { + case 0: + return "X"; + case 1: + return "Y"; + case 2: + return "Z"; + default: + return std::to_string(i); + } +} diff --git a/OndselSolver/MbDMath.h b/OndselSolver/MbDMath.h index 8abf4d2..3344960 100644 --- a/OndselSolver/MbDMath.h +++ b/OndselSolver/MbDMath.h @@ -7,13 +7,15 @@ ***************************************************************************/ #pragma once +#include namespace MbD { class MbDMath { public: void noop(); - + static std::string xyzFromInt(int i); + static std::string XYZFromInt(int i); }; } diff --git a/OndselSolver/NoRotationJoint.cpp b/OndselSolver/NoRotationJoint.cpp index d611b3e..edf0a9b 100644 --- a/OndselSolver/NoRotationJoint.cpp +++ b/OndselSolver/NoRotationJoint.cpp @@ -17,7 +17,7 @@ MbD::NoRotationJoint::NoRotationJoint() { } -MbD::NoRotationJoint::NoRotationJoint(const std::string&) +MbD::NoRotationJoint::NoRotationJoint(const std::string& str) : Joint(str) { } @@ -25,9 +25,9 @@ void MbD::NoRotationJoint::initializeGlobally() { if (constraints->empty()) { - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/Orientation.cpp b/OndselSolver/Orientation.cpp index 89dda45..29ecbf0 100644 --- a/OndselSolver/Orientation.cpp +++ b/OndselSolver/Orientation.cpp @@ -16,7 +16,7 @@ MbD::Orientation::Orientation() { } -MbD::Orientation::Orientation(const std::string&) +MbD::Orientation::Orientation(const std::string& str) : PrescribedMotion(str) { } @@ -24,9 +24,9 @@ void MbD::Orientation::initializeGlobally() { if (constraints->empty()) { initMotions(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/ParallelAxesJoint.cpp b/OndselSolver/ParallelAxesJoint.cpp index 81d4964..f818820 100644 --- a/OndselSolver/ParallelAxesJoint.cpp +++ b/OndselSolver/ParallelAxesJoint.cpp @@ -16,7 +16,7 @@ MbD::ParallelAxesJoint::ParallelAxesJoint() { } -MbD::ParallelAxesJoint::ParallelAxesJoint(const std::string&) +MbD::ParallelAxesJoint::ParallelAxesJoint(const std::string& str) : Joint(str) { } @@ -24,8 +24,8 @@ void MbD::ParallelAxesJoint::initializeGlobally() { if (constraints->empty()) { - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/PerpendicularJoint.cpp b/OndselSolver/PerpendicularJoint.cpp index b3eb9f4..75e7789 100644 --- a/OndselSolver/PerpendicularJoint.cpp +++ b/OndselSolver/PerpendicularJoint.cpp @@ -16,7 +16,7 @@ MbD::PerpendicularJoint::PerpendicularJoint() { } -MbD::PerpendicularJoint::PerpendicularJoint(const std::string&) +MbD::PerpendicularJoint::PerpendicularJoint(const std::string& str) : Joint(str) { } @@ -24,7 +24,7 @@ void MbD::PerpendicularJoint::initializeGlobally() { if (constraints->empty()) { - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/PlanarJoint.cpp b/OndselSolver/PlanarJoint.cpp index 85d9de4..c49c48a 100644 --- a/OndselSolver/PlanarJoint.cpp +++ b/OndselSolver/PlanarJoint.cpp @@ -16,7 +16,7 @@ MbD::PlanarJoint::PlanarJoint() { } -MbD::PlanarJoint::PlanarJoint(const std::string&) +MbD::PlanarJoint::PlanarJoint(const std::string& str) : InPlaneJoint(str) { } @@ -25,8 +25,8 @@ void MbD::PlanarJoint::initializeGlobally() if (constraints->empty()) { this->createInPlaneConstraint(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/PointInPlaneJoint.cpp b/OndselSolver/PointInPlaneJoint.cpp index 81009d5..e8d2076 100644 --- a/OndselSolver/PointInPlaneJoint.cpp +++ b/OndselSolver/PointInPlaneJoint.cpp @@ -15,7 +15,7 @@ MbD::PointInPlaneJoint::PointInPlaneJoint() { } -MbD::PointInPlaneJoint::PointInPlaneJoint(const std::string&) +MbD::PointInPlaneJoint::PointInPlaneJoint(const std::string& str) : InPlaneJoint(str) { } diff --git a/OndselSolver/RackPinConstraintIqcJqc.cpp b/OndselSolver/RackPinConstraintIqcJqc.cpp index f6d1bd1..5052904 100644 --- a/OndselSolver/RackPinConstraintIqcJqc.cpp +++ b/OndselSolver/RackPinConstraintIqcJqc.cpp @@ -141,3 +141,8 @@ void MbD::RackPinConstraintIqcJqc::useEquationNumbers() iqXJ = frmJeqc->iqX(); iqEJ = frmJeqc->iqE(); } + +std::string MbD::RackPinConstraintIqcJqc::constraintSpec() +{ + return "RackPinConstraintIJ"; +} diff --git a/OndselSolver/RackPinConstraintIqcJqc.h b/OndselSolver/RackPinConstraintIqcJqc.h index 1a6e7b6..bb980bc 100644 --- a/OndselSolver/RackPinConstraintIqcJqc.h +++ b/OndselSolver/RackPinConstraintIqcJqc.h @@ -34,6 +34,7 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void init_xthez() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpEIpXJ, ppGpEIpEJ, ppGpEJpEJ; diff --git a/OndselSolver/RedundantConstraint.cpp b/OndselSolver/RedundantConstraint.cpp index d3938c0..f49e708 100644 --- a/OndselSolver/RedundantConstraint.cpp +++ b/OndselSolver/RedundantConstraint.cpp @@ -5,7 +5,7 @@ * * * See LICENSE file for details about copyright. * ***************************************************************************/ - + #include "RedundantConstraint.h" using namespace MbD; @@ -112,3 +112,8 @@ void RedundantConstraint::discontinuityAtaddTypeTo(double, std::shared_ptrconstraintSpec(); +} diff --git a/OndselSolver/RedundantConstraint.h b/OndselSolver/RedundantConstraint.h index aa5024d..b7bbb31 100644 --- a/OndselSolver/RedundantConstraint.h +++ b/OndselSolver/RedundantConstraint.h @@ -38,6 +38,7 @@ namespace MbD { void fillAccICIterError(FColDsptr col) override; void setqsuddotlam(FColDsptr col) override; void discontinuityAtaddTypeTo(double t, std::shared_ptr> disconTypes) override; + std::string constraintSpec() override; std::shared_ptr constraint; }; diff --git a/OndselSolver/RevCylJoint.cpp b/OndselSolver/RevCylJoint.cpp index 01eb3e5..40028d5 100644 --- a/OndselSolver/RevCylJoint.cpp +++ b/OndselSolver/RevCylJoint.cpp @@ -28,8 +28,8 @@ void MbD::RevCylJoint::initializeGlobally() auto distxyIJ = DistancexyConstraintIJ::With(frmI, frmJ); distxyIJ->setConstant(distanceIJ); addConstraint(distxyIJ); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/RevRevJoint.cpp b/OndselSolver/RevRevJoint.cpp index 53c5b68..0dd41bf 100644 --- a/OndselSolver/RevRevJoint.cpp +++ b/OndselSolver/RevRevJoint.cpp @@ -28,9 +28,9 @@ void MbD::RevRevJoint::initializeGlobally() auto distxyIJ = DistancexyConstraintIJ::With(frmI, frmJ); distxyIJ->setConstant(distanceIJ); addConstraint(distxyIJ); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/RevoluteJoint.cpp b/OndselSolver/RevoluteJoint.cpp index 190737e..3c6a44d 100644 --- a/OndselSolver/RevoluteJoint.cpp +++ b/OndselSolver/RevoluteJoint.cpp @@ -27,8 +27,8 @@ void RevoluteJoint::initializeGlobally() if (constraints->empty()) { createAtPointConstraints(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/ScrewConstraintIqcJqc.cpp b/OndselSolver/ScrewConstraintIqcJqc.cpp index 0551f60..05d5f21 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.cpp +++ b/OndselSolver/ScrewConstraintIqcJqc.cpp @@ -143,3 +143,8 @@ void MbD::ScrewConstraintIqcJqc::useEquationNumbers() iqXJ = frmJeqc->iqX(); iqEJ = frmJeqc->iqE(); } + +std::string MbD::ScrewConstraintIqcJqc::constraintSpec() +{ + return "ScrewConstraintIJ"; +} diff --git a/OndselSolver/ScrewConstraintIqcJqc.h b/OndselSolver/ScrewConstraintIqcJqc.h index a6fd708..d31ee9f 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.h +++ b/OndselSolver/ScrewConstraintIqcJqc.h @@ -34,6 +34,7 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void init_zthez() override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpEIpXJ, ppGpEIpEJ, ppGpEJpEJ; diff --git a/OndselSolver/Translation.cpp b/OndselSolver/Translation.cpp index d4f01f1..8df9159 100644 --- a/OndselSolver/Translation.cpp +++ b/OndselSolver/Translation.cpp @@ -16,7 +16,7 @@ MbD::Translation::Translation() { } -MbD::Translation::Translation(const std::string&) +MbD::Translation::Translation(const std::string& str) : PrescribedMotion(str) { } @@ -24,9 +24,9 @@ void MbD::Translation::initializeGlobally() { if (constraints->empty()) { initMotions(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/TranslationConstraintIqcJqc.cpp b/OndselSolver/TranslationConstraintIqcJqc.cpp index 0e18b9b..a75b152 100644 --- a/OndselSolver/TranslationConstraintIqcJqc.cpp +++ b/OndselSolver/TranslationConstraintIqcJqc.cpp @@ -41,6 +41,11 @@ void TranslationConstraintIqcJqc::useEquationNumbers() iqEJ = frmJeqc->iqE(); } +std::string MbD::TranslationConstraintIqcJqc::constraintSpec() +{ + return "TranslationConstraintI" + MbDMath::xyzFromInt(axisI) + "J"; +} + void TranslationConstraintIqcJqc::fillPosICError(FColDsptr col) { TranslationConstraintIqcJc::fillPosICError(col); diff --git a/OndselSolver/TranslationConstraintIqcJqc.h b/OndselSolver/TranslationConstraintIqcJqc.h index 78fde6e..9c1044e 100644 --- a/OndselSolver/TranslationConstraintIqcJqc.h +++ b/OndselSolver/TranslationConstraintIqcJqc.h @@ -27,6 +27,7 @@ namespace MbD { void fillPosKineJacob(SpMatDsptr mat) override; void fillVelICJacob(SpMatDsptr mat) override; void useEquationNumbers() override; + std::string constraintSpec() override; FRowDsptr pGpXJ, pGpEJ; FMatDsptr ppGpEIpXJ, ppGpEIpEJ, ppGpEJpEJ; diff --git a/OndselSolver/TranslationConstraintIqctJqc.cpp b/OndselSolver/TranslationConstraintIqctJqc.cpp index e225c82..445a1b2 100644 --- a/OndselSolver/TranslationConstraintIqctJqc.cpp +++ b/OndselSolver/TranslationConstraintIqctJqc.cpp @@ -27,6 +27,11 @@ ConstraintType TranslationConstraintIqctJqc::type() return essential; } +std::string MbD::TranslationConstraintIqctJqc::constraintSpec() +{ + return TranslationConstraintIqcJqc::constraintSpec(); +} + void TranslationConstraintIqctJqc::preVelIC() { TranslationConstraintIJ::preVelIC(); diff --git a/OndselSolver/TranslationConstraintIqctJqc.h b/OndselSolver/TranslationConstraintIqctJqc.h index 997aa7a..c32f344 100644 --- a/OndselSolver/TranslationConstraintIqctJqc.h +++ b/OndselSolver/TranslationConstraintIqctJqc.h @@ -23,6 +23,7 @@ namespace MbD { void preAccIC() override; void preVelIC() override; ConstraintType type() override; + std::string constraintSpec() override; double pGpt; FRowDsptr ppGpXIpt; diff --git a/OndselSolver/TranslationalJoint.cpp b/OndselSolver/TranslationalJoint.cpp index ddfa3e8..f4af4cc 100644 --- a/OndselSolver/TranslationalJoint.cpp +++ b/OndselSolver/TranslationalJoint.cpp @@ -27,9 +27,9 @@ void MbD::TranslationalJoint::initializeGlobally() if (constraints->empty()) { createInLineConstraints(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 1, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 0)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 1)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/UniversalJoint.cpp b/OndselSolver/UniversalJoint.cpp index 775b868..f288c91 100644 --- a/OndselSolver/UniversalJoint.cpp +++ b/OndselSolver/UniversalJoint.cpp @@ -25,7 +25,7 @@ void MbD::UniversalJoint::initializeGlobally() if (constraints->empty()) { createAtPointConstraints(); - addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); + addConstraint(CREATE::ConstraintWith(frmI, frmJ, 2, 2)); this->root()->hasChanged = true; } else { diff --git a/OndselSolver/ZRotation.cpp b/OndselSolver/ZRotation.cpp index 3d4cdd7..5ef4f79 100644 --- a/OndselSolver/ZRotation.cpp +++ b/OndselSolver/ZRotation.cpp @@ -28,7 +28,7 @@ void ZRotation::initializeGlobally() { if (constraints->empty()) { initMotions(); - auto dirCosCon = CREATE::ConstraintWith(frmI, frmJ, 1, 0); //Use Iy and Jx to make sin(theta). + auto dirCosCon = CREATE::ConstraintWith(frmI, frmJ, 1, 0); //Use Iy and Jx to make sin(theta). addConstraint(dirCosCon); this->root()->hasChanged = true; } diff --git a/OndselSolver/ZTranslation.cpp b/OndselSolver/ZTranslation.cpp index f3efae1..1e60911 100644 --- a/OndselSolver/ZTranslation.cpp +++ b/OndselSolver/ZTranslation.cpp @@ -16,7 +16,7 @@ MbD::ZTranslation::ZTranslation() { } -MbD::ZTranslation::ZTranslation(const std::string&) +MbD::ZTranslation::ZTranslation(const std::string& str) : PrescribedMotion(str) { } @@ -24,7 +24,7 @@ void MbD::ZTranslation::initializeGlobally() { if (constraints->empty()) { initMotions(); - auto tranCon = CREATE::ConstraintWith(frmI, frmJ, 2); + auto tranCon = CREATE::ConstraintWith(frmI, frmJ, 2); addConstraint(tranCon); this->root()->hasChanged = true; }