WIP: Third commit with EndFramec issue
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
@@ -9,10 +10,10 @@ namespace MbD {
|
||||
Array(){}
|
||||
Array(int i) : std::vector<T>(i) {}
|
||||
Array(std::initializer_list<T> list) : std::vector<T>{ list } {}
|
||||
void copy(Array<T>* x);
|
||||
void copy(std::shared_ptr<Array<T>> x);
|
||||
};
|
||||
template<typename T>
|
||||
inline void Array<T>::copy(Array<T>* x)
|
||||
inline void Array<T>::copy(std::shared_ptr<Array<T>> x)
|
||||
{
|
||||
for (int i = 0; i < x->size(); i++) {
|
||||
this->at(i) = x->at(i);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MbD {
|
||||
|
||||
MarkerFrame* markerFrame;
|
||||
FullColumn<double>* rOeO = new FullColumn<double>(3);
|
||||
FullMatrix<double>* aAOe = new FullMatrix<double>(3, 3);
|
||||
FullMatDptr aAOe = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
#include "FullMatrix.h"
|
||||
|
||||
namespace MbD {
|
||||
class EndFramec;
|
||||
|
||||
class EndFrameqc : public EndFramec
|
||||
{
|
||||
//prOeOpE pprOeOpEpE pAOepE ppAOepEpE
|
||||
public:
|
||||
EndFrameqc();
|
||||
FullMatrix<double>* prOeOpE = new FullMatrix<double>(3, 4);
|
||||
FullMatDptr prOeOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullMatrix<FullColumn<double>>* pprOeOpEpE = new FullMatrix<FullColumn<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOepE = new FullColumn<FullMatrix<double>>(4);
|
||||
FullMatrix<FullMatrix<double>>* ppAOepEpE = new FullMatrix<FullMatrix<double>>(4, 4);
|
||||
|
||||
@@ -12,3 +12,4 @@ namespace MbD {
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullColumn<double>> FullColDptr;
|
||||
|
||||
@@ -4,7 +4,7 @@ using namespace MbD;
|
||||
|
||||
FullMatrix<double>::FullMatrix(int m, int n) {
|
||||
for (int i = 0; i < m; i++) {
|
||||
auto* row = new FullRow<double>(n);
|
||||
auto row = std::make_shared<FullRow<double>>(n);
|
||||
this->push_back(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
class FullMatrix : public RowTypeMatrix<FullRow<T>*>
|
||||
class FullMatrix : public RowTypeMatrix<std::shared_ptr<FullRow<T>>>
|
||||
{
|
||||
public:
|
||||
FullMatrix() {
|
||||
@@ -15,3 +15,4 @@ namespace MbD {
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullMatrix<double>> FullMatDptr;
|
||||
|
||||
@@ -11,3 +11,4 @@ namespace MbD {
|
||||
};
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<MbD::FullRow<double>> FullRowDptr;
|
||||
|
||||
@@ -16,12 +16,12 @@ void MarkerFrame::setPartFrame(PartFrame* partFrm)
|
||||
partFrame = partFrm;
|
||||
}
|
||||
|
||||
void MarkerFrame::setrpmp(FullColumn<double>* x)
|
||||
void MarkerFrame::setrpmp(FullColDptr x)
|
||||
{
|
||||
rpmp->copy(x);
|
||||
}
|
||||
|
||||
void MarkerFrame::setaApm(FullMatrix<double>* x)
|
||||
void MarkerFrame::setaApm(FullMatDptr x)
|
||||
{
|
||||
aApm->copy(x);
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ namespace MbD {
|
||||
public:
|
||||
MarkerFrame();
|
||||
void setPartFrame(PartFrame* partFrm);
|
||||
void setrpmp(FullColumn<double>* x);
|
||||
void setaApm(FullMatrix<double>* x);
|
||||
void setrpmp(FullColDptr x);
|
||||
void setaApm(FullMatDptr x);
|
||||
void addEndFrame(std::shared_ptr<EndFrameqc> x);
|
||||
|
||||
PartFrame* partFrame;
|
||||
FullColumn<double>* rpmp = new FullColumn<double>(3);
|
||||
FullMatrix<double>* aApm = new FullMatrix<double>(3, 3);
|
||||
FullColumn<double>* rOmO = new FullColumn<double>(3);
|
||||
FullMatrix<double>* aAOm = new FullMatrix<double>(3, 3);
|
||||
FullMatrix<double>* prOmOpE = new FullMatrix<double>(3, 4);
|
||||
FullColDptr rpmp = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aApm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullColDptr rOmO = std::make_shared<FullColumn<double>>(3);
|
||||
FullMatDptr aAOm = std::make_shared<FullMatrix<double>>(3, 3);
|
||||
FullMatDptr prOmOpE = std::make_shared<FullMatrix<double>>(3, 4);
|
||||
FullColumn<FullMatrix<double>>* pAOmpE = new FullColumn<FullMatrix<double>>(4);
|
||||
std::vector<std::shared_ptr<EndFrameqc>> endFrames;
|
||||
|
||||
|
||||
@@ -14,20 +14,23 @@ int main()
|
||||
std::string str = "TheSystem";
|
||||
TheSystem.setName(str);
|
||||
std::cout << "TheSystem.getName() " << TheSystem.getName() << std::endl;
|
||||
FullColumn<double>* qX, * qE;
|
||||
FullColumn<double>* rpmp;
|
||||
FullMatrix<double>* aApm;
|
||||
FullRow<double>* fullRow;
|
||||
auto row = new FullRow<double>{ 0, 0, 0, 1 };
|
||||
fullRow = new FullRow<double>(4);
|
||||
FullColDptr qX, qE;
|
||||
FullColDptr rpmp;
|
||||
FullMatDptr aApm;
|
||||
FullRowDptr fullRow;
|
||||
auto elements = { 0.0, 0.0, 0.0, 1.0 };
|
||||
auto row = std::make_shared<FullRow<double>>(elements);
|
||||
fullRow = std::make_shared<FullRow<double>>(4);
|
||||
fullRow->copy(row);
|
||||
//
|
||||
auto assembly1 = std::make_shared<Part>();
|
||||
str = "Assembly1";
|
||||
assembly1->setName(str);
|
||||
std::cout << "assembly1->getName() " << assembly1->getName() << std::endl;
|
||||
qX = new FullColumn<double>{ 0, 0, 0 };
|
||||
qE = new FullColumn<double>{ 0, 0, 0, 1 };
|
||||
elements = { 0, 0, 0 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0, 0, 0, 1 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
assembly1->setqX(qX);
|
||||
assembly1->setqE(qE);
|
||||
std::cout << "assembly1->getqX() " << assembly1->getqX()->toString() << std::endl;
|
||||
@@ -37,14 +40,18 @@ int main()
|
||||
auto marker1 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker1";
|
||||
marker1->setName(str);
|
||||
rpmp = new FullColumn<double>{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
rpmp = std::make_shared<FullColumn<double>>(elements);
|
||||
marker1->setrpmp(rpmp);
|
||||
aApm = new FullMatrix<double>();
|
||||
fullRow = new FullRow<double>{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
aApm = std::make_shared<FullMatrix<double>>();
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
fullRow = new FullRow<double>{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
fullRow = new FullRow<double>{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
marker1->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker1);
|
||||
@@ -52,14 +59,18 @@ int main()
|
||||
auto marker2 = std::make_shared<MarkerFrame>();
|
||||
str = "Marker2";
|
||||
marker2->setName(str);
|
||||
rpmp = new FullColumn<double>{ 0.0, 0.0, 0.0 };
|
||||
elements = { 0.0, 0.0, 0.0 };
|
||||
rpmp = std::make_shared<FullColumn<double>>(elements);
|
||||
marker2->setrpmp(rpmp);
|
||||
aApm = new FullMatrix<double>();
|
||||
fullRow = new FullRow<double>{ 1.0, 0.0, 0.0 };
|
||||
aApm = std::make_shared<FullMatrix<double>>();
|
||||
elements = { 1.0, 0.0, 0.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
fullRow = new FullRow<double>{ 0.0, 1.0, 0.0 };
|
||||
elements = { 0.0, 1.0, 0.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
fullRow = new FullRow<double>{ 0.0, 0.0, 1.0 };
|
||||
elements = { 0.0, 0.0, 1.0 };
|
||||
fullRow = std::make_shared<FullRow<double>>(elements);
|
||||
aApm->push_back(fullRow);
|
||||
marker2->setaApm(aApm);
|
||||
assembly1->partFrame->addMarkerFrame(marker2);
|
||||
@@ -68,8 +79,10 @@ int main()
|
||||
auto part1 = std::make_shared<Part>();
|
||||
str = "Part1";
|
||||
part1->setName(str);
|
||||
qX = new FullColumn<double>{ 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
qE = new FullColumn<double>{ 0.0, 0.0, 1.4248456266393e-10, 1.0 };
|
||||
elements = { 0.38423366582893, 6.8384291794733e-9, -0.048029210642807 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.0, 0.0, 1.4248456266393e-10, 1.0 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
part1->setqX(qX);
|
||||
part1->setqE(qE);
|
||||
TheSystem.parts.push_back(part1);
|
||||
@@ -77,8 +90,10 @@ int main()
|
||||
auto part2 = std::make_shared<Part>();
|
||||
str = "Part2";
|
||||
part2->setName(str);
|
||||
qX = new FullColumn<double>{ 0.38423366582893, 0.49215308269277, 0.048029210642807 };
|
||||
qE = new FullColumn<double>{ 0.0, 0.0, 0.89871701272344, 0.4385290538168 };
|
||||
elements = { 0.38423366582893, 0.49215308269277, 0.048029210642807 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.0, 0.0, 0.89871701272344, 0.4385290538168 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
part2->setqX(qX);
|
||||
part2->setqE(qE);
|
||||
TheSystem.parts.push_back(part2);
|
||||
@@ -86,8 +101,10 @@ int main()
|
||||
auto part3 = std::make_shared<Part>();
|
||||
str = "Part3";
|
||||
part3->setName(str);
|
||||
qX = new FullColumn<double>{ -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 };
|
||||
qE = new FullColumn<double>{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 };
|
||||
elements = { -1.284772285311e-18, 1.4645982581368, -4.788228906425e-17 };
|
||||
qX = std::make_shared<FullColumn<double>>(elements);
|
||||
elements = { 0.70710678118655, 0.70710678118655, 0.0, 0.0 };
|
||||
qE = std::make_shared<FullColumn<double>>(elements);
|
||||
part3->setqX(qX);
|
||||
part3->setqE(qE);
|
||||
TheSystem.parts.push_back(part3);
|
||||
|
||||
@@ -8,19 +8,19 @@ Part::Part() {
|
||||
partFrame = std::make_shared<PartFrame>();
|
||||
}
|
||||
|
||||
void Part::setqX(FullColumn<double>* x) {
|
||||
void Part::setqX(FullColDptr x) {
|
||||
partFrame.get()->setqX(x);
|
||||
}
|
||||
|
||||
FullColumn<double>* Part::getqX() {
|
||||
FullColDptr Part::getqX() {
|
||||
return partFrame.get()->getqX();
|
||||
}
|
||||
|
||||
void Part::setqE(FullColumn<double>* x) {
|
||||
void Part::setqE(FullColDptr x) {
|
||||
partFrame.get()->setqE(x);
|
||||
}
|
||||
|
||||
FullColumn<double>* Part::getqE() {
|
||||
FullColDptr Part::getqE() {
|
||||
return partFrame.get()->getqE();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace MbD {
|
||||
//ToDo: ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot
|
||||
public:
|
||||
Part();
|
||||
void setqX(FullColumn<double>* x);
|
||||
FullColumn<double>* getqX();
|
||||
void setqE(FullColumn<double>* x);
|
||||
FullColumn<double>* getqE();
|
||||
void setqX(FullColDptr x);
|
||||
FullColDptr getqX();
|
||||
void setqE(FullColDptr x);
|
||||
FullColDptr getqE();
|
||||
void setSystem(System& sys);
|
||||
std::shared_ptr<PartFrame> partFrame;
|
||||
};
|
||||
|
||||
@@ -11,16 +11,16 @@ PartFrame::PartFrame()
|
||||
aGabs = std::vector<std::shared_ptr<AbsConstraint>>();
|
||||
markerFrames = std::vector<std::shared_ptr<MarkerFrame>>();
|
||||
}
|
||||
void PartFrame::setqX(FullColumn<double>* x) {
|
||||
void PartFrame::setqX(FullColDptr x) {
|
||||
qX->copy(x);
|
||||
}
|
||||
FullColumn<double>* PartFrame::getqX() {
|
||||
FullColDptr PartFrame::getqX() {
|
||||
return qX;
|
||||
}
|
||||
void PartFrame::setqE(FullColumn<double>* x) {
|
||||
void PartFrame::setqE(FullColDptr x) {
|
||||
qE->copy(x);
|
||||
}
|
||||
FullColumn<double>* PartFrame::getqE() {
|
||||
FullColDptr PartFrame::getqE() {
|
||||
return qE;
|
||||
}
|
||||
void PartFrame::setPart(std::shared_ptr<Part> x) {
|
||||
|
||||
@@ -19,18 +19,18 @@ namespace MbD {
|
||||
public:
|
||||
PartFrame();
|
||||
|
||||
void setqX(FullColumn<double>* x);
|
||||
FullColumn<double>* getqX();
|
||||
void setqE(FullColumn<double>* x);
|
||||
FullColumn<double>* getqE();
|
||||
void setqX(FullColDptr x);
|
||||
FullColDptr getqX();
|
||||
void setqE(FullColDptr x);
|
||||
FullColDptr getqE();
|
||||
void setPart(std::shared_ptr<Part> x);
|
||||
std::shared_ptr<Part> getPart();
|
||||
void addMarkerFrame(std::shared_ptr<MarkerFrame> x);
|
||||
|
||||
std::weak_ptr<Part> part;
|
||||
int iqX, iqE; //Position index of frame variables qX and qE in system list of variables
|
||||
FullColumn<double>* qX = new FullColumn<double>(3);
|
||||
FullColumn<double>* qE = new FullColumn<double>(4);
|
||||
FullColDptr qX = std::make_shared<FullColumn<double>>(3);
|
||||
FullColDptr qE = std::make_shared<FullColumn<double>>(4);
|
||||
std::shared_ptr<EulerConstraint> aGeu;
|
||||
std::vector<std::shared_ptr<AbsConstraint>> aGabs;
|
||||
std::vector<std::shared_ptr<MarkerFrame>> markerFrames;
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace MbD {
|
||||
public:
|
||||
RowTypeMatrix() {}
|
||||
RowTypeMatrix(std::initializer_list<T> list) : Array<T>{ list } {}
|
||||
void copy(RowTypeMatrix<T>* x);
|
||||
void copy(std::shared_ptr<RowTypeMatrix<T>> x);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline void RowTypeMatrix<T>::copy(RowTypeMatrix<T>* x)
|
||||
inline void RowTypeMatrix<T>::copy(std::shared_ptr<RowTypeMatrix<T>> x)
|
||||
{
|
||||
for (int i = 0; i < x->size(); i++) {
|
||||
this->at(i)->copy(x->at(i));
|
||||
|
||||
Reference in New Issue
Block a user