From d5ac0419064607b6c8fe38acb4dbabab36a5cd02 Mon Sep 17 00:00:00 2001 From: Aik-Siong Koh Date: Fri, 5 May 2023 19:01:53 -0600 Subject: [PATCH] second good build. Joints --- MbDCode/AbsConstraint.cpp | 18 +++ MbDCode/AbsConstraint.h | 4 + MbDCode/Array.h | 5 +- MbDCode/CartesianFrame.cpp | 14 ++ MbDCode/CartesianFrame.h | 4 + MbDCode/Constraint.cpp | 30 ++++ MbDCode/Constraint.h | 35 ++--- MbDCode/Constraint.h.bak | 24 ++++ MbDCode/CylindricalJoint.cpp | 14 ++ MbDCode/CylindricalJoint.cpp.bak | 1 + MbDCode/CylindricalJoint.h | 5 + MbDCode/CylindricalJoint.h.bak | 10 ++ MbDCode/EndFramec.cpp | 10 +- MbDCode/EndFramec.cpp.bak | 12 ++ MbDCode/EndFramec.h | 2 + MbDCode/EndFramec.h.bak | 22 +++ MbDCode/EndFrameqc.cpp | 10 +- MbDCode/EndFrameqc.cpp.bak | 7 + MbDCode/EndFrameqc.h | 2 + MbDCode/EndFrameqc.h.bak | 23 +++ MbDCode/EndFrameqct.h | 7 + MbDCode/EulerArray.cpp | 1 + MbDCode/EulerArray.h | 9 ++ MbDCode/EulerConstraint.cpp | 15 ++ MbDCode/EulerConstraint.cpp.bak | 12 ++ MbDCode/EulerConstraint.h | 11 +- MbDCode/EulerConstraint.h.bak | 20 +++ MbDCode/EulerParameters.cpp | 95 ++++++++++++ MbDCode/EulerParameters.h | 18 +++ MbDCode/FullColumn.h | 3 +- MbDCode/FullMatrix.h | 12 +- MbDCode/FullRow.h | 24 +++- MbDCode/IndependentVariable.cpp | 1 + MbDCode/IndependentVariable.h | 9 ++ MbDCode/Item.cpp | 16 +-- MbDCode/Item.h | 3 + MbDCode/Item.h.bak | 16 +++ MbDCode/Joint.cpp | 28 +++- MbDCode/Joint.cpp.bak | 22 +++ MbDCode/Joint.h | 8 +- MbDCode/Joint.h.bak | 28 ++++ MbDCode/MarkerFrame.cpp | 21 ++- MbDCode/MarkerFrame.cpp.bak | 37 +++++ MbDCode/MarkerFrame.h | 43 +++--- MbDCode/MarkerFrame.h.bak | 36 +++++ MbDCode/MbDCode.cpp | 115 +++++++-------- MbDCode/MbDCode.cpp.bak | 240 +++++++++++++++++++++++++++++++ MbDCode/MbDCode.vcxproj | 14 ++ MbDCode/MbDCode.vcxproj.filters | 42 ++++++ MbDCode/Part.cpp | 26 +++- MbDCode/Part.cpp.bak | 38 +++++ MbDCode/Part.h | 5 + MbDCode/Part.h.bak | 29 ++++ MbDCode/PartFrame.cpp | 30 ++-- MbDCode/PartFrame.cpp.bak | 52 +++++++ MbDCode/PartFrame.h | 15 +- MbDCode/PrescribedMotion.cpp | 30 ++++ MbDCode/PrescribedMotion.cpp.bak | 19 +++ MbDCode/PrescribedMotion.h | 6 + MbDCode/PrescribedMotion.h.bak | 11 ++ MbDCode/RevoluteJoint.cpp | 14 ++ MbDCode/RevoluteJoint.cpp.bak | 1 + MbDCode/RevoluteJoint.h | 5 + MbDCode/RevoluteJoint.h.bak | 8 ++ MbDCode/SparseMatrix.h | 4 +- MbDCode/SparseRow.h | 2 +- MbDCode/Symbolic.cpp | 1 + MbDCode/Symbolic.h | 7 + MbDCode/System.cpp | 69 +++++++-- MbDCode/System.cpp.bak | 63 ++++++++ MbDCode/System.h | 25 +++- MbDCode/SystemSolver.cpp | 18 +++ MbDCode/SystemSolver.h | 39 +++-- MbDCode/Temp.cpp | 11 ++ MbDCode/Temp.h | 20 +++ MbDCode/Time.cpp | 9 ++ MbDCode/Time.h | 11 ++ MbDCode/Variable.cpp | 13 ++ MbDCode/Variable.h | 19 +++ MbDCode/Vector.h | 3 +- MbDCode/ZRotation.cpp | 14 ++ MbDCode/ZRotation.cpp.bak | 1 + MbDCode/ZRotation.h | 5 + MbDCode/ZRotation.h.bak | 9 ++ 84 files changed, 1616 insertions(+), 174 deletions(-) create mode 100644 MbDCode/Constraint.h.bak create mode 100644 MbDCode/CylindricalJoint.cpp.bak create mode 100644 MbDCode/CylindricalJoint.h.bak create mode 100644 MbDCode/EndFramec.cpp.bak create mode 100644 MbDCode/EndFramec.h.bak create mode 100644 MbDCode/EndFrameqc.cpp.bak create mode 100644 MbDCode/EndFrameqc.h.bak create mode 100644 MbDCode/EulerArray.cpp create mode 100644 MbDCode/EulerArray.h create mode 100644 MbDCode/EulerConstraint.cpp.bak create mode 100644 MbDCode/EulerConstraint.h.bak create mode 100644 MbDCode/EulerParameters.cpp create mode 100644 MbDCode/EulerParameters.h create mode 100644 MbDCode/IndependentVariable.cpp create mode 100644 MbDCode/IndependentVariable.h create mode 100644 MbDCode/Item.h.bak create mode 100644 MbDCode/Joint.cpp.bak create mode 100644 MbDCode/Joint.h.bak create mode 100644 MbDCode/MarkerFrame.cpp.bak create mode 100644 MbDCode/MarkerFrame.h.bak create mode 100644 MbDCode/MbDCode.cpp.bak create mode 100644 MbDCode/Part.cpp.bak create mode 100644 MbDCode/Part.h.bak create mode 100644 MbDCode/PartFrame.cpp.bak create mode 100644 MbDCode/PrescribedMotion.cpp.bak create mode 100644 MbDCode/PrescribedMotion.h.bak create mode 100644 MbDCode/RevoluteJoint.cpp.bak create mode 100644 MbDCode/RevoluteJoint.h.bak create mode 100644 MbDCode/Symbolic.cpp create mode 100644 MbDCode/Symbolic.h create mode 100644 MbDCode/System.cpp.bak create mode 100644 MbDCode/Temp.cpp create mode 100644 MbDCode/Temp.h create mode 100644 MbDCode/Time.cpp create mode 100644 MbDCode/Time.h create mode 100644 MbDCode/Variable.cpp create mode 100644 MbDCode/Variable.h create mode 100644 MbDCode/ZRotation.cpp.bak create mode 100644 MbDCode/ZRotation.h.bak diff --git a/MbDCode/AbsConstraint.cpp b/MbDCode/AbsConstraint.cpp index 3e8a9c6..adb9408 100644 --- a/MbDCode/AbsConstraint.cpp +++ b/MbDCode/AbsConstraint.cpp @@ -1 +1,19 @@ #include "AbsConstraint.h" + +using namespace MbD; + +AbsConstraint::AbsConstraint() +{ + initialize(); +} + +AbsConstraint::AbsConstraint(const char* str) : Constraint(str) +{ + initialize(); +} + +void AbsConstraint::initialize() +{ + axis = 0; + iqXminusOnePlusAxis = 0; +} diff --git a/MbDCode/AbsConstraint.h b/MbDCode/AbsConstraint.h index 692ebad..001f811 100644 --- a/MbDCode/AbsConstraint.h +++ b/MbDCode/AbsConstraint.h @@ -4,6 +4,10 @@ namespace MbD { class AbsConstraint : public Constraint { //axis iqXminusOnePlusAxis + public: + AbsConstraint(); + AbsConstraint(const char* str); + void initialize(); int axis; int iqXminusOnePlusAxis; }; diff --git a/MbDCode/Array.h b/MbDCode/Array.h index 45cb164..86dcb35 100644 --- a/MbDCode/Array.h +++ b/MbDCode/Array.h @@ -8,8 +8,9 @@ namespace MbD { { public: Array(){} - Array(int i) : std::vector(i) {} - Array(std::initializer_list list) : std::vector{ list } {} + Array(size_t count) : std::vector(count) {} + Array(size_t count, const T& value) : std::vector(count, value) {} + Array(std::initializer_list list) : std::vector{ list } {} void copy(std::shared_ptr> x); }; template diff --git a/MbDCode/CartesianFrame.cpp b/MbDCode/CartesianFrame.cpp index 4b8c192..6199931 100644 --- a/MbDCode/CartesianFrame.cpp +++ b/MbDCode/CartesianFrame.cpp @@ -1 +1,15 @@ #include "CartesianFrame.h" + +using namespace MbD; + +CartesianFrame::CartesianFrame() +{ +} + +CartesianFrame::CartesianFrame(const char* str) : Item(str) +{ +} + +void CartesianFrame::initialize() +{ +} diff --git a/MbDCode/CartesianFrame.h b/MbDCode/CartesianFrame.h index 545bfbc..79917c4 100644 --- a/MbDCode/CartesianFrame.h +++ b/MbDCode/CartesianFrame.h @@ -4,6 +4,10 @@ namespace MbD { class CartesianFrame : public Item { + public: + CartesianFrame(); + CartesianFrame(const char* str); + void initialize(); }; } diff --git a/MbDCode/Constraint.cpp b/MbDCode/Constraint.cpp index 26b24dc..377fd05 100644 --- a/MbDCode/Constraint.cpp +++ b/MbDCode/Constraint.cpp @@ -1 +1,31 @@ #include "Constraint.h" +//#include "Item.h" + +using namespace MbD; + +Constraint::Constraint() +{ + initialize(); +} + +Constraint::Constraint(const char* str) : Item(str) +{ + initialize(); +} + +void Constraint::initialize() +{ + iG = -1; + aG = 0.0; + lam = 0.0; +} + +void Constraint::setOwner(Item* x) +{ + owner = x; +} + +Item* Constraint::getOwner() +{ + return owner; +} diff --git a/MbDCode/Constraint.h b/MbDCode/Constraint.h index 7924c32..71b89f2 100644 --- a/MbDCode/Constraint.h +++ b/MbDCode/Constraint.h @@ -4,25 +4,20 @@ #include "Item.h" namespace MbD { - class Constraint : public Item - { - public: - Constraint() : Item() { - iG = -1; - aG = 0.0; - lam = 0.0; - } - void setOwner(std::shared_ptr x) { - owner = x; - } - std::shared_ptr getOwner() { - return owner.lock(); - } - //iG aG lam mu lamDeriv owner - int iG; - double aG; //Constraint function - double lam; //Lambda is Lagrange Multiplier - std::weak_ptr owner; //A Joint or PartFrame owns the constraint - }; + class Constraint : public Item + { + //iG aG lam mu lamDeriv owner + public: + Constraint(); + Constraint(const char* str); + void initialize(); + void setOwner(Item* x); + Item* getOwner(); + + int iG; + double aG; //Constraint function + double lam; //Lambda is Lagrange Multiplier + Item* owner; //A Joint or PartFrame owns the constraint + }; } diff --git a/MbDCode/Constraint.h.bak b/MbDCode/Constraint.h.bak new file mode 100644 index 0000000..e0911ed --- /dev/null +++ b/MbDCode/Constraint.h.bak @@ -0,0 +1,24 @@ +#pragma once +#include + +#include "Item.h" +//#include "PartFrame.h" + +namespace MbD { + class Constraint : public Item + { + //iG aG lam mu lamDeriv owner + public: + Constraint(); + Constraint(const char* str); + void initialize(); + void setOwner(Item* x); + Item* getOwner(); + + int iG; + double aG; //Constraint function + double lam; //Lambda is Lagrange Multiplier + Item* owner; //A Joint or PartFrame owns the constraint + }; +} + diff --git a/MbDCode/CylindricalJoint.cpp b/MbDCode/CylindricalJoint.cpp index ae20cdd..80af383 100644 --- a/MbDCode/CylindricalJoint.cpp +++ b/MbDCode/CylindricalJoint.cpp @@ -1 +1,15 @@ #include "CylindricalJoint.h" + +using namespace MbD; + +CylindricalJoint::CylindricalJoint() { + initialize(); +} + +CylindricalJoint::CylindricalJoint(const char* str) : Joint(str) { + initialize(); +} + +void CylindricalJoint::initialize() +{ +} diff --git a/MbDCode/CylindricalJoint.cpp.bak b/MbDCode/CylindricalJoint.cpp.bak new file mode 100644 index 0000000..ae20cdd --- /dev/null +++ b/MbDCode/CylindricalJoint.cpp.bak @@ -0,0 +1 @@ +#include "CylindricalJoint.h" diff --git a/MbDCode/CylindricalJoint.h b/MbDCode/CylindricalJoint.h index df0ae0a..5901fe5 100644 --- a/MbDCode/CylindricalJoint.h +++ b/MbDCode/CylindricalJoint.h @@ -4,6 +4,11 @@ namespace MbD { class CylindricalJoint : public Joint { + //frmI frmJ constraints friction + public: + CylindricalJoint(); + CylindricalJoint(const char* str); + void initialize(); }; } diff --git a/MbDCode/CylindricalJoint.h.bak b/MbDCode/CylindricalJoint.h.bak new file mode 100644 index 0000000..0280eb7 --- /dev/null +++ b/MbDCode/CylindricalJoint.h.bak @@ -0,0 +1,10 @@ +#pragma once +#include "Joint.h" + +namespace MbD { + class CylindricalJoint : public Joint + { + public: + }; +} + diff --git a/MbDCode/EndFramec.cpp b/MbDCode/EndFramec.cpp index 6b35584..bffca47 100644 --- a/MbDCode/EndFramec.cpp +++ b/MbDCode/EndFramec.cpp @@ -2,7 +2,15 @@ using namespace MbD; -EndFramec::EndFramec() +EndFramec::EndFramec() { + initialize(); +} + +EndFramec::EndFramec(const char* str) : CartesianFrame(str) { + initialize(); +} + +void EndFramec::initialize() { } diff --git a/MbDCode/EndFramec.cpp.bak b/MbDCode/EndFramec.cpp.bak new file mode 100644 index 0000000..ac59cbc --- /dev/null +++ b/MbDCode/EndFramec.cpp.bak @@ -0,0 +1,12 @@ +#include "EndFramec.h" + +using namespace MbD; + +EndFramec::EndFramec() +{ +} + +void EndFramec::setMarkerFrame(std::shared_ptr markerFrm) +{ + markerFrame = markerFrm; +} diff --git a/MbDCode/EndFramec.h b/MbDCode/EndFramec.h index 232e185..44f3623 100644 --- a/MbDCode/EndFramec.h +++ b/MbDCode/EndFramec.h @@ -12,6 +12,8 @@ namespace MbD { //markerFrame rOeO aAOe public: EndFramec(); + EndFramec(const char* str); + void initialize(); void setMarkerFrame(MarkerFrame* markerFrm); MarkerFrame* markerFrame; diff --git a/MbDCode/EndFramec.h.bak b/MbDCode/EndFramec.h.bak new file mode 100644 index 0000000..efe2e32 --- /dev/null +++ b/MbDCode/EndFramec.h.bak @@ -0,0 +1,22 @@ +#pragma once +#include "CartesianFrame.h" +#include "MarkerFrame.h" +#include "FullColumn.h" +#include "FullMatrix.h" + +namespace MbD { + class MarkerFrame; + + class EndFramec : public CartesianFrame + { + //markerFrame rOeO aAOe + public: + EndFramec(); + void setMarkerFrame(std::shared_ptr markerFrm); + + std::weak_ptr markerFrame; + FullColDptr rOeO = std::make_shared>(3); + FullMatDptr aAOe = std::make_shared>(3, 3); + }; +} + diff --git a/MbDCode/EndFrameqc.cpp b/MbDCode/EndFrameqc.cpp index b84300c..4e8dab5 100644 --- a/MbDCode/EndFrameqc.cpp +++ b/MbDCode/EndFrameqc.cpp @@ -2,6 +2,14 @@ using namespace MbD; -EndFrameqc::EndFrameqc() : EndFramec() +EndFrameqc::EndFrameqc() { + initialize(); +} + +EndFrameqc::EndFrameqc(const char* str) : EndFramec(str) { + initialize(); +} + +void EndFrameqc::initialize() { } diff --git a/MbDCode/EndFrameqc.cpp.bak b/MbDCode/EndFrameqc.cpp.bak new file mode 100644 index 0000000..b84300c --- /dev/null +++ b/MbDCode/EndFrameqc.cpp.bak @@ -0,0 +1,7 @@ +#include "EndFrameqc.h" + +using namespace MbD; + +EndFrameqc::EndFrameqc() : EndFramec() +{ +} diff --git a/MbDCode/EndFrameqc.h b/MbDCode/EndFrameqc.h index d4d41e0..524b2f5 100644 --- a/MbDCode/EndFrameqc.h +++ b/MbDCode/EndFrameqc.h @@ -11,6 +11,8 @@ namespace MbD { //prOeOpE pprOeOpEpE pAOepE ppAOepEpE public: EndFrameqc(); + EndFrameqc(const char* str); + void initialize(); FullMatDptr prOeOpE = std::make_shared>(3, 4); //std::shared_ptr>>> pprOeOpEpE = std::make_shared>>>(3, 4); std::shared_ptr>>> pAOepE = std::make_shared>>>(4); diff --git a/MbDCode/EndFrameqc.h.bak b/MbDCode/EndFrameqc.h.bak new file mode 100644 index 0000000..d4d41e0 --- /dev/null +++ b/MbDCode/EndFrameqc.h.bak @@ -0,0 +1,23 @@ +#pragma once +#include "EndFramec.h" +#include "FullColumn.h" +#include "FullMatrix.h" + +namespace MbD { + class EndFramec; + + class EndFrameqc : public EndFramec + { + //prOeOpE pprOeOpEpE pAOepE ppAOepEpE + public: + EndFrameqc(); + FullMatDptr prOeOpE = std::make_shared>(3, 4); + //std::shared_ptr>>> pprOeOpEpE = std::make_shared>>>(3, 4); + std::shared_ptr>>> pAOepE = std::make_shared>>>(4); + //std::shared_ptr>>> ppAOepEpE = std::make_shared>>>(4, 4); + //FullMatrix>* pprOeOpEpE1 = new FullMatrix>(3, 4); + //FullColumn>* pAOepE1 = new FullColumn>(4); + //FullMatrix>* ppAOepEpE1 = new FullMatrix>(4, 4); + }; +} + diff --git a/MbDCode/EndFrameqct.h b/MbDCode/EndFrameqct.h index 2e90cdd..4f12da6 100644 --- a/MbDCode/EndFrameqct.h +++ b/MbDCode/EndFrameqct.h @@ -1,8 +1,15 @@ #pragma once #include "EndFrameqc.h" + namespace MbD { class EndFrameqct : public EndFrameqc { + //time rmemBlks prmemptBlks pprmemptptBlks phiThePsiBlks pPhiThePsiptBlks ppPhiThePsiptptBlks + //rmem prmempt pprmemptpt aAme pAmept ppAmeptpt prOeOpt pprOeOpEpt pprOeOptpt pAOept ppAOepEpt ppAOeptpt + public: + double time; + FullColDptr rmem, prmempt, pprmemptpt; + FullMatDptr aAme, pAmept, ppAmeptpt; }; } diff --git a/MbDCode/EulerArray.cpp b/MbDCode/EulerArray.cpp new file mode 100644 index 0000000..067327f --- /dev/null +++ b/MbDCode/EulerArray.cpp @@ -0,0 +1 @@ +#include "EulerArray.h" diff --git a/MbDCode/EulerArray.h b/MbDCode/EulerArray.h new file mode 100644 index 0000000..05302c7 --- /dev/null +++ b/MbDCode/EulerArray.h @@ -0,0 +1,9 @@ +#pragma once +#include "FullColumn.h" + +namespace MbD { + class EulerArray : public FullColumn + { + }; +} + diff --git a/MbDCode/EulerConstraint.cpp b/MbDCode/EulerConstraint.cpp index f5f93e4..9bc40c0 100644 --- a/MbDCode/EulerConstraint.cpp +++ b/MbDCode/EulerConstraint.cpp @@ -1 +1,16 @@ #include "EulerConstraint.h" +#include "Item.h" + +using namespace MbD; + +EulerConstraint::EulerConstraint() +{ +} + +MbD::EulerConstraint::EulerConstraint(const char* str) : Constraint(str) +{ +} + +void MbD::EulerConstraint::initialize() +{ +} diff --git a/MbDCode/EulerConstraint.cpp.bak b/MbDCode/EulerConstraint.cpp.bak new file mode 100644 index 0000000..f08225b --- /dev/null +++ b/MbDCode/EulerConstraint.cpp.bak @@ -0,0 +1,12 @@ +#include "EulerConstraint.h" +#include "Constraint.h" + +using namespace MbD; + +EulerConstraint::EulerConstraint() +{ +} + +EulerConstraint::EulerConstraint(Item* item) : Constraint::Constraint(item) +{ +} diff --git a/MbDCode/EulerConstraint.h b/MbDCode/EulerConstraint.h index 04f65ab..a3e121a 100644 --- a/MbDCode/EulerConstraint.h +++ b/MbDCode/EulerConstraint.h @@ -6,14 +6,15 @@ #include "FullRow.h" namespace MbD { - class EulerConstraint : public Constraint { - public: - EulerConstraint() : Constraint() { - } //pGpE iqE - FullRow pGpE = FullRow(4); //partial derivative of G wrt pE + public: + EulerConstraint(); + EulerConstraint(const char* str); + void initialize(); + + FullRowDptr pGpE = std::make_shared>(4); //partial derivative of G wrt pE int iqE = -1; }; } diff --git a/MbDCode/EulerConstraint.h.bak b/MbDCode/EulerConstraint.h.bak new file mode 100644 index 0000000..c40dbf8 --- /dev/null +++ b/MbDCode/EulerConstraint.h.bak @@ -0,0 +1,20 @@ +#pragma once +#include +#include + +#include "Constraint.h" +#include "FullRow.h" + +namespace MbD { + class EulerConstraint : public Constraint + { + //pGpE iqE + public: + EulerConstraint(); + EulerConstraint(Item* item); + + FullRowDptr pGpE = std::make_shared>(4); //partial derivative of G wrt pE + int iqE = -1; + }; +} + diff --git a/MbDCode/EulerParameters.cpp b/MbDCode/EulerParameters.cpp new file mode 100644 index 0000000..dfac4f9 --- /dev/null +++ b/MbDCode/EulerParameters.cpp @@ -0,0 +1,95 @@ +#include + +#include "EulerParameters.h" +#include "FullColumn.h" +#include "FullMatrix.h" + +using namespace MbD; + +//typedef std::shared_ptr>>> FMatFColDptr; + +std::shared_ptr>>> EulerParameters::ppApEpEtimesColumn(FullColDptr col) +{ + double a2c1 = 2 * col->at(0); + double a2c2 = 2 * col->at(1); + double a2c3 = 2 * col->at(2); + double m2c1 = 0 - a2c1; + double m2c2 = 0 - a2c2; + double m2c3 = 0 - a2c3; + auto col11 = std::make_shared>(ListD{ a2c1, m2c2, m2c3 }); + auto col12 = std::make_shared>(ListD{ a2c2, a2c1, 0 }); + auto col13 = std::make_shared>(ListD{ a2c3, 0, a2c1 }); + auto col14 = std::make_shared>(ListD{ 0, m2c3, a2c2 }); + auto col22 = std::make_shared>(ListD{ m2c1, a2c2, m2c3 }); + auto col23 = std::make_shared>(ListD{ 0, a2c3, a2c2 }); + auto col24 = std::make_shared>(ListD{ a2c3, 0, m2c1 }); + auto col33 = std::make_shared>(ListD{ m2c1, m2c2, a2c3 }); + auto col34 = std::make_shared>(ListD{ m2c2, a2c1, 0 }); + auto col44 = std::make_shared>(ListD{ a2c1, a2c2, a2c3 }); + auto answer = std::make_shared>>>(4, 4); + auto row1 = answer->at(0); + row1->at(0) = col11; + row1->at(1) = col12; + row1->at(2) = col13; + row1->at(3) = col14; + auto row2 = answer->at(0); + row2->at(0) = col12; + row2->at(1) = col22; + row2->at(2) = col23; + row2->at(3) = col24; + auto row3 = answer->at(0); + row3->at(0) = col13; + row3->at(1) = col23; + row3->at(2) = col33; + row3->at(3) = col34; + auto row4 = answer->at(0); + row4->at(0) = col14; + row4->at(1) = col24; + row4->at(2) = col34; + row4->at(3) = col44; + return answer; +} + +std::shared_ptr>>> EulerParameters::ppApEpEtimesMatrix(FullMatDptr mat) +{ + FullRowDptr a2m1 = mat->at(0)->times(2.0); + FullRowDptr a2m2 = mat->at(1)->times(2.0); + FullRowDptr a2m3 = mat->at(2)->times(2.0); + FullRowDptr m2m1 = a2m1->negated(); + FullRowDptr m2m2 = a2m2->negated(); + FullRowDptr m2m3 = a2m3->negated(); + auto aaaa = std::make_shared>(3, 0.0); + FullRowDptr zero = std::make_shared>(3, 0.0); + auto mat11 = std::make_shared>(ListFRD{ a2m1, m2m2, m2m3 }); + auto mat12 = std::make_shared>(ListFRD{ a2m2, a2m1, zero }); + auto mat13 = std::make_shared>(ListFRD{ a2m3, zero, a2m1 }); + auto mat14 = std::make_shared>(ListFRD{ zero, m2m3, a2m2 }); + auto mat22 = std::make_shared>(ListFRD{ m2m1, a2m2, m2m3 }); + auto mat23 = std::make_shared>(ListFRD{ zero, a2m3, a2m2 }); + auto mat24 = std::make_shared>(ListFRD{ a2m3, zero, m2m1 }); + auto mat33 = std::make_shared>(ListFRD{ m2m1, m2m2, a2m3 }); + auto mat34 = std::make_shared>(ListFRD{ m2m2, a2m1, zero }); + auto mat44 = std::make_shared>(ListFRD{ a2m1, a2m2, a2m3 }); + auto answer = std::make_shared>>>(4, 4); + auto row1 = answer->at(0); + row1->at(0) = mat11; + row1->at(1) = mat12; + row1->at(2) = mat13; + row1->at(3) = mat14; + auto row2 = answer->at(0); + row2->at(0) = mat12; + row2->at(1) = mat22; + row2->at(2) = mat23; + row2->at(3) = mat24; + auto row3 = answer->at(0); + row3->at(0) = mat13; + row3->at(1) = mat23; + row3->at(2) = mat33; + row3->at(3) = mat34; + auto row4 = answer->at(0); + row4->at(0) = mat14; + row4->at(1) = mat24; + row4->at(2) = mat34; + row4->at(3) = mat44; + return answer; +} diff --git a/MbDCode/EulerParameters.h b/MbDCode/EulerParameters.h new file mode 100644 index 0000000..65b25dc --- /dev/null +++ b/MbDCode/EulerParameters.h @@ -0,0 +1,18 @@ +#pragma once +#include "EulerArray.h" +#include "FullColumn.h" +#include "FullMatrix.h" + +namespace MbD { + class EulerParameters : public EulerArray + { + //aA aB aC pApE + public: + static std::shared_ptr>>> ppApEpEtimesColumn(FullColDptr col); + static std::shared_ptr>>> ppApEpEtimesMatrix(FullMatDptr col); + + }; + + //typedef std::shared_ptr>>> FMatFColDptr; +} + diff --git a/MbDCode/FullColumn.h b/MbDCode/FullColumn.h index ec524e4..cc548de 100644 --- a/MbDCode/FullColumn.h +++ b/MbDCode/FullColumn.h @@ -10,7 +10,8 @@ namespace MbD { class FullColumn : public Vector { public: - FullColumn(int i) : Vector(i) {} + FullColumn(size_t count) : Vector(count) {} + FullColumn(size_t count, const T& value) : Vector(count, value) {} FullColumn(std::initializer_list list) : Vector{ list } {} std::string toString() { diff --git a/MbDCode/FullMatrix.h b/MbDCode/FullMatrix.h index 50e9461..5be785b 100644 --- a/MbDCode/FullMatrix.h +++ b/MbDCode/FullMatrix.h @@ -19,6 +19,12 @@ namespace MbD { this->push_back(row); } } + FullMatrix(std::initializer_list>> listOfRows) { + for (auto row : listOfRows) + { + this->push_back(row); + } + } FullMatrix(std::initializer_list> list2D) { for (auto rowList : list2D) { @@ -29,8 +35,10 @@ namespace MbD { }; typedef std::initializer_list> ListListD; + typedef std::initializer_list ListFRD; typedef std::shared_ptr> FullMatDptr; - //typedef std::shared_ptr>>> FullMatFCptr; - //typedef std::shared_ptr>>> FullMatFMptr; + //typedef std::shared_ptr>>> FMatFColDptr; + typedef std::shared_ptr>>> FMatFMatDptr; + } diff --git a/MbDCode/FullRow.h b/MbDCode/FullRow.h index 222e645..9204e7b 100644 --- a/MbDCode/FullRow.h +++ b/MbDCode/FullRow.h @@ -6,9 +6,29 @@ namespace MbD { { public: FullRow() {} - FullRow(int i) : Vector(i) {} + FullRow(size_t count) : Vector(count) {} + FullRow(size_t count, const T& value) : Vector(count, value) {} FullRow(std::initializer_list list) : Vector{ list } {} + std::shared_ptr> times(double a); + std::shared_ptr> negated(); + }; + typedef std::shared_ptr> FullRowDptr; + + template + inline std::shared_ptr> FullRow::times(double a) + { + size_t n = this->size(); + auto answer = std::make_shared(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) * a; + } + return answer; + } + template + inline std::shared_ptr> FullRow::negated() + { + return this->times(-1.0); + } } -typedef std::shared_ptr> FullRowDptr; diff --git a/MbDCode/IndependentVariable.cpp b/MbDCode/IndependentVariable.cpp new file mode 100644 index 0000000..01b48f8 --- /dev/null +++ b/MbDCode/IndependentVariable.cpp @@ -0,0 +1 @@ +#include "IndependentVariable.h" diff --git a/MbDCode/IndependentVariable.h b/MbDCode/IndependentVariable.h new file mode 100644 index 0000000..c5f6f2a --- /dev/null +++ b/MbDCode/IndependentVariable.h @@ -0,0 +1,9 @@ +#pragma once +#include "Variable.h" +namespace MbD { + class IndependentVariable : + public Variable + { + }; +} + diff --git a/MbDCode/Item.cpp b/MbDCode/Item.cpp index 07d7e84..b792fa1 100644 --- a/MbDCode/Item.cpp +++ b/MbDCode/Item.cpp @@ -1,21 +1,13 @@ #include "Item.h" -void MbD::Item::setName(std::string& str) +using namespace MbD; + +void Item::setName(std::string& str) { name = str; } -const std::string& MbD::Item::getName() const +const std::string& Item::getName() const { return name; } -// -//void MbD::Item::setMyInt(int val) -//{ -// myInt = val; -//} -// -//int MbD::Item::getMyInt() -//{ -// return myInt; -//} diff --git a/MbDCode/Item.h b/MbDCode/Item.h index a915708..473562a 100644 --- a/MbDCode/Item.h +++ b/MbDCode/Item.h @@ -1,10 +1,13 @@ #pragma once #include + namespace MbD { class Item { + //name public: Item() {} + Item(const char* str) : name(str) {} void setName(std::string& str); const std::string& getName() const; private: diff --git a/MbDCode/Item.h.bak b/MbDCode/Item.h.bak new file mode 100644 index 0000000..ef363d9 --- /dev/null +++ b/MbDCode/Item.h.bak @@ -0,0 +1,16 @@ +#pragma once +#include + +namespace MbD { + class Item + { + public: + Item() {} + Item(std::string str) : name(str) {} + void setName(std::string& str); + const std::string& getName() const; + private: + std::string name; + }; +} + diff --git a/MbDCode/Joint.cpp b/MbDCode/Joint.cpp index 18f2965..b35cb7c 100644 --- a/MbDCode/Joint.cpp +++ b/MbDCode/Joint.cpp @@ -1,6 +1,30 @@ #include "Joint.h" -MbD::Joint::Joint() -{ +using namespace MbD; +Joint::Joint() { + initialize(); +} + +Joint::Joint(const char* str) : Item(str) { + initialize(); +} + +void Joint::initialize() +{ + constraints = std::make_unique>>(); +} + +void Joint::connectsItoJ(std::shared_ptr frmi, std::shared_ptr frmj) +{ + frmI = frmi; + frmJ = frmj; +} + +void Joint::initializeLocally() +{ +} + +void Joint::initializeGlobally() +{ } diff --git a/MbDCode/Joint.cpp.bak b/MbDCode/Joint.cpp.bak new file mode 100644 index 0000000..c438f46 --- /dev/null +++ b/MbDCode/Joint.cpp.bak @@ -0,0 +1,22 @@ +#include "Joint.h" + +using namespace MbD; + +Joint::Joint() +{ + +} + +void Joint::connectsItoJ(std::shared_ptr frmi, std::shared_ptr frmj) +{ + frmI = frmi; + frmJ = frmj; +} + +void Joint::initializeLocally() +{ +} + +void Joint::initializeGlobally() +{ +} diff --git a/MbDCode/Joint.h b/MbDCode/Joint.h index b51d39d..ef4b1a9 100644 --- a/MbDCode/Joint.h +++ b/MbDCode/Joint.h @@ -15,9 +15,15 @@ namespace MbD { //frmI frmJ constraints friction public: Joint(); + Joint(const char* str); + void initialize(); + virtual void connectsItoJ(std::shared_ptr frmI, std::shared_ptr frmJ); + void initializeLocally(); + void initializeGlobally(); + std::shared_ptr frmI; std::shared_ptr frmJ; - std::vector> constraints; + std::unique_ptr>> constraints; }; } diff --git a/MbDCode/Joint.h.bak b/MbDCode/Joint.h.bak new file mode 100644 index 0000000..82d84ab --- /dev/null +++ b/MbDCode/Joint.h.bak @@ -0,0 +1,28 @@ +#pragma once +#include +#include + +#include "Item.h" +#include "EndFramec.h" +#include "Constraint.h" + +namespace MbD { + class EndFramec; + class Constraint; + + class Joint : public Item + { + //frmI frmJ constraints friction + public: + Joint(); + virtual void connectsItoJ(std::shared_ptr frmI, std::shared_ptr frmJ); + void initializeLocally(); + void initializeGlobally(); + + std::shared_ptr frmI; + std::shared_ptr frmJ; + std::unique_ptr>> constraints; + + }; +} + diff --git a/MbDCode/MarkerFrame.cpp b/MbDCode/MarkerFrame.cpp index eb17bd0..bb0341a 100644 --- a/MbDCode/MarkerFrame.cpp +++ b/MbDCode/MarkerFrame.cpp @@ -1,3 +1,4 @@ +#include "PartFrame.h" #include "MarkerFrame.h" #include "EndFramec.h" #include "EndFrameqc.h" @@ -5,11 +6,19 @@ using namespace MbD; MarkerFrame::MarkerFrame() +{ + initialize(); +} + +MbD::MarkerFrame::MarkerFrame(const char* str) : CartesianFrame(str) { + initialize(); +} + +void MbD::MarkerFrame::initialize() { partFrame = nullptr; - auto endFrm = std::make_shared(); - std::string str = "EndFrame1"; - endFrm->setName(str); + endFrames = std::make_unique>>(); + auto endFrm = std::make_shared("EndFrame1"); this->addEndFrame(endFrm); } @@ -18,6 +27,10 @@ void MarkerFrame::setPartFrame(PartFrame* partFrm) partFrame = partFrm; } +PartFrame* MarkerFrame::getPartFrame() { + return partFrame; +} + void MarkerFrame::setrpmp(FullColDptr x) { rpmp->copy(x); @@ -30,5 +43,5 @@ void MarkerFrame::setaApm(FullMatDptr x) void MarkerFrame::addEndFrame(std::shared_ptr endFrm) { endFrm->setMarkerFrame(this); - endFrames.push_back(endFrm); + endFrames->push_back(endFrm); } diff --git a/MbDCode/MarkerFrame.cpp.bak b/MbDCode/MarkerFrame.cpp.bak new file mode 100644 index 0000000..13d3ccc --- /dev/null +++ b/MbDCode/MarkerFrame.cpp.bak @@ -0,0 +1,37 @@ +#include "PartFrame.h" +#include "MarkerFrame.h" +#include "EndFramec.h" +#include "EndFrameqc.h" + +using namespace MbD; + +MarkerFrame::MarkerFrame() +{ + auto endFrm = std::make_shared(); + std::string str = "EndFrame1"; + endFrm->setName(str); + this->addEndFrame(endFrm); +} + +void MarkerFrame::setPartFrame(std::shared_ptr partFrm) +{ + partFrame = partFrm; +} + +std::shared_ptr MarkerFrame::getPartFrame() { + return partFrame.lock(); +} + +void MarkerFrame::setrpmp(FullColDptr x) +{ + rpmp->copy(x); +} + +void MarkerFrame::setaApm(FullMatDptr x) +{ + aApm->copy(x); +} +void MarkerFrame::addEndFrame(std::shared_ptr endFrm) +{ + endFrames->push_back(endFrm); +} diff --git a/MbDCode/MarkerFrame.h b/MbDCode/MarkerFrame.h index 2073f6e..aac4d6b 100644 --- a/MbDCode/MarkerFrame.h +++ b/MbDCode/MarkerFrame.h @@ -8,28 +8,31 @@ #include "EndFramec.h" namespace MbD { - class PartFrame; - class EndFramec; + class PartFrame; + class EndFramec; - class MarkerFrame : public CartesianFrame - { - //partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames - public: - MarkerFrame(); - void setPartFrame(PartFrame* partFrm); - void setrpmp(FullColDptr x); - void setaApm(FullMatDptr x); - void addEndFrame(std::shared_ptr x); + class MarkerFrame : public CartesianFrame + { + //partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames + public: + MarkerFrame(); + MarkerFrame(const char* str); + void initialize(); + void setPartFrame(PartFrame* partFrm); + PartFrame* getPartFrame(); + void setrpmp(FullColDptr x); + void setaApm(FullMatDptr x); + void addEndFrame(std::shared_ptr x); - PartFrame* partFrame; - FullColDptr rpmp = std::make_shared>(3); - FullMatDptr aApm = std::make_shared>(3, 3); - FullColDptr rOmO = std::make_shared>(3); - FullMatDptr aAOm = std::make_shared>(3, 3); - FullMatDptr prOmOpE = std::make_shared>(3, 4); - FullColumn>* pAOmpE = new FullColumn>(4); - std::vector> endFrames; + PartFrame* partFrame; + FullColDptr rpmp = std::make_shared>(3); + FullMatDptr aApm = std::make_shared>(3, 3); + FullColDptr rOmO = std::make_shared>(3); + FullMatDptr aAOm = std::make_shared>(3, 3); + FullMatDptr prOmOpE = std::make_shared>(3, 4); + FullColumn>* pAOmpE = new FullColumn>(4); + std::unique_ptr>> endFrames; - }; + }; } diff --git a/MbDCode/MarkerFrame.h.bak b/MbDCode/MarkerFrame.h.bak new file mode 100644 index 0000000..5b4f013 --- /dev/null +++ b/MbDCode/MarkerFrame.h.bak @@ -0,0 +1,36 @@ +#pragma once +#include + +#include "CartesianFrame.h" +#include "PartFrame.h" +#include "FullColumn.h" +#include "FullMatrix.h" +#include "EndFramec.h" + +namespace MbD { + class PartFrame; + class EndFramec; + + class MarkerFrame : public CartesianFrame + { + //partFrame rpmp aApm rOmO aAOm prOmOpE pAOmpE pprOmOpEpE ppAOmpEpE endFrames + public: + MarkerFrame(); + void setPartFrame(std::shared_ptr partFrm); + std::shared_ptr getPartFrame(); + void setrpmp(FullColDptr x); + void setaApm(FullMatDptr x); + void addEndFrame(std::shared_ptr x); + + std::weak_ptr partFrame; + FullColDptr rpmp = std::make_shared>(3); + FullMatDptr aApm = std::make_shared>(3, 3); + FullColDptr rOmO = std::make_shared>(3); + FullMatDptr aAOm = std::make_shared>(3, 3); + FullMatDptr prOmOpE = std::make_shared>(3, 4); + FullColumn>* pAOmpE = new FullColumn>(4); + std::unique_ptr>> endFrames; + + }; +} + diff --git a/MbDCode/MbDCode.cpp b/MbDCode/MbDCode.cpp index a787591..f453f8d 100644 --- a/MbDCode/MbDCode.cpp +++ b/MbDCode/MbDCode.cpp @@ -1,4 +1,10 @@ -#include +/********************************************************************* + * @file MbDCode.cpp + * + * @brief Program to assemble a piston crank system. + *********************************************************************/ + +#include #include "System.h" #include "FullColumn.h" #include "FullMatrix.h" @@ -7,6 +13,7 @@ #include "CylindricalJoint.h" #include "RevoluteJoint.h" #include "ZRotation.h" +#include "EndFrameqc.h" #include "MbDCode.h" using namespace MbD; @@ -14,10 +21,10 @@ using namespace MbD; int main() { std::cout << "Hello World!\n"; - System& TheSystem = System::getInstance(); - std::string str = "TheSystem"; - TheSystem.setName(str); + //System& TheSystem = System::getInstance(); + System& TheSystem = System::getInstance("TheSystem"); std::cout << "TheSystem.getName() " << TheSystem.getName() << std::endl; + std::string str; FullColDptr qX, qE; FullColDptr rpmp; FullMatDptr aApm; @@ -26,9 +33,7 @@ int main() fullRow = std::make_shared>(4); fullRow->copy(row); // - auto assembly1 = std::make_shared(); - str = "Assembly1"; - assembly1->setName(str); + auto assembly1 = std::make_shared("Assembly1"); std::cout << "assembly1->getName() " << assembly1->getName() << std::endl; qX = std::make_shared>(ListD{ 0, 0, 0 }); qE = std::make_shared>(ListD{ 0, 0, 0, 1 }); @@ -38,9 +43,8 @@ int main() std::cout << "assembly1->getqE() " << assembly1->getqE()->toString() << std::endl; TheSystem.addPart(assembly1); { - auto marker1 = std::make_shared(); - str = "Marker1"; - marker1->setName(str); + auto partFrame = assembly1->partFrame; + auto marker1 = std::make_shared("Marker1"); rpmp = std::make_shared>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 }); marker1->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -49,11 +53,9 @@ int main() { 0, -1, 0 } }); marker1->setaApm(aApm); - assembly1->partFrame->addMarkerFrame(marker1); + partFrame->addMarkerFrame(marker1); // - auto marker2 = std::make_shared(); - str = "Marker2"; - marker2->setName(str); + auto marker2 = std::make_shared("Marker2"); rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); marker2->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -62,21 +64,18 @@ int main() { 0, 0, 1 } }); marker2->setaApm(aApm); - assembly1->partFrame->addMarkerFrame(marker2); + partFrame->addMarkerFrame(marker2); } // - auto part1 = std::make_shared(); - str = "Part1"; - part1->setName(str); + auto part1 = std::make_shared("Part1"); qX = std::make_shared>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 1.4248456266393e-10, 1.0 }); part1->setqX(qX); part1->setqE(qE); - TheSystem.parts.push_back(part1); + TheSystem.parts->push_back(part1); { - auto marker1 = std::make_shared(); - str = "Marker1"; - marker1->setName(str); + auto partFrame = part1->partFrame; + auto marker1 = std::make_shared("Marker1"); rpmp = std::make_shared>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); marker1->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -85,11 +84,9 @@ int main() { 0, 0, 1 } }); marker1->setaApm(aApm); - part1->partFrame->addMarkerFrame(marker1); + partFrame->addMarkerFrame(marker1); // - auto marker2 = std::make_shared(); - str = "Marker2"; - marker2->setName(str); + auto marker2 = std::make_shared("Marker2"); rpmp = std::make_shared>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); marker2->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -98,21 +95,18 @@ int main() { 0, 0, 1 } }); marker2->setaApm(aApm); - part1->partFrame->addMarkerFrame(marker2); + partFrame->addMarkerFrame(marker2); } // - auto part2 = std::make_shared(); - str = "Part2"; - part2->setName(str); + auto part2 = std::make_shared("Part2"); qX = std::make_shared>(ListD{ 0.38423366582893, 0.49215308269277, 0.048029210642807 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 }); part2->setqX(qX); part2->setqE(qE); - TheSystem.parts.push_back(part2); + TheSystem.parts->push_back(part2); { - auto marker1 = std::make_shared(); - str = "Marker1"; - marker1->setName(str); + auto partFrame = part2->partFrame; + auto marker1 = std::make_shared("Marker1"); rpmp = std::make_shared>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 }); marker1->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -121,11 +115,9 @@ int main() {0.0, 0.0, 1.0} }); marker1->setaApm(aApm); - part2->partFrame->addMarkerFrame(marker1); + partFrame->addMarkerFrame(marker1); // - auto marker2 = std::make_shared(); - str = "Marker2"; - marker2->setName(str); + auto marker2 = std::make_shared("Marker2"); rpmp = std::make_shared>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 }); marker2->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -134,21 +126,18 @@ int main() {-2.2204460492503e-16, -4.1633363423443e-17, 1.0} }); marker2->setaApm(aApm); - part2->partFrame->addMarkerFrame(marker2); + partFrame->addMarkerFrame(marker2); } // - auto part3 = std::make_shared(); - str = "Part3"; - part3->setName(str); + auto part3 = std::make_shared("Part3"); qX = std::make_shared>(ListD{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 }); qE = std::make_shared>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 }); part3->setqX(qX); part3->setqE(qE); - TheSystem.parts.push_back(part3); + TheSystem.parts->push_back(part3); { - auto marker1 = std::make_shared(); - str = "Marker1"; - marker1->setName(str); + auto partFrame = part3->partFrame; + auto marker1 = std::make_shared("Marker1"); rpmp = std::make_shared>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 }); marker1->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -157,11 +146,9 @@ int main() {-1.0785207688569e-32, 2.2204460492503e-16, -1.0} }); marker1->setaApm(aApm); - part3->partFrame->addMarkerFrame(marker1); + partFrame->addMarkerFrame(marker1); // - auto marker2 = std::make_shared(); - str = "Marker2"; - marker2->setName(str); + auto marker2 = std::make_shared("Marker2"); rpmp = std::make_shared>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 }); marker2->setrpmp(rpmp); aApm = std::make_shared>(ListListD{ @@ -170,12 +157,28 @@ int main() {-6.9388939039072e-18, 1.0, -7.4837411882581e-50} }); marker2->setaApm(aApm); - part3->partFrame->addMarkerFrame(marker2); + partFrame->addMarkerFrame(marker2); } // - auto cylJoint4 = std::shared_ptr(); - auto revJoint3 = std::shared_ptr(); - auto revJoint2 = std::shared_ptr(); - auto revJoint1 = std::shared_ptr(); - auto rotMotion1 = std::shared_ptr(); + auto cylJoint4 = std::make_shared("CylJoint4"); + cylJoint4->connectsItoJ(part3->partFrame->endFrame("Marker2"), assembly1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(cylJoint4); + + auto revJoint3 = std::make_shared("RevJoint3"); + revJoint3->connectsItoJ(part2->partFrame->endFrame("Marker2"), part3->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint3); + + auto revJoint2 = std::make_shared("RevJoint2"); + revJoint2->connectsItoJ(part1->partFrame->endFrame("Marker2"), part2->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint2); + + auto revJoint1 = std::make_shared("RevJoint1"); + revJoint1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint1); + + auto rotMotion1 = std::make_shared("RotMotion1"); + rotMotion1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(rotMotion1); + // + TheSystem.runKINEMATICS(); } \ No newline at end of file diff --git a/MbDCode/MbDCode.cpp.bak b/MbDCode/MbDCode.cpp.bak new file mode 100644 index 0000000..5031e6f --- /dev/null +++ b/MbDCode/MbDCode.cpp.bak @@ -0,0 +1,240 @@ +/********************************************************************* + * @file MbDCode.cpp + * + * @brief Program to assemble a piston crank system. + *********************************************************************/ + +#include +#include "System.h" +#include "FullColumn.h" +#include "FullMatrix.h" +#include "Part.h" +#include "Joint.h" +#include "CylindricalJoint.h" +#include "RevoluteJoint.h" +#include "ZRotation.h" +#include "EndFrameqc.h" +#include "MbDCode.h" + +using namespace MbD; + +int main() +{ + std::cout << "Hello World!\n"; + //System& TheSystem = System::getInstance(); + System& TheSystem = System::getInstance("TheSystem"); + std::cout << "TheSystem.getName() " << TheSystem.getName() << std::endl; + std::string str; + FullColDptr qX, qE; + FullColDptr rpmp; + FullMatDptr aApm; + FullRowDptr fullRow; + auto row = std::make_shared>(ListD{ 0.0, 0.0, 0.0, 1.0 }); + fullRow = std::make_shared>(4); + fullRow->copy(row); + // + auto assembly1 = std::make_shared(); + str = "Assembly1"; + assembly1->setName(str); + std::cout << "assembly1->getName() " << assembly1->getName() << std::endl; + qX = std::make_shared>(ListD{ 0, 0, 0 }); + qE = std::make_shared>(ListD{ 0, 0, 0, 1 }); + assembly1->setqX(qX); + assembly1->setqE(qE); + std::cout << "assembly1->getqX() " << assembly1->getqX()->toString() << std::endl; + std::cout << "assembly1->getqE() " << assembly1->getqE()->toString() << std::endl; + TheSystem.addPart(assembly1); + { + auto partFrame = assembly1->partFrame; + auto marker1 = std::make_shared(); + str = "Marker1"; + marker1->setName(str); + rpmp = std::make_shared>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 }); + marker1->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + { 1, 0, 0 }, + { 0, 0, 1 }, + { 0, -1, 0 } + }); + marker1->setaApm(aApm); + auto endFrame1 = std::make_shared(); + endFrame1->setMarkerFrame(marker1); + marker1->addEndFrame(endFrame1); + marker1->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker1); + // + auto marker2 = std::make_shared(); + str = "Marker2"; + marker2->setName(str); + rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); + marker2->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }); + marker2->setaApm(aApm); + auto endFrame2 = std::make_shared(); + endFrame2->setMarkerFrame(marker2); + marker2->addEndFrame(endFrame2); + marker2->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker2); + } + // + auto part1 = std::make_shared(); + str = "Part1"; + part1->setName(str); + qX = std::make_shared>(ListD{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 }); + qE = std::make_shared>(ListD{ 0.0, 0.0, 1.4248456266393e-10, 1.0 }); + part1->setqX(qX); + part1->setqE(qE); + TheSystem.parts->push_back(part1); + { + auto partFrame = part1->partFrame; + auto marker1 = std::make_shared(); + str = "Marker1"; + marker1->setName(str); + rpmp = std::make_shared>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); + marker1->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }); + marker1->setaApm(aApm); + auto endFrame1 = std::make_shared(); + endFrame1->setMarkerFrame(marker1); + marker1->addEndFrame(endFrame1); + marker1->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker1); + // + auto marker2 = std::make_shared(); + str = "Marker2"; + marker2->setName(str); + rpmp = std::make_shared>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); + marker2->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + { 1, 0, 0 }, + { 0, 1, 0 }, + { 0, 0, 1 } + }); + marker2->setaApm(aApm); + auto endFrame2 = std::make_shared(); + endFrame2->setMarkerFrame(marker2); + marker2->addEndFrame(endFrame2); + marker2->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker2); + } + // + auto part2 = std::make_shared(); + str = "Part2"; + part2->setName(str); + qX = std::make_shared>(ListD{ 0.38423366582893, 0.49215308269277, 0.048029210642807 }); + qE = std::make_shared>(ListD{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 }); + part2->setqX(qX); + part2->setqE(qE); + TheSystem.parts->push_back(part2); + { + auto partFrame = part2->partFrame; + auto marker1 = std::make_shared(); + str = "Marker1"; + marker1->setName(str); + rpmp = std::make_shared>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 }); + marker1->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + {1.0, 2.7755575615629e-16, 0.0}, + {-2.7755575615629e-16, 1.0, 0.0}, + {0.0, 0.0, 1.0} + }); + marker1->setaApm(aApm); + auto endFrame1 = std::make_shared(); + endFrame1->setMarkerFrame(marker1); + marker1->addEndFrame(endFrame1); + marker1->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker1); + // + auto marker2 = std::make_shared(); + str = "Marker2"; + marker2->setName(str); + rpmp = std::make_shared>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 }); + marker2->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + {1.0, 2.4980018054066e-16, 2.2204460492503e-16}, + {-2.4980018054066e-16, 1.0, 4.1633363423443e-17}, + {-2.2204460492503e-16, -4.1633363423443e-17, 1.0} + }); + marker2->setaApm(aApm); + auto endFrame2 = std::make_shared(); + endFrame2->setMarkerFrame(marker2); + marker2->addEndFrame(endFrame2); + marker2->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker2); + } + // + auto part3 = std::make_shared(); + str = "Part3"; + part3->setName(str); + qX = std::make_shared>(ListD{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 }); + qE = std::make_shared>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 }); + part3->setqX(qX); + part3->setqE(qE); + TheSystem.parts->push_back(part3); + { + auto partFrame = part3->partFrame; + auto marker1 = std::make_shared(); + str = "Marker1"; + marker1->setName(str); + rpmp = std::make_shared>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 }); + marker1->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + {9.2444637330587e-33, 1.0, 2.2204460492503e-16}, + {1.0, -9.2444637330587e-33, -1.0785207688569e-32}, + {-1.0785207688569e-32, 2.2204460492503e-16, -1.0} + }); + marker1->setaApm(aApm); + auto endFrame1 = std::make_shared(); + endFrame1->setMarkerFrame(marker1); + marker1->addEndFrame(endFrame1); + marker1->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker1); + // + auto marker2 = std::make_shared(); + str = "Marker2"; + marker2->setName(str); + rpmp = std::make_shared>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 }); + marker2->setrpmp(rpmp); + aApm = std::make_shared>(ListListD{ + {6.9388939039072e-18, -6.4146353042213e-50, 1.0}, + {1.0, -6.9388939039072e-18, 6.9388939039072e-18}, + {-6.9388939039072e-18, 1.0, -7.4837411882581e-50} + }); + marker2->setaApm(aApm); + auto endFrame2 = std::make_shared(); + endFrame2->setMarkerFrame(marker2); + marker2->addEndFrame(endFrame2); + marker2->setPartFrame(partFrame); + partFrame->addMarkerFrame(marker2); + } + // + auto cylJoint4 = std::make_shared(); + cylJoint4->connectsItoJ(part3->partFrame->endFrame("Marker2"), assembly1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(cylJoint4); + + auto revJoint3 = std::make_shared(); + revJoint3->connectsItoJ(part2->partFrame->endFrame("Marker2"), part3->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint3); + + auto revJoint2 = std::make_shared(); + revJoint2->connectsItoJ(part1->partFrame->endFrame("Marker2"), part2->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint2); + + auto revJoint1 = std::make_shared(); + revJoint1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(revJoint1); + + auto rotMotion1 = std::make_shared(); + rotMotion1->connectsItoJ(assembly1->partFrame->endFrame("Marker2"), part1->partFrame->endFrame("Marker1")); + TheSystem.jointsMotions->push_back(rotMotion1); + // + TheSystem.runKINEMATICS(); +} \ No newline at end of file diff --git a/MbDCode/MbDCode.vcxproj b/MbDCode/MbDCode.vcxproj index 3dbf57b..5d578e7 100644 --- a/MbDCode/MbDCode.vcxproj +++ b/MbDCode/MbDCode.vcxproj @@ -136,10 +136,13 @@ + + + @@ -155,8 +158,12 @@ + + + + @@ -170,10 +177,13 @@ + + + @@ -189,8 +199,12 @@ + + + + diff --git a/MbDCode/MbDCode.vcxproj.filters b/MbDCode/MbDCode.vcxproj.filters index 34fa30a..7fc0f3d 100644 --- a/MbDCode/MbDCode.vcxproj.filters +++ b/MbDCode/MbDCode.vcxproj.filters @@ -111,6 +111,27 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -209,5 +230,26 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + \ No newline at end of file diff --git a/MbDCode/Part.cpp b/MbDCode/Part.cpp index 24b03eb..0d60e8b 100644 --- a/MbDCode/Part.cpp +++ b/MbDCode/Part.cpp @@ -5,26 +5,44 @@ using namespace MbD; Part::Part() { + initialize(); +} + +Part::Part(const char* str) : Item(str) { + initialize(); +} + +void Part::initialize() +{ partFrame = std::make_shared(); + partFrame->setPart(this); } void Part::setqX(FullColDptr x) { - partFrame.get()->setqX(x); + partFrame->setqX(x); } FullColDptr Part::getqX() { - return partFrame.get()->getqX(); + return partFrame->getqX(); } void Part::setqE(FullColDptr x) { - partFrame.get()->setqE(x); + partFrame->setqE(x); } FullColDptr Part::getqE() { - return partFrame.get()->getqE(); + return partFrame->getqE(); } void Part::setSystem(System& sys) { //May be needed in the future } + +void Part::initializeLocally() +{ +} + +void Part::initializeGlobally() +{ +} diff --git a/MbDCode/Part.cpp.bak b/MbDCode/Part.cpp.bak new file mode 100644 index 0000000..21342a0 --- /dev/null +++ b/MbDCode/Part.cpp.bak @@ -0,0 +1,38 @@ +#include "Part.h" +#include "PartFrame.h" +#include "FullColumn.h" + +using namespace MbD; + +Part::Part() { + partFrame = std::make_shared(this); +} + +void Part::setqX(FullColDptr x) { + partFrame.get()->setqX(x); +} + +FullColDptr Part::getqX() { + return partFrame.get()->getqX(); +} + +void Part::setqE(FullColDptr x) { + partFrame.get()->setqE(x); +} + +FullColDptr Part::getqE() { + return partFrame.get()->getqE(); +} + +void Part::setSystem(System& sys) +{ + //May be needed in the future +} + +void Part::initializeLocally() +{ +} + +void Part::initializeGlobally() +{ +} diff --git a/MbDCode/Part.h b/MbDCode/Part.h index 188014b..b150aef 100644 --- a/MbDCode/Part.h +++ b/MbDCode/Part.h @@ -15,11 +15,16 @@ namespace MbD { //ToDo: ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot public: Part(); + Part(const char* str); + void initialize(); void setqX(FullColDptr x); FullColDptr getqX(); void setqE(FullColDptr x); FullColDptr getqE(); void setSystem(System& sys); + void initializeLocally(); + void initializeGlobally(); + std::shared_ptr partFrame; }; } diff --git a/MbDCode/Part.h.bak b/MbDCode/Part.h.bak new file mode 100644 index 0000000..a8d66f3 --- /dev/null +++ b/MbDCode/Part.h.bak @@ -0,0 +1,29 @@ +#pragma once +#include + +#include "Item.h" +#include "System.h" +#include "PartFrame.h" +#include "FullColumn.h" + +namespace MbD { + class System; + class PartFrame; + + class Part : public Item + { + //ToDo: ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot + public: + Part(); + void setqX(FullColDptr x); + FullColDptr getqX(); + void setqE(FullColDptr x); + FullColDptr getqE(); + void setSystem(System& sys); + void initializeLocally(); + void initializeGlobally(); + + std::shared_ptr partFrame; + }; +} + diff --git a/MbDCode/PartFrame.cpp b/MbDCode/PartFrame.cpp index baf62a9..e13094a 100644 --- a/MbDCode/PartFrame.cpp +++ b/MbDCode/PartFrame.cpp @@ -1,5 +1,6 @@ #include "Part.h" #include "PartFrame.h" +#include "EulerConstraint.h" #include "AbsConstraint.h" #include "MarkerFrame.h" @@ -7,9 +8,16 @@ using namespace MbD; PartFrame::PartFrame() { - aGeu = std::make_shared(); - aGabs = std::vector>(); - markerFrames = std::vector>(); + aGeu = std::make_shared("EulerCon"); + aGeu->setOwner(this); + aGabs = std::make_unique>>(); + markerFrames = std::make_unique>>(); +} +MbD::PartFrame::PartFrame(const char* str) : CartesianFrame(str) +{ +} +void MbD::PartFrame::initialize() +{ } void PartFrame::setqX(FullColDptr x) { qX->copy(x); @@ -23,15 +31,21 @@ void PartFrame::setqE(FullColDptr x) { FullColDptr PartFrame::getqE() { return qE; } -void PartFrame::setPart(std::shared_ptr x) { +void PartFrame::setPart(Part* x) { part = x; } -std::shared_ptr PartFrame::getPart() { - return part.lock(); +Part* PartFrame::getPart() { + return part; } -void MbD::PartFrame::addMarkerFrame(std::shared_ptr markerFrame) +void PartFrame::addMarkerFrame(std::shared_ptr markerFrame) { markerFrame->setPartFrame(this); - markerFrames.push_back(markerFrame); + markerFrames->push_back(markerFrame); +} + +std::shared_ptr PartFrame::endFrame(std::string name) +{ + auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](auto mkr) {return mkr->getName() == name; }); + return (*match)->endFrames->at(0); } diff --git a/MbDCode/PartFrame.cpp.bak b/MbDCode/PartFrame.cpp.bak new file mode 100644 index 0000000..31419b1 --- /dev/null +++ b/MbDCode/PartFrame.cpp.bak @@ -0,0 +1,52 @@ +#include "Part.h" +#include "PartFrame.h" +#include "EulerConstraint.h" +#include "AbsConstraint.h" +#include "MarkerFrame.h" + +using namespace MbD; + +PartFrame::PartFrame() +{ + aGeu = std::make_shared("EulerCon"); + aGeu->setOwner(this); + aGabs = std::make_unique>>(); + markerFrames = std::make_unique>>(); +} +MbD::PartFrame::PartFrame(const char* str) : CartesianFrame(str) +{ +} +void MbD::PartFrame::initialize() +{ +} +void PartFrame::setqX(FullColDptr x) { + qX->copy(x); +} +FullColDptr PartFrame::getqX() { + return qX; +} +void PartFrame::setqE(FullColDptr x) { + qE->copy(x); +} +FullColDptr PartFrame::getqE() { + return qE; +} +void PartFrame::setPart(Part* x) { + part = x; +} +Part* PartFrame::getPart() { + return part; +} + +void PartFrame::addMarkerFrame(std::shared_ptr markerFrame) +{ + markerFrames->push_back(markerFrame); +} + +std::shared_ptr PartFrame::endFrame(std::string name) +{ + auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](std::shared_ptr mkr) {return mkr->endFrames->at(0)->getName() == name; }); + //auto match = std::find_if(markerFrames->begin(), markerFrames->end(), [&](std::shared_ptr mkr) {return mkr->getName() == name; }); + + return (*match)->endFrames->at(0); +} diff --git a/MbDCode/PartFrame.h b/MbDCode/PartFrame.h index d4a29fe..e7b3f26 100644 --- a/MbDCode/PartFrame.h +++ b/MbDCode/PartFrame.h @@ -5,6 +5,7 @@ #include "CartesianFrame.h" #include "Part.h" #include "MarkerFrame.h" +#include "EndFramec.h" #include "EulerConstraint.h" #include "AbsConstraint.h" #include "FullColumn.h" @@ -12,28 +13,32 @@ namespace MbD { class Part; class MarkerFrame; + class EndFramec; class PartFrame : public CartesianFrame { //ToDo: part iqX iqE qX qE qXdot qEdot qXddot qEddot aGeu aGabs markerFrames public: PartFrame(); + PartFrame(const char* str); + void initialize(); void setqX(FullColDptr x); FullColDptr getqX(); void setqE(FullColDptr x); FullColDptr getqE(); - void setPart(std::shared_ptr x); - std::shared_ptr getPart(); + void setPart(Part* x); + Part* getPart(); void addMarkerFrame(std::shared_ptr x); + std::shared_ptr endFrame(std::string name); - std::weak_ptr part; + Part* part; int iqX, iqE; //Position index of frame variables qX and qE in system list of variables FullColDptr qX = std::make_shared>(3); FullColDptr qE = std::make_shared>(4); std::shared_ptr aGeu; - std::vector> aGabs; - std::vector> markerFrames; + std::unique_ptr>> aGabs; + std::unique_ptr>> markerFrames; }; } diff --git a/MbDCode/PrescribedMotion.cpp b/MbDCode/PrescribedMotion.cpp index 45370a0..c4782e1 100644 --- a/MbDCode/PrescribedMotion.cpp +++ b/MbDCode/PrescribedMotion.cpp @@ -1 +1,31 @@ +#include +#include +#include + #include "PrescribedMotion.h" +#include "EndFrameqct.h" + +using namespace MbD; + +PrescribedMotion::PrescribedMotion() { + initialize(); +} + +PrescribedMotion::PrescribedMotion(const char* str) : Joint(str) { + initialize(); +} + +void PrescribedMotion::initialize() +{ +} + +void PrescribedMotion::connectsItoJ(std::shared_ptr frmi, std::shared_ptr frmj) +{ + Joint::connectsItoJ(frmi, frmj); + if (typeid(frmI).name() != "EndFrameqct") { + std::shared_ptr newFrmI; + newFrmI = std::make_shared(); + std::swap(frmI, newFrmI); + assert(typeid(frmI).name() != "EndFrameqct"); + } +} diff --git a/MbDCode/PrescribedMotion.cpp.bak b/MbDCode/PrescribedMotion.cpp.bak new file mode 100644 index 0000000..77bdb3f --- /dev/null +++ b/MbDCode/PrescribedMotion.cpp.bak @@ -0,0 +1,19 @@ +#include +#include +#include + +#include "PrescribedMotion.h" +#include "EndFrameqct.h" + +using namespace MbD; + +void PrescribedMotion::connectsItoJ(std::shared_ptr frmi, std::shared_ptr frmj) +{ + Joint::connectsItoJ(frmi, frmj); + if (typeid(frmI).name() != "EndFrameqct") { + std::shared_ptr newFrmI; + newFrmI = std::make_shared(); + std::swap(frmI, newFrmI); + assert(typeid(frmI).name() != "EndFrameqct"); + } +} diff --git a/MbDCode/PrescribedMotion.h b/MbDCode/PrescribedMotion.h index ff112c3..cd866fc 100644 --- a/MbDCode/PrescribedMotion.h +++ b/MbDCode/PrescribedMotion.h @@ -4,6 +4,12 @@ namespace MbD { class PrescribedMotion : public Joint { + //xBlk yBlk zBlk phiBlk theBlk psiBlk + public: + PrescribedMotion(); + PrescribedMotion(const char* str); + void initialize(); + void connectsItoJ(std::shared_ptr frmI, std::shared_ptr frmJ) override; }; } diff --git a/MbDCode/PrescribedMotion.h.bak b/MbDCode/PrescribedMotion.h.bak new file mode 100644 index 0000000..8ce12b4 --- /dev/null +++ b/MbDCode/PrescribedMotion.h.bak @@ -0,0 +1,11 @@ +#pragma once +#include "Joint.h" + +namespace MbD { + class PrescribedMotion : public Joint + { + public: + void connectsItoJ(std::shared_ptr frmI, std::shared_ptr frmJ) override; + }; +} + diff --git a/MbDCode/RevoluteJoint.cpp b/MbDCode/RevoluteJoint.cpp index 1e728ca..8812ea4 100644 --- a/MbDCode/RevoluteJoint.cpp +++ b/MbDCode/RevoluteJoint.cpp @@ -1 +1,15 @@ #include "RevoluteJoint.h" + +using namespace MbD; + +RevoluteJoint::RevoluteJoint() { + initialize(); +} + +RevoluteJoint::RevoluteJoint(const char* str) : Joint(str) { + initialize(); +} + +void RevoluteJoint::initialize() +{ +} diff --git a/MbDCode/RevoluteJoint.cpp.bak b/MbDCode/RevoluteJoint.cpp.bak new file mode 100644 index 0000000..1e728ca --- /dev/null +++ b/MbDCode/RevoluteJoint.cpp.bak @@ -0,0 +1 @@ +#include "RevoluteJoint.h" diff --git a/MbDCode/RevoluteJoint.h b/MbDCode/RevoluteJoint.h index e6b94ac..7a9705a 100644 --- a/MbDCode/RevoluteJoint.h +++ b/MbDCode/RevoluteJoint.h @@ -3,6 +3,11 @@ namespace MbD { class RevoluteJoint : public Joint { + // + public: + RevoluteJoint(); + RevoluteJoint(const char* str); + void initialize(); }; } diff --git a/MbDCode/RevoluteJoint.h.bak b/MbDCode/RevoluteJoint.h.bak new file mode 100644 index 0000000..e6b94ac --- /dev/null +++ b/MbDCode/RevoluteJoint.h.bak @@ -0,0 +1,8 @@ +#pragma once +#include "Joint.h" +namespace MbD { + class RevoluteJoint : public Joint + { + }; +} + diff --git a/MbDCode/SparseMatrix.h b/MbDCode/SparseMatrix.h index eaf1303..017a6d9 100644 --- a/MbDCode/SparseMatrix.h +++ b/MbDCode/SparseMatrix.h @@ -15,8 +15,8 @@ namespace MbD { } } }; + typedef std::shared_ptr> SpMatDptr; + typedef std::initializer_list>> ListListPairD; } -typedef std::shared_ptr> SpMatDptr; -typedef std::initializer_list>> ListListPairD; diff --git a/MbDCode/SparseRow.h b/MbDCode/SparseRow.h index 58c3689..3d7e0f8 100644 --- a/MbDCode/SparseRow.h +++ b/MbDCode/SparseRow.h @@ -13,6 +13,6 @@ namespace MbD { SparseRow(std::initializer_list> list) : SparseVector{ list } {} SparseRow(std::initializer_list> list) : SparseVector{ list } {} }; + typedef std::shared_ptr> SpRowDptr; } -typedef std::shared_ptr> SpRowDptr; diff --git a/MbDCode/Symbolic.cpp b/MbDCode/Symbolic.cpp new file mode 100644 index 0000000..07d21ec --- /dev/null +++ b/MbDCode/Symbolic.cpp @@ -0,0 +1 @@ +#include "Symbolic.h" diff --git a/MbDCode/Symbolic.h b/MbDCode/Symbolic.h new file mode 100644 index 0000000..d916207 --- /dev/null +++ b/MbDCode/Symbolic.h @@ -0,0 +1,7 @@ +#pragma once +namespace MbD { + class Symbolic + { + }; +} + diff --git a/MbDCode/System.cpp b/MbDCode/System.cpp index 2b8744e..840fea9 100644 --- a/MbDCode/System.cpp +++ b/MbDCode/System.cpp @@ -1,15 +1,64 @@ +#include + #include "System.h" -void MbD::System::addPart(std::shared_ptr part) -{ - part->setSystem(*this); - parts.push_back(part); +using namespace MbD; + +System::System() { + time = std::make_unique