diff --git a/OndselSolver/ASMTAllowRotation.cpp b/OndselSolver/ASMTAllowRotation.cpp index 15a6646..37042c3 100644 --- a/OndselSolver/ASMTAllowRotation.cpp +++ b/OndselSolver/ASMTAllowRotation.cpp @@ -62,8 +62,6 @@ void MbD::ASMTAllowRotation::setMotionJoint(std::string motionJoint) void MbD::ASMTAllowRotation::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "AllowRotation"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); ASMTItemIJ::storeOnLevel(os, level); storeOnLevelString(os, level + 1, "MotionJoint"); storeOnLevelString(os, level + 2, motionJoint); diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index 57429da..799981b 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -501,6 +501,8 @@ void MbD::ASMTAssembly::runDraggingTest2() limit2->settol("1.0e-9"); assembly->addLimit(limit2); + assembly->outputFile("assembly.asmt"); + auto& dragPart = assembly->parts->at(0); auto dragParts = std::make_shared>>(); dragParts->push_back(dragPart); @@ -519,7 +521,7 @@ void MbD::ASMTAssembly::runDraggingTest2() void MbD::ASMTAssembly::runDraggingTest3() { - auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion2.asmt"); + auto assembly = ASMTAssembly::assemblyFromFile("../testapp/rackPinion3.asmt"); auto dragPart = assembly->partNamed("/OndselAssembly/rackPinion#Box"); auto rotPart = assembly->partNamed("/OndselAssembly/rackPinion#Cylinder"); auto dragParts = std::make_shared>>(); @@ -1455,6 +1457,7 @@ void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, size_t lev storeOnLevelString(os, level, "ConstraintSets"); storeOnLevelJoints(os, level + 1); storeOnLevelMotions(os, level + 1); + storeOnLevelLimits(os, level + 1); storeOnLevelGeneralConstraintSets(os, level + 1); } @@ -1482,6 +1485,14 @@ void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, size_t level) } } +void MbD::ASMTAssembly::storeOnLevelLimits(std::ofstream& os, size_t level) +{ + storeOnLevelString(os, level, "Limits"); + for (auto& limit : *limits) { + limit->storeOnLevel(os, level + 1); + } +} + void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "GeneralConstraintSets"); diff --git a/OndselSolver/ASMTAssembly.h b/OndselSolver/ASMTAssembly.h index a4612bd..236fec0 100644 --- a/OndselSolver/ASMTAssembly.h +++ b/OndselSolver/ASMTAssembly.h @@ -121,6 +121,7 @@ namespace MbD { void storeOnLevelForceTorques(std::ofstream& os, size_t level); void storeOnLevelJoints(std::ofstream& os, size_t level); void storeOnLevelMotions(std::ofstream& os, size_t level); + void storeOnLevelLimits(std::ofstream& os, size_t level); void storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level); void storeOnTimeSeries(std::ofstream& os) override; void setFilename(std::string filename); diff --git a/OndselSolver/ASMTGeneralMotion.cpp b/OndselSolver/ASMTGeneralMotion.cpp index 32d5515..9352254 100644 --- a/OndselSolver/ASMTGeneralMotion.cpp +++ b/OndselSolver/ASMTGeneralMotion.cpp @@ -156,8 +156,6 @@ void MbD::ASMTGeneralMotion::createMbD(std::shared_ptr mbdSys, std::shar void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "GeneralMotion"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); ASMTItemIJ::storeOnLevel(os, level); } diff --git a/OndselSolver/ASMTItem.cpp b/OndselSolver/ASMTItem.cpp index 93057e4..5b959d1 100644 --- a/OndselSolver/ASMTItem.cpp +++ b/OndselSolver/ASMTItem.cpp @@ -207,10 +207,10 @@ std::shared_ptr MbD::ASMTItem::sptrConstant(double value) return std::make_shared(value); } -void MbD::ASMTItem::storeOnLevel(std::ofstream&, size_t) +void MbD::ASMTItem::storeOnLevel(std::ofstream& os, size_t level) { - noop(); - assert(false); + storeOnLevelString(os, level + 1, "Name"); + storeOnLevelString(os, level + 2, name); } void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, size_t level) diff --git a/OndselSolver/ASMTItemIJ.cpp b/OndselSolver/ASMTItemIJ.cpp index 6256dab..3c9e163 100644 --- a/OndselSolver/ASMTItemIJ.cpp +++ b/OndselSolver/ASMTItemIJ.cpp @@ -105,6 +105,7 @@ void MbD::ASMTItemIJ::readTZonIs(std::vector& lines) void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, size_t level) { + ASMTItem::storeOnLevel(os, level); storeOnLevelString(os, level + 1, "MarkerI"); storeOnLevelString(os, level + 2, markerI); storeOnLevelString(os, level + 1, "MarkerJ"); diff --git a/OndselSolver/ASMTJoint.cpp b/OndselSolver/ASMTJoint.cpp index 063c0c1..40edd52 100644 --- a/OndselSolver/ASMTJoint.cpp +++ b/OndselSolver/ASMTJoint.cpp @@ -42,8 +42,6 @@ void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, size_t level) auto jointType = classname(); jointType = jointType.substr(4, jointType.size() - 4); //Remove ASMT in name storeOnLevelString(os, level, jointType); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); ASMTItemIJ::storeOnLevel(os, level); } diff --git a/OndselSolver/ASMTLimit.cpp b/OndselSolver/ASMTLimit.cpp index e4ae38e..e8f6728 100644 --- a/OndselSolver/ASMTLimit.cpp +++ b/OndselSolver/ASMTLimit.cpp @@ -22,7 +22,15 @@ void MbD::ASMTLimit::initMarkers() void MbD::ASMTLimit::storeOnLevel(std::ofstream& os, size_t level) { - assert(false); + ASMTItemIJ::storeOnLevel(os, level); + storeOnLevelString(os, level + 1, "MotionJoint"); + storeOnLevelString(os, level + 2, motionJoint); + storeOnLevelString(os, level + 1, "Limit"); + storeOnLevelString(os, level + 2, limit); + storeOnLevelString(os, level + 1, "Type"); + storeOnLevelString(os, level + 2, type); + storeOnLevelString(os, level + 1, "Tol"); + storeOnLevelString(os, level + 2, tol); } void MbD::ASMTLimit::readMotionJoint(std::vector& lines) diff --git a/OndselSolver/ASMTRotationLimit.cpp b/OndselSolver/ASMTRotationLimit.cpp index 5c4567f..836b104 100644 --- a/OndselSolver/ASMTRotationLimit.cpp +++ b/OndselSolver/ASMTRotationLimit.cpp @@ -22,15 +22,5 @@ std::shared_ptr MbD::ASMTRotationLimit::mbdClassNew() void MbD::ASMTRotationLimit::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "RotationLimit"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); - ASMTItemIJ::storeOnLevel(os, level); - storeOnLevelString(os, level + 1, "MotionJoint"); - storeOnLevelString(os, level + 2, motionJoint); - storeOnLevelString(os, level + 1, "Limit"); - storeOnLevelString(os, level + 2, limit); - storeOnLevelString(os, level + 1, "Type"); - storeOnLevelString(os, level + 2, type); - storeOnLevelString(os, level + 1, "Tol"); - storeOnLevelString(os, level + 2, tol); + ASMTLimit::storeOnLevel(os, level); } diff --git a/OndselSolver/ASMTRotationalMotion.cpp b/OndselSolver/ASMTRotationalMotion.cpp index 89d25f4..0b681e7 100644 --- a/OndselSolver/ASMTRotationalMotion.cpp +++ b/OndselSolver/ASMTRotationalMotion.cpp @@ -102,8 +102,6 @@ void MbD::ASMTRotationalMotion::setRotationZ(std::string rotZ) void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "RotationalMotion"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); ASMTItemIJ::storeOnLevel(os, level); storeOnLevelString(os, level + 1, "MotionJoint"); storeOnLevelString(os, level + 2, motionJoint); diff --git a/OndselSolver/ASMTTranslationLimit.cpp b/OndselSolver/ASMTTranslationLimit.cpp index 1949e79..7d87ce6 100644 --- a/OndselSolver/ASMTTranslationLimit.cpp +++ b/OndselSolver/ASMTTranslationLimit.cpp @@ -21,15 +21,5 @@ std::shared_ptr MbD::ASMTTranslationLimit::mbdClassNew() void MbD::ASMTTranslationLimit::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "TranslationLimit"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); - ASMTItemIJ::storeOnLevel(os, level); - storeOnLevelString(os, level + 1, "MotionJoint"); - storeOnLevelString(os, level + 2, motionJoint); - storeOnLevelString(os, level + 1, "Limit"); - storeOnLevelString(os, level + 2, limit); - storeOnLevelString(os, level + 1, "Type"); - storeOnLevelString(os, level + 2, type); - storeOnLevelString(os, level + 1, "Tol"); - storeOnLevelString(os, level + 2, tol); + ASMTLimit::storeOnLevel(os, level); } diff --git a/OndselSolver/ASMTTranslationalMotion.cpp b/OndselSolver/ASMTTranslationalMotion.cpp index 920b350..9555079 100644 --- a/OndselSolver/ASMTTranslationalMotion.cpp +++ b/OndselSolver/ASMTTranslationalMotion.cpp @@ -71,8 +71,6 @@ void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector& li void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, size_t level) { storeOnLevelString(os, level, "TranslationalMotion"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); ASMTItemIJ::storeOnLevel(os, level); } diff --git a/testapp/CrankSlider2debug1.asmt b/testapp/CrankSlider2debug1.asmt index 628485a..b5964ee 100644 --- a/testapp/CrankSlider2debug1.asmt +++ b/testapp/CrankSlider2debug1.asmt @@ -407,6 +407,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/CrankSlider2debug2.asmt b/testapp/CrankSlider2debug2.asmt index 4b11a93..d90cdb8 100644 --- a/testapp/CrankSlider2debug2.asmt +++ b/testapp/CrankSlider2debug2.asmt @@ -407,6 +407,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 10.0*(1.0 - 0.0))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/InitialConditionsdebug1.asmt b/testapp/InitialConditionsdebug1.asmt index 4422a94..ce0490c 100644 --- a/testapp/InitialConditionsdebug1.asmt +++ b/testapp/InitialConditionsdebug1.asmt @@ -54,6 +54,7 @@ Assembly ConstraintSets Joints Motions + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/InitialConditionsdebug2.asmt b/testapp/InitialConditionsdebug2.asmt index 985bc75..a283251 100644 --- a/testapp/InitialConditionsdebug2.asmt +++ b/testapp/InitialConditionsdebug2.asmt @@ -54,6 +54,7 @@ Assembly ConstraintSets Joints Motions + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase(Cosine-half drive)debug1.asmt b/testapp/MBDynCase(Cosine-half drive)debug1.asmt index 3fd8c8c..8946b09 100644 --- a/testapp/MBDynCase(Cosine-half drive)debug1.asmt +++ b/testapp/MBDynCase(Cosine-half drive)debug1.asmt @@ -168,6 +168,7 @@ Assembly /Assembly/structural_node_1/Marker1 MarkerJ /Assembly/structural_node_2/Marker0 + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase(Cosine-half drive)debug2.asmt b/testapp/MBDynCase(Cosine-half drive)debug2.asmt index d8942d1..22e83f4 100644 --- a/testapp/MBDynCase(Cosine-half drive)debug2.asmt +++ b/testapp/MBDynCase(Cosine-half drive)debug2.asmt @@ -168,6 +168,7 @@ Assembly /Assembly/structural_node_1/Marker1 MarkerJ /Assembly/structural_node_2/Marker0 + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase(Sine-forever drive)debug1.asmt b/testapp/MBDynCase(Sine-forever drive)debug1.asmt index 3fd8c8c..8946b09 100644 --- a/testapp/MBDynCase(Sine-forever drive)debug1.asmt +++ b/testapp/MBDynCase(Sine-forever drive)debug1.asmt @@ -168,6 +168,7 @@ Assembly /Assembly/structural_node_1/Marker1 MarkerJ /Assembly/structural_node_2/Marker0 + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase(Sine-forever drive)debug2.asmt b/testapp/MBDynCase(Sine-forever drive)debug2.asmt index 438fbb8..90c2bc1 100644 --- a/testapp/MBDynCase(Sine-forever drive)debug2.asmt +++ b/testapp/MBDynCase(Sine-forever drive)debug2.asmt @@ -168,6 +168,7 @@ Assembly /Assembly/structural_node_1/Marker1 MarkerJ /Assembly/structural_node_2/Marker0 + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase2debug1.asmt b/testapp/MBDynCase2debug1.asmt index 4ccf381..9770667 100644 --- a/testapp/MBDynCase2debug1.asmt +++ b/testapp/MBDynCase2debug1.asmt @@ -407,6 +407,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase2debug2.asmt b/testapp/MBDynCase2debug2.asmt index 63ee821..8cf5842 100644 --- a/testapp/MBDynCase2debug2.asmt +++ b/testapp/MBDynCase2debug2.asmt @@ -407,6 +407,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.0, 0.0, 1.0, 0.0 + 6.28*(1.0 - 0.0))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase5origdebug1.asmt b/testapp/MBDynCase5origdebug1.asmt index 3bb17eb..3c73faa 100644 --- a/testapp/MBDynCase5origdebug1.asmt +++ b/testapp/MBDynCase5origdebug1.asmt @@ -979,6 +979,7 @@ Assembly /Assembly/joint_19 RotationZ integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase5origdebug2.asmt b/testapp/MBDynCase5origdebug2.asmt index 5c23733..cca7b83 100644 --- a/testapp/MBDynCase5origdebug2.asmt +++ b/testapp/MBDynCase5origdebug2.asmt @@ -979,6 +979,7 @@ Assembly /Assembly/joint_19 RotationZ integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 5.0*(2.0 - 0.25))/2) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase8origdebug1.asmt b/testapp/MBDynCase8origdebug1.asmt index f7fe60d..536fb9b 100644 --- a/testapp/MBDynCase8origdebug1.asmt +++ b/testapp/MBDynCase8origdebug1.asmt @@ -845,6 +845,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase8origdebug2.asmt b/testapp/MBDynCase8origdebug2.asmt index 01dfa55..206cfc4 100644 --- a/testapp/MBDynCase8origdebug2.asmt +++ b/testapp/MBDynCase8origdebug2.asmt @@ -845,6 +845,7 @@ Assembly /Assembly/joint_2 RotationZ integral(time, rampstep(time, 0.25, 0.0, 3.0, 0.0 + 1.0*(3.0 - 0.25))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase9origdebug1.asmt b/testapp/MBDynCase9origdebug1.asmt index 501e237..51483e9 100644 --- a/testapp/MBDynCase9origdebug1.asmt +++ b/testapp/MBDynCase9origdebug1.asmt @@ -1595,6 +1595,7 @@ Assembly /Assembly/joint_4 RotationZ integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/MBDynCase9origdebug2.asmt b/testapp/MBDynCase9origdebug2.asmt index 27aadf7..3220f11 100644 --- a/testapp/MBDynCase9origdebug2.asmt +++ b/testapp/MBDynCase9origdebug2.asmt @@ -1595,6 +1595,7 @@ Assembly /Assembly/joint_4 RotationZ integral(time, rampstep(time, 0.25, 0.0, 2.0, 0.0 + 0.5*(2.0 - 0.25))) + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/OndselSolver.cpp b/testapp/OndselSolver.cpp index 982f430..c021097 100644 --- a/testapp/OndselSolver.cpp +++ b/testapp/OndselSolver.cpp @@ -26,8 +26,8 @@ void sharedptrTest(); int main() { - ASMTAssembly::runDraggingTest3(); ASMTAssembly::runDraggingTest2(); + ASMTAssembly::runDraggingTest3(); ASMTAssembly::runDraggingTest(); //ASMTAssembly::runFile("../testapp/pistonWithLimits.asmt"); ASMTAssembly::runFile("../testapp/pistonAllowZRotation.asmt"); diff --git a/testapp/SphericalHingedebug1.asmt b/testapp/SphericalHingedebug1.asmt index 854ac7a..df8f960 100644 --- a/testapp/SphericalHingedebug1.asmt +++ b/testapp/SphericalHingedebug1.asmt @@ -168,6 +168,7 @@ Assembly MarkerJ /Assembly/structural_node_1/Marker1 Motions + Limits GeneralConstraintSets ForceTorques ConstantGravity diff --git a/testapp/SphericalHingedebug2.asmt b/testapp/SphericalHingedebug2.asmt index 2d2705a..ba42361 100644 --- a/testapp/SphericalHingedebug2.asmt +++ b/testapp/SphericalHingedebug2.asmt @@ -168,6 +168,7 @@ Assembly MarkerJ /Assembly/structural_node_1/Marker1 Motions + Limits GeneralConstraintSets ForceTorques ConstantGravity