From 8dbb49d032e095f4bc4568f0f7c58c59d4fec464 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Fri, 3 Nov 2023 13:57:11 -0500 Subject: [PATCH 01/17] stopping point --- OndselSolver/ASMTAssembly.cpp | 12 +- OndselSolver/ASMTPrincipalMassMarker.cpp | 2 +- OndselSolver/ASMTSpatialItem.cpp | 4 +- OndselSolver/ASMTSpatialItem.h | 2 +- OndselSolver/AngleZIeqcJec.cpp | 2 +- OndselSolver/AngleZIeqcJeqc.cpp | 4 +- OndselSolver/CADSystem.cpp | 22 +- OndselSolver/ConstVelConstraintIqcJqc.cpp | 4 +- OndselSolver/DifferenceOperator.cpp | 2 +- OndselSolver/DirectionCosineIeqcJec.cpp | 2 +- OndselSolver/DirectionCosineIeqcJeqc.cpp | 2 +- OndselSolver/DispCompIeqcJecIe.cpp | 4 +- OndselSolver/DispCompIeqcJecKeqc.cpp | 6 +- OndselSolver/DispCompIeqcJeqcIe.cpp | 6 +- OndselSolver/DispCompIeqcJeqcKeqc.cpp | 6 +- OndselSolver/DistIeqcJec.cpp | 10 +- OndselSolver/DistIeqcJeqc.cpp | 14 +- OndselSolver/DistxyIeqcJec.cpp | 6 +- OndselSolver/EndFramec.h | 2 +- OndselSolver/EndFrameqc.cpp | 6 +- OndselSolver/EndFrameqct.cpp | 2 +- OndselSolver/EulerAngles.h | 10 +- OndselSolver/EulerAnglesDDot.h | 6 +- OndselSolver/EulerAnglesDot.h | 6 +- OndselSolver/EulerAngleszxzDot.h | 6 +- OndselSolver/EulerParameters.cpp | 8 +- OndselSolver/FullMatrix.cpp | 644 ---------------------- OndselSolver/FullMatrix.h | 15 +- OndselSolver/FullMatrix.ref.h | 17 +- OndselSolver/FullRow.cpp | 8 +- OndselSolver/FullRow.h | 6 +- OndselSolver/GeneralSpline.cpp | 2 +- OndselSolver/LDUFullMat.cpp | 2 +- OndselSolver/MBDynBody.cpp | 6 +- OndselSolver/MBDynItem.cpp | 6 +- OndselSolver/MBDynJoint.cpp | 2 +- OndselSolver/MBDynMarker.cpp | 2 +- OndselSolver/MBDynStructural.cpp | 2 +- OndselSolver/MarkerFrame.cpp | 2 +- OndselSolver/MomentOfInertiaSolver.cpp | 8 +- OndselSolver/OrbitAnglezIeqcJec.cpp | 6 +- OndselSolver/OrbitAnglezIeqcJeqc.cpp | 14 +- OndselSolver/Part.cpp | 4 +- OndselSolver/RowTypeMatrix.cpp | 10 - OndselSolver/RowTypeMatrix.h | 8 +- OndselSolver/StableBackwardDifference.cpp | 2 +- 46 files changed, 142 insertions(+), 780 deletions(-) diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index c955aa5..8578ea6 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -248,7 +248,7 @@ void MbD::ASMTAssembly::runSinglePendulum() assembly->setName(str); auto pos3D = std::make_shared>(ListD{ 0, 0, 0 }); assembly->setPosition3D(pos3D); - auto rotMat = std::make_shared>(ListListD{ + auto rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -266,7 +266,7 @@ void MbD::ASMTAssembly::runSinglePendulum() massMarker->setMomentOfInertias(aJ); pos3D = std::make_shared>(ListD{ 0, 0, 0 }); massMarker->setPosition3D(pos3D); - rotMat = std::make_shared>(ListListD{ + rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -279,7 +279,7 @@ void MbD::ASMTAssembly::runSinglePendulum() mkr->setName(str); pos3D = std::make_shared>(ListD{ 0, 0, 0 }); mkr->setPosition3D(pos3D); - rotMat = std::make_shared>(ListListD{ + rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -292,7 +292,7 @@ void MbD::ASMTAssembly::runSinglePendulum() part->setName(str); pos3D = std::make_shared>(ListD{ -0.1, -0.1, -0.1 }); part->setPosition3D(pos3D); - rotMat = std::make_shared>(ListListD{ + rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -311,7 +311,7 @@ void MbD::ASMTAssembly::runSinglePendulum() massMarker->setMomentOfInertias(aJ); pos3D = std::make_shared>(ListD{ 0.5, 0.1, 0.05 }); massMarker->setPosition3D(pos3D); - rotMat = std::make_shared>(ListListD{ + rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -324,7 +324,7 @@ void MbD::ASMTAssembly::runSinglePendulum() mkr->setName(str); pos3D = std::make_shared>(ListD{ 0.1, 0.1, 0.1 }); mkr->setPosition3D(pos3D); - rotMat = std::make_shared>(ListListD{ + rotMat = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } diff --git a/OndselSolver/ASMTPrincipalMassMarker.cpp b/OndselSolver/ASMTPrincipalMassMarker.cpp index d5ee7fe..5b813b3 100644 --- a/OndselSolver/ASMTPrincipalMassMarker.cpp +++ b/OndselSolver/ASMTPrincipalMassMarker.cpp @@ -26,7 +26,7 @@ void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector& lines) lines.erase(lines.begin()); assert(lines[0] == (leadingTabs + "RotationMatrix")); lines.erase(lines.begin()); - rotationMatrix = std::make_shared>(3); + rotationMatrix = std::make_shared(3); for (int i = 0; i < 3; i++) { auto row = readRowOfDoubles(lines[0]); diff --git a/OndselSolver/ASMTSpatialItem.cpp b/OndselSolver/ASMTSpatialItem.cpp index 6f5874a..931787c 100644 --- a/OndselSolver/ASMTSpatialItem.cpp +++ b/OndselSolver/ASMTSpatialItem.cpp @@ -47,7 +47,7 @@ void MbD::ASMTSpatialItem::readRotationMatrix(std::vector& lines) { assert(lines[0].find("RotationMatrix") != std::string::npos); lines.erase(lines.begin()); - rotationMatrix = std::make_shared>(3, 0); + rotationMatrix = std::make_shared(3, 0); for (int i = 0; i < 3; i++) { auto& row = rotationMatrix->at(i); @@ -86,7 +86,7 @@ void MbD::ASMTSpatialItem::setRotationMatrix(double v11, double v12, double v13, double v21, double v22, double v23, double v31, double v32, double v33) { - rotationMatrix = std::make_shared>(ListListD{ + rotationMatrix = std::make_shared(ListListD{ { v11, v12, v13 }, { v21, v22, v23 }, { v31, v32, v33 } diff --git a/OndselSolver/ASMTSpatialItem.h b/OndselSolver/ASMTSpatialItem.h index 2f5a6e2..cf556b6 100644 --- a/OndselSolver/ASMTSpatialItem.h +++ b/OndselSolver/ASMTSpatialItem.h @@ -33,7 +33,7 @@ namespace MbD { void storeOnLevelRotationMatrix(std::ofstream& os, int level); FColDsptr position3D = std::make_shared>(3); - FMatDsptr rotationMatrix = std::make_shared>(ListListD{ + FMatDsptr rotationMatrix = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } diff --git a/OndselSolver/AngleZIeqcJec.cpp b/OndselSolver/AngleZIeqcJec.cpp index e6aee7c..ce9935d 100644 --- a/OndselSolver/AngleZIeqcJec.cpp +++ b/OndselSolver/AngleZIeqcJec.cpp @@ -65,7 +65,7 @@ void MbD::AngleZIeqcJec::initialize() { AngleZIecJec::initialize(); pthezpEI = std::make_shared>(4); - ppthezpEIpEI = std::make_shared>(4, 4); + ppthezpEIpEI = std::make_shared(4, 4); } FMatDsptr MbD::AngleZIeqcJec::ppvaluepEIpEI() diff --git a/OndselSolver/AngleZIeqcJeqc.cpp b/OndselSolver/AngleZIeqcJeqc.cpp index 9729777..3f1ed4f 100644 --- a/OndselSolver/AngleZIeqcJeqc.cpp +++ b/OndselSolver/AngleZIeqcJeqc.cpp @@ -85,8 +85,8 @@ void MbD::AngleZIeqcJeqc::initialize() { AngleZIeqcJec::initialize(); pthezpEJ = std::make_shared>(4); - ppthezpEIpEJ = std::make_shared>(4, 4); - ppthezpEJpEJ = std::make_shared>(4, 4); + ppthezpEIpEJ = std::make_shared(4, 4); + ppthezpEJpEJ = std::make_shared(4, 4); } FMatDsptr MbD::AngleZIeqcJeqc::ppvaluepEIpEJ() diff --git a/OndselSolver/CADSystem.cpp b/OndselSolver/CADSystem.cpp index a3e00ff..baa9694 100644 --- a/OndselSolver/CADSystem.cpp +++ b/OndselSolver/CADSystem.cpp @@ -89,7 +89,7 @@ void CADSystem::runOndselSinglePendulum() assembly1->m = 0.0; assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); - aAap = std::make_shared>(ListListD{ + aAap = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -106,7 +106,7 @@ void CADSystem::runOndselSinglePendulum() auto marker2 = CREATE::With("/Assembly1/Marker2"); rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -117,7 +117,7 @@ void CADSystem::runOndselSinglePendulum() auto marker1 = CREATE::With("/Assembly1/Marker1"); rpmp = std::make_shared>(ListD{ 0.0, 3.0, 0.0 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 } @@ -132,7 +132,7 @@ void CADSystem::runOndselSinglePendulum() crankPart1->m = 1.0; crankPart1->aJ = std::make_shared>(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.4, 0.0, -0.05 }); - aAap = std::make_shared>(ListListD{ + aAap = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -149,7 +149,7 @@ void CADSystem::runOndselSinglePendulum() auto marker1 = CREATE::With("/Assembly1/Part1/Marker1"); rpmp = std::make_shared>(ListD{ -0.4, 0.0, 0.05 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -160,7 +160,7 @@ void CADSystem::runOndselSinglePendulum() auto marker2 = CREATE::With("/Assembly1/Part1/Marker2"); rpmp = std::make_shared>(ListD{ 0.4, 0.0, 0.05 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -224,7 +224,7 @@ void CADSystem::runOndselDoublePendulum() assembly1->m = 0.0; assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); - aAap = std::make_shared>(ListListD{ + aAap = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -241,7 +241,7 @@ void CADSystem::runOndselDoublePendulum() auto marker2 = CREATE::With("/Assembly1/Marker2"); rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -252,7 +252,7 @@ void CADSystem::runOndselDoublePendulum() auto marker1 = CREATE::With("/Assembly1/Marker1"); rpmp = std::make_shared>(ListD{ 0.0, 3.0, 0.0 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 } @@ -267,7 +267,7 @@ void CADSystem::runOndselDoublePendulum() crankPart1->m = 1.0; crankPart1->aJ = std::make_shared>(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.4, 0.0, -0.05 }); - aAap = std::make_shared>(ListListD{ + aAap = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -284,7 +284,7 @@ void CADSystem::runOndselDoublePendulum() auto marker1 = CREATE::With("/Assembly1/Part1/Marker1"); rpmp = std::make_shared>(ListD{ -0.4, 0.0, 0.05 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } diff --git a/OndselSolver/ConstVelConstraintIqcJqc.cpp b/OndselSolver/ConstVelConstraintIqcJqc.cpp index 2a30974..1455742 100644 --- a/OndselSolver/ConstVelConstraintIqcJqc.cpp +++ b/OndselSolver/ConstVelConstraintIqcJqc.cpp @@ -118,8 +118,8 @@ void MbD::ConstVelConstraintIqcJqc::initialize() { ConstVelConstraintIqcJc::initialize(); pGpEJ = std::make_shared>(4); - ppGpEIpEJ = std::make_shared>(4, 4); - ppGpEJpEJ = std::make_shared>(4, 4); + ppGpEIpEJ = std::make_shared(4, 4); + ppGpEJpEJ = std::make_shared(4, 4); } void MbD::ConstVelConstraintIqcJqc::useEquationNumbers() diff --git a/OndselSolver/DifferenceOperator.cpp b/OndselSolver/DifferenceOperator.cpp index 5fd44d7..ffe8cb9 100644 --- a/OndselSolver/DifferenceOperator.cpp +++ b/OndselSolver/DifferenceOperator.cpp @@ -57,7 +57,7 @@ void DifferenceOperator::setorder(int o) void DifferenceOperator::instantiateTaylorMatrix() { if (taylorMatrix == nullptr || (taylorMatrix->nrow() != (order + 1))) { - taylorMatrix = std::make_shared>(order + 1, order + 1); + taylorMatrix = std::make_shared(order + 1, order + 1); } } diff --git a/OndselSolver/DirectionCosineIeqcJec.cpp b/OndselSolver/DirectionCosineIeqcJec.cpp index 6e4423b..eb64f73 100644 --- a/OndselSolver/DirectionCosineIeqcJec.cpp +++ b/OndselSolver/DirectionCosineIeqcJec.cpp @@ -24,7 +24,7 @@ void DirectionCosineIeqcJec::initialize() { DirectionCosineIecJec::initialize(); pAijIeJepEI = std::make_shared>(4); - ppAijIeJepEIpEI = std::make_shared>(4, 4); + ppAijIeJepEIpEI = std::make_shared(4, 4); } void DirectionCosineIeqcJec::initializeGlobally() diff --git a/OndselSolver/DirectionCosineIeqcJeqc.cpp b/OndselSolver/DirectionCosineIeqcJeqc.cpp index 92598c9..52a5535 100644 --- a/OndselSolver/DirectionCosineIeqcJeqc.cpp +++ b/OndselSolver/DirectionCosineIeqcJeqc.cpp @@ -24,7 +24,7 @@ void DirectionCosineIeqcJeqc::initialize() { DirectionCosineIeqcJec::initialize(); pAijIeJepEJ = std::make_shared>(4); - ppAijIeJepEIpEJ = std::make_shared>(4, 4); + ppAijIeJepEIpEJ = std::make_shared(4, 4); ppAijIeJepEJpEJ = std::make_shared>(4, 4); } diff --git a/OndselSolver/DispCompIeqcJecIe.cpp b/OndselSolver/DispCompIeqcJecIe.cpp index c724c66..4706787 100644 --- a/OndselSolver/DispCompIeqcJecIe.cpp +++ b/OndselSolver/DispCompIeqcJecIe.cpp @@ -87,8 +87,8 @@ void MbD::DispCompIeqcJecIe::initialize() DispCompIecJecIe::initialize(); priIeJeIepXI = std::make_shared>(3); priIeJeIepEI = std::make_shared>(4); - ppriIeJeIepXIpEI = std::make_shared>(3, 4); - ppriIeJeIepEIpEI = std::make_shared>(4, 4); + ppriIeJeIepXIpEI = std::make_shared(3, 4); + ppriIeJeIepEIpEI = std::make_shared(4, 4); } void MbD::DispCompIeqcJecIe::initializeGlobally() diff --git a/OndselSolver/DispCompIeqcJecKeqc.cpp b/OndselSolver/DispCompIeqcJecKeqc.cpp index c25efc1..5d6c96f 100644 --- a/OndselSolver/DispCompIeqcJecKeqc.cpp +++ b/OndselSolver/DispCompIeqcJecKeqc.cpp @@ -24,9 +24,9 @@ void DispCompIeqcJecKeqc::initialize() DispCompIecJecKeqc::initialize(); priIeJeKepXI = std::make_shared>(3); priIeJeKepEI = std::make_shared>(4); - ppriIeJeKepEIpEI = std::make_shared>(4, 4); - ppriIeJeKepXIpEK = std::make_shared>(3, 4); - ppriIeJeKepEIpEK = std::make_shared>(4, 4); + ppriIeJeKepEIpEI = std::make_shared(4, 4); + ppriIeJeKepXIpEK = std::make_shared(3, 4); + ppriIeJeKepEIpEK = std::make_shared(4, 4); } void DispCompIeqcJecKeqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/DispCompIeqcJeqcIe.cpp b/OndselSolver/DispCompIeqcJeqcIe.cpp index d19e98c..e02461f 100644 --- a/OndselSolver/DispCompIeqcJeqcIe.cpp +++ b/OndselSolver/DispCompIeqcJeqcIe.cpp @@ -83,9 +83,9 @@ void MbD::DispCompIeqcJeqcIe::initialize() DispCompIeqcJecIe::initialize(); priIeJeIepXJ = std::make_shared>(3); priIeJeIepEJ = std::make_shared>(4); - ppriIeJeIepEIpXJ = std::make_shared>(4, 3); - ppriIeJeIepEIpEJ = std::make_shared>(4, 4); - ppriIeJeIepEJpEJ = std::make_shared>(4, 4); + ppriIeJeIepEIpXJ = std::make_shared(4, 3); + ppriIeJeIepEIpEJ = std::make_shared(4, 4); + ppriIeJeIepEJpEJ = std::make_shared(4, 4); } FMatDsptr MbD::DispCompIeqcJeqcIe::ppvaluepEIpEJ() diff --git a/OndselSolver/DispCompIeqcJeqcKeqc.cpp b/OndselSolver/DispCompIeqcJeqcKeqc.cpp index 61a6254..554585b 100644 --- a/OndselSolver/DispCompIeqcJeqcKeqc.cpp +++ b/OndselSolver/DispCompIeqcJeqcKeqc.cpp @@ -24,9 +24,9 @@ void DispCompIeqcJeqcKeqc::initialize() DispCompIeqcJecKeqc::initialize(); priIeJeKepXJ = std::make_shared>(3); priIeJeKepEJ = std::make_shared>(4); - ppriIeJeKepEJpEJ = std::make_shared>(4, 4); - ppriIeJeKepXJpEK = std::make_shared>(3, 4); - ppriIeJeKepEJpEK = std::make_shared>(4, 4); + ppriIeJeKepEJpEJ = std::make_shared(4, 4); + ppriIeJeKepXJpEK = std::make_shared(3, 4); + ppriIeJeKepEJpEK = std::make_shared(4, 4); } void DispCompIeqcJeqcKeqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/DistIeqcJec.cpp b/OndselSolver/DistIeqcJec.cpp index ce7ed3f..d53f49c 100644 --- a/OndselSolver/DistIeqcJec.cpp +++ b/OndselSolver/DistIeqcJec.cpp @@ -41,7 +41,7 @@ void MbD::DistIeqcJec::calcPrivate() pprIeJepXIipXI->atiput(j, element / rIeJe); } } - pprIeJepXIpEI = std::make_shared>(3, 4); + pprIeJepXIpEI = std::make_shared(3, 4); for (int i = 0; i < 3; i++) { auto& pprIeJepXIipEI = pprIeJepXIpEI->at(i); @@ -53,7 +53,7 @@ void MbD::DistIeqcJec::calcPrivate() pprIeJepXIipEI->atiput(j, element / rIeJe); } } - pprIeJepEIpEI = std::make_shared>(4, 4); + pprIeJepEIpEI = std::make_shared(4, 4); for (int i = 0; i < 4; i++) { auto& pprIeJepEIipEI = pprIeJepEIpEI->at(i); @@ -74,9 +74,9 @@ void MbD::DistIeqcJec::initialize() DistIecJec::initialize(); prIeJepXI = std::make_shared>(3); prIeJepEI = std::make_shared>(4); - pprIeJepXIpXI = std::make_shared>(3, 3); - pprIeJepXIpEI = std::make_shared>(3, 4); - pprIeJepEIpEI = std::make_shared>(4, 4); + pprIeJepXIpXI = std::make_shared(3, 3); + pprIeJepXIpEI = std::make_shared(3, 4); + pprIeJepEIpEI = std::make_shared(4, 4); } FMatDsptr MbD::DistIeqcJec::ppvaluepEIpEI() diff --git a/OndselSolver/DistIeqcJeqc.cpp b/OndselSolver/DistIeqcJeqc.cpp index 60b614d..f8e565f 100644 --- a/OndselSolver/DistIeqcJeqc.cpp +++ b/OndselSolver/DistIeqcJeqc.cpp @@ -122,13 +122,13 @@ void MbD::DistIeqcJeqc::initialize() DistIeqcJec::initialize(); prIeJepXJ = std::make_shared>(3); prIeJepEJ = std::make_shared>(4); - pprIeJepXIpXJ = std::make_shared>(3, 3); - pprIeJepEIpXJ = std::make_shared>(4, 3); - pprIeJepXJpXJ = std::make_shared>(3, 3); - pprIeJepXIpEJ = std::make_shared>(3, 4); - pprIeJepEIpEJ = std::make_shared>(4, 4); - pprIeJepXJpEJ = std::make_shared>(3, 4); - pprIeJepEJpEJ = std::make_shared>(4, 4); + pprIeJepXIpXJ = std::make_shared(3, 3); + pprIeJepEIpXJ = std::make_shared(4, 3); + pprIeJepXJpXJ = std::make_shared(3, 3); + pprIeJepXIpEJ = std::make_shared(3, 4); + pprIeJepEIpEJ = std::make_shared(4, 4); + pprIeJepXJpEJ = std::make_shared(3, 4); + pprIeJepEJpEJ = std::make_shared(4, 4); } FMatDsptr MbD::DistIeqcJeqc::ppvaluepEIpEJ() diff --git a/OndselSolver/DistxyIeqcJec.cpp b/OndselSolver/DistxyIeqcJec.cpp index 12436c2..165358a 100644 --- a/OndselSolver/DistxyIeqcJec.cpp +++ b/OndselSolver/DistxyIeqcJec.cpp @@ -161,9 +161,9 @@ void MbD::DistxyIeqcJec::initialize() DistxyIecJec::initialize(); pdistxypXI = std::make_shared>(3); pdistxypEI = std::make_shared>(4); - ppdistxypXIpXI = std::make_shared>(3, 3); - ppdistxypXIpEI = std::make_shared>(3, 4); - ppdistxypEIpEI = std::make_shared>(4, 4); + ppdistxypXIpXI = std::make_shared(3, 3); + ppdistxypXIpEI = std::make_shared(3, 4); + ppdistxypEIpEI = std::make_shared(4, 4); } FMatDsptr MbD::DistxyIeqcJec::ppvaluepEIpEI() diff --git a/OndselSolver/EndFramec.h b/OndselSolver/EndFramec.h index add9a5a..92a3cf7 100644 --- a/OndselSolver/EndFramec.h +++ b/OndselSolver/EndFramec.h @@ -44,7 +44,7 @@ namespace MbD { MarkerFrame* markerFrame; //Use raw pointer when pointing backwards. FColDsptr rOeO = std::make_shared>(3); - FMatDsptr aAOe = FullMatrix::identitysptr(3); + FMatDsptr aAOe = FullMatrixDouble::identitysptr(3); }; //using EndFrmsptr = std::shared_ptr; } diff --git a/OndselSolver/EndFrameqc.cpp b/OndselSolver/EndFrameqc.cpp index 026bbf8..1837d88 100644 --- a/OndselSolver/EndFrameqc.cpp +++ b/OndselSolver/EndFrameqc.cpp @@ -25,7 +25,7 @@ EndFrameqc::EndFrameqc(const char* str) : EndFramec(str) { void EndFrameqc::initialize() { - prOeOpE = std::make_shared>(3, 4); + prOeOpE = std::make_shared(3, 4); pprOeOpEpE = std::make_shared>(4, 4); pAOepE = std::make_shared>(4); ppAOepEpE = std::make_shared>(4, 4); @@ -80,7 +80,7 @@ void EndFrameqc::calcPostDynCorrectorIteration() FMatDsptr EndFrameqc::pAjOepET(int axis) { - auto answer = std::make_shared>(4, 3); + auto answer = std::make_shared(4, 3); for (int i = 0; i < 4; i++) { auto& answeri = answer->at(i); auto& pAOepEi = pAOepE->at(i); @@ -94,7 +94,7 @@ FMatDsptr EndFrameqc::pAjOepET(int axis) FMatDsptr EndFrameqc::ppriOeOpEpE(int ii) { - auto answer = std::make_shared>(4, 4); + auto answer = std::make_shared(4, 4); for (int i = 0; i < 4; i++) { auto& answeri = answer->at(i); auto& pprOeOpEipE = pprOeOpEpE->at(i); diff --git a/OndselSolver/EndFrameqct.cpp b/OndselSolver/EndFrameqct.cpp index 2fc215e..69020d3 100644 --- a/OndselSolver/EndFrameqct.cpp +++ b/OndselSolver/EndFrameqct.cpp @@ -31,7 +31,7 @@ void EndFrameqct::initialize() rmem = std::make_shared>(3); prmempt = std::make_shared>(3); pprmemptpt = std::make_shared>(3); - aAme = FullMatrix::identitysptr(3); + aAme = FullMatrixDouble::identitysptr(3); pAmept = std::make_shared>(3, 3); ppAmeptpt = std::make_shared>(3, 3); pprOeOpEpt = std::make_shared>(3, 4); diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index a5e1502..4d1ab62 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -51,13 +51,13 @@ namespace MbD { auto axis = rotOrder->at(i); auto angle = this->at(i)->getValue(); if (axis == 1) { - cA->atiput(i, FullMatrix::rotatex(angle)); + cA->atiput(i, FullMatrixDouble::rotatex(angle)); } else if (axis == 2) { - cA->atiput(i, FullMatrix::rotatey(angle)); + cA->atiput(i, FullMatrixDouble::rotatey(angle)); } else if (axis == 3) { - cA->atiput(i, FullMatrix::rotatez(angle)); + cA->atiput(i, FullMatrixDouble::rotatez(angle)); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); @@ -74,10 +74,10 @@ namespace MbD { auto axis = rotOrder->at(i); auto angle = this->at(i); if (axis == 1) { - cA->atiput(i, FullMatrix::rotatex(angle)); + cA->atiput(i, FullMatrixDouble::rotatex(angle)); } else if (axis == 2) { - cA->atiput(i, FullMatrix::rotatey(angle)); + cA->atiput(i, FullMatrixDouble::rotatey(angle)); } else if (axis == 3) { cA->atiput(i, FullMatrix::rotatez(angle)); diff --git a/OndselSolver/EulerAnglesDDot.h b/OndselSolver/EulerAnglesDDot.h index 3c5b81e..6dc561a 100644 --- a/OndselSolver/EulerAnglesDDot.h +++ b/OndselSolver/EulerAnglesDDot.h @@ -47,13 +47,13 @@ namespace MbD { auto angleDot = aEulerAnglesDot->at(i)->getValue(); auto angleDDot = this->at(i)->getValue(); if (axis == 1) { - cAddot->atiput(i, FullMatrix::rotatexrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, FullMatrixDouble::rotatexrotDotrotDDot(angle, angleDot, angleDDot)); } else if (axis == 2) { - cAddot->atiput(i, FullMatrix::rotateyrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, FullMatrixDouble::rotateyrotDotrotDDot(angle, angleDot, angleDDot)); } else if (axis == 3) { - cAddot->atiput(i, FullMatrix::rotatezrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, FullMatrixDouble::rotatezrotDotrotDDot(angle, angleDot, angleDDot)); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); diff --git a/OndselSolver/EulerAnglesDot.h b/OndselSolver/EulerAnglesDot.h index f427843..27bd936 100644 --- a/OndselSolver/EulerAnglesDot.h +++ b/OndselSolver/EulerAnglesDot.h @@ -56,13 +56,13 @@ namespace MbD { auto angle = aEulerAngles->at(i)->getValue(); auto angleDot = this->at(i)->getValue(); if (axis == 1) { - cAdot->atiput(i, FullMatrix::rotatexrotDot(angle, angleDot)); + cAdot->atiput(i, FullMatrixDouble::rotatexrotDot(angle, angleDot)); } else if (axis == 2) { - cAdot->atiput(i, FullMatrix::rotateyrotDot(angle, angleDot)); + cAdot->atiput(i, FullMatrixDouble::rotateyrotDot(angle, angleDot)); } else if (axis == 3) { - cAdot->atiput(i, FullMatrix::rotatezrotDot(angle, angleDot)); + cAdot->atiput(i, FullMatrixDouble::rotatezrotDot(angle, angleDot)); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); diff --git a/OndselSolver/EulerAngleszxzDot.h b/OndselSolver/EulerAngleszxzDot.h index 2037e70..03f56b7 100644 --- a/OndselSolver/EulerAngleszxzDot.h +++ b/OndselSolver/EulerAngleszxzDot.h @@ -28,11 +28,11 @@ namespace MbD { template inline void EulerAngleszxzDot::initialize() { - phiAdot = std::make_shared>(3, 3); + phiAdot = std::make_shared(3, 3); phiAdot->zeroSelf(); - theAdot = std::make_shared>(3, 3); + theAdot = std::make_shared(3, 3); theAdot->zeroSelf(); - psiAdot = std::make_shared>(3, 3); + psiAdot = std::make_shared(3, 3); psiAdot->zeroSelf(); } template diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 31b5672..7590fc1 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -63,7 +63,7 @@ inline FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) auto mc1 = -c1; auto mc2 = -c2; auto mc3 = -col->at(3); - auto answer = std::make_shared>(3, 4); + auto answer = std::make_shared(3, 4); auto& row0 = answer->at(0); auto& row1 = answer->at(1); auto& row2 = answer->at(2); @@ -92,7 +92,7 @@ inline FMatDsptr EulerParameters::pCTpEtimesColumn(FColDsptr col) auto mc0 = -c0; auto mc1 = -c1; auto mc2 = -c2; - auto answer = std::make_shared>(4, 4); + auto answer = std::make_shared(4, 4); auto& row0 = answer->at(0); auto& row1 = answer->at(1); auto& row2 = answer->at(2); @@ -126,8 +126,8 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) FRowDsptr m2m1 = a2m1->negated(); FRowDsptr m2m2 = a2m2->negated(); FRowDsptr zero = std::make_shared>(3, 0.0); - auto mat00 = std::make_shared>(ListFRD{ a2m0, m2m1, m2m2 }); - auto mat01 = std::make_shared>(ListFRD{ a2m1, a2m0, zero }); + auto mat00 = std::make_shared(ListFRD{ a2m0, m2m1, m2m2 }); + auto mat01 = std::make_shared(ListFRD{ a2m1, a2m0, zero }); auto mat02 = std::make_shared>(ListFRD{ a2m2, zero, a2m0 }); auto mat03 = std::make_shared>(ListFRD{ zero, m2m2, a2m1 }); auto mat11 = std::make_shared>(ListFRD{ m2m0, a2m1, m2m2 }); diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index efae947..e69de29 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -1,644 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2023 Ondsel, Inc. * - * * - * This file is part of OndselSolver. * - * * - * See LICENSE file for details about copyright. * - ***************************************************************************/ - -#include "FullMatrix.h" -#include "FullColumn.h" -#include "FullRow.h" -#include "DiagonalMatrix.h" -#include "EulerParameters.h" - -using namespace MbD; - -template -inline FMatsptr FullMatrix::rotatex(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 1.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, cthe); - row1->atiput(2, -sthe); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, sthe); - row2->atiput(2, cthe); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatey(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthe); - row0->atiput(1, 0.0); - row0->atiput(2, sthe); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 1.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -sthe); - row2->atiput(1, 0.0); - row2->atiput(2, cthe); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatez(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthe); - row0->atiput(1, -sthe); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, sthe); - row1->atiput(1, cthe); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 1.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatexrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 0.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, cthedot); - row1->atiput(2, -sthedot); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, sthedot); - row2->atiput(2, cthedot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotateyrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthedot); - row0->atiput(1, 0.0); - row0->atiput(2, sthedot); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 0.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -sthedot); - row2->atiput(1, 0.0); - row2->atiput(2, cthedot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatezrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthedot); - row0->atiput(1, -sthedot); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, sthedot); - row1->atiput(1, cthedot); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 0.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatexrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 0.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, ctheddot); - row1->atiput(2, -stheddot); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, stheddot); - row2->atiput(2, ctheddot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotateyrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, ctheddot); - row0->atiput(1, 0.0); - row0->atiput(2, stheddot); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 0.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -stheddot); - row2->atiput(1, 0.0); - row2->atiput(2, ctheddot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatezrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, ctheddot); - row0->atiput(1, -stheddot); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, stheddot); - row1->atiput(1, ctheddot); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 0.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::identitysptr(int n) -{ - auto mat = std::make_shared>(n, n); - mat->identity(); - return mat; -} -template -inline FMatsptr FullMatrix::tildeMatrix(FColDsptr col) -{ - //"tildeMatrix is skew symmetric matrix related to angular velocity and cross product." - if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3"); - auto tilde = std::make_shared>(3, 3); - auto c0 = col->at(0); - auto c1 = col->at(1); - auto c2 = col->at(2); - tilde->atijput(0, 0, 0.0); - tilde->atijput(1, 1, 0.0); - tilde->atijput(2, 2, 0.0); - tilde->atijput(1, 2, -c0); - tilde->atijput(0, 2, c1); - tilde->atijput(0, 1, -c2); - tilde->atijput(1, 0, c2); - tilde->atijput(2, 0, -c1); - tilde->atijput(2, 1, c0); - return tilde; -} -template<> -inline void FullMatrix::zeroSelf() -{ - for (int i = 0; i < this->size(); i++) { - this->at(i)->zeroSelf(); - } -} -template<> -inline void FullMatrix::identity() { - this->zeroSelf(); - for (int i = 0; i < this->size(); i++) { - this->at(i)->at(i) = 1.0; - } -} -template -inline FColsptr FullMatrix::column(int j) { - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->at(j); - } - return answer; -} -template -inline FMatsptr FullMatrix::timesFullMatrix(FMatsptr fullMat) -{ - int m = this->nrow(); - auto answer = std::make_shared>(m); - for (int i = 0; i < m; i++) { - answer->at(i) = this->at(i)->timesFullMatrix(fullMat); - } - return answer; -} -template -inline FMatsptr FullMatrix::timesTransposeFullMatrix(FMatsptr fullMat) -{ - int nrow = this->nrow(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) { - answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); - } - return answer; -} -template<> -inline FMatDsptr FullMatrix::times(double a) -{ - int m = this->nrow(); - auto answer = std::make_shared>(m); - for (int i = 0; i < m; i++) { - answer->at(i) = this->at(i)->times(a); - } - return answer; -} -template -inline FMatsptr FullMatrix::times(T a) -{ - assert(false); -} -template -inline FMatsptr FullMatrix::transposeTimesFullMatrix(FMatsptr fullMat) -{ - return this->transpose()->timesFullMatrix(fullMat); -} -template -inline FMatsptr FullMatrix::plusFullMatrix(FMatsptr fullMat) -{ - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); - } - return answer; -} -template -inline FMatsptr FullMatrix::minusFullMatrix(FMatsptr fullMat) -{ - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); - } - return answer; -} -template -inline FMatsptr FullMatrix::transpose() -{ - int nrow = this->nrow(); - auto ncol = this->ncol(); - auto answer = std::make_shared>(ncol, nrow); - for (int i = 0; i < nrow; i++) { - auto& row = this->at(i); - for (int j = 0; j < ncol; j++) { - answer->at(j)->at(i) = row->at(j); - } - } - return answer; -} -template -inline FMatsptr FullMatrix::negated() -{ - return this->times(-1.0); -} -template -inline void FullMatrix::symLowerWithUpper() -{ - int n = (int)this->size(); - for (int i = 0; i < n; i++) { - for (int j = i + 1; j < n; j++) { - this->at(j)->at(i) = this->at(i)->at(j); - } - } -} -template -inline void FullMatrix::atiput(int i, FRowsptr fullRow) -{ - this->at(i) = fullRow; -} -template -inline void FullMatrix::atijput(int i, int j, T value) -{ - this->at(i)->atiput(j, value); -} -template -inline void FullMatrix::atijputFullColumn(int i1, int j1, FColsptr fullCol) -{ - for (int ii = 0; ii < fullCol->size(); ii++) - { - this->at(i1 + ii)->at(j1) = fullCol->at(ii); - } -} -template -inline void FullMatrix::atijplusFullRow(int i, int j, FRowsptr fullRow) -{ - this->at(i)->atiplusFullRow(j, fullRow); -} -template -inline void FullMatrix::atijplusNumber(int i, int j, T value) -{ - auto rowi = this->at(i); - rowi->at(j) += value; -} -template -inline void FullMatrix::atijminusNumber(int i, int j, T value) -{ - auto rowi = this->at(i); - rowi->at(j) -= value; -} -template<> -inline double FullMatrix::sumOfSquares() -{ - double sum = 0.0; - for (int i = 0; i < this->size(); i++) - { - sum += this->at(i)->sumOfSquares(); - } - return sum; -} -template -inline double FullMatrix::sumOfSquares() -{ - assert(false); - return 0.0; -} -template -inline void FullMatrix::zeroSelf() -{ - assert(false); -} -template -inline FMatsptr FullMatrix::copy() -{ - auto m = (int)this->size(); - auto answer = std::make_shared>(m); - for (int i = 0; i < m; i++) - { - answer->at(i) = this->at(i)->copy(); - } - return answer; -} -template -inline FullMatrix FullMatrix::operator+(const FullMatrix fullMat) -{ - int n = (int)this->size(); - auto answer = FullMatrix(n); - for (int i = 0; i < n; i++) { - answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); - } - return answer; -} -template -inline FColsptr FullMatrix::transposeTimesFullColumn(FColsptr fullCol) -{ - auto sptr = std::make_shared>(*this); - return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); -} -template -inline void FullMatrix::magnifySelf(T factor) -{ - for (int i = 0; i < this->size(); i++) { - this->at(i)->magnifySelf(factor); - } -} -template -inline std::ostream& FullMatrix::printOn(std::ostream& s) const -{ - s << "FullMat[" << std::endl; - for (int i = 0; i < this->size(); i++) - { - s << *(this->at(i)) << std::endl; - } - s << "]"; - return s; -} -template -inline std::shared_ptr> FullMatrix::asEulerParameters() -{ - //"Given [A], compute Euler parameter." - - auto traceA = this->trace(); - T dum = 0.0; - T dumSq = 0.0; - //auto qE = CREATE>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? - auto qE = std::make_shared>(4); - qE->initialize(); - auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0; - for (int i = 0; i < 3; i++) - { - dumSq = this->at(i)->at(i) / 2.0 + OneMinusTraceDivFour; - dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; - qE->atiput(i, dum); - } - dumSq = (1.0 + traceA) / 4.0; - dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; - qE->atiput(3, dum); - T max = 0.0; - int maxE = -1; - for (int i = 0; i < 4; i++) - { - auto num = qE->at(i); - if (max < num) { - max = num; - maxE = i; - } - } - - if (maxE == 0) { - auto FourE = 4.0 * qE->at(0); - qE->atiput(1, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); - qE->atiput(2, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); - qE->atiput(3, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); - } - else if (maxE == 1) { - auto FourE = 4.0 * qE->at(1); - qE->atiput(0, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); - qE->atiput(2, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); - qE->atiput(3, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); - } - else if (maxE == 2) { - auto FourE = 4.0 * qE->at(2); - qE->atiput(0, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); - qE->atiput(1, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); - qE->atiput(3, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); - } - else if (maxE == 3) { - auto FourE = 4.0 * qE->at(3); - qE->atiput(0, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); - qE->atiput(1, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); - qE->atiput(2, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); - } - qE->conditionSelf(); - qE->calc(); - return qE; -} -template -inline T FullMatrix::trace() -{ - T trace = 0.0; - for (int i = 0; i < this->size(); i++) - { - trace += this->at(i)->at(i); - } - return trace; -} -template -inline double FullMatrix::maxMagnitude() -{ - double max = 0.0; - for (int i = 0; i < this->size(); i++) - { - double element = this->at(i)->maxMagnitude(); - if (max < element) max = element; - } - return max; -} -template -inline FColsptr FullMatrix::bryantAngles() -{ - auto answer = std::make_shared>(3); - auto sthe1y = this->at(0)->at(2); - T the0x, the1y, the2z, cthe0x, sthe0x, y, x; - if (std::abs(sthe1y) > 0.9999) { - if (sthe1y > 0.0) { - the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); - the1y = M_PI / 2.0; - the2z = 0.0; - } - else { - the0x = std::atan2(this->at(2)->at(1), this->at(2)->at(0)); - the1y = M_PI / -2.0; - the2z = 0.0; - } - } - else { - the0x = std::atan2(-this->at(1)->at(2), this->at(2)->at(2)); - cthe0x = std::cos(the0x); - sthe0x = std::sin(the0x); - y = sthe1y; - if (std::abs(cthe0x) > std::abs(sthe0x)) { - x = this->at(2)->at(2) / cthe0x; - } - else { - x = this->at(1)->at(2) / -sthe0x; - } - the1y = std::atan2(y, x); - the2z = std::atan2(-this->at(0)->at(1), this->at(0)->at(0)); - } - answer->atiput(0, the0x); - answer->atiput(1, the1y); - answer->atiput(2, the2z); - return answer; -} -template -inline bool FullMatrix::isDiagonal() -{ - auto m = this->nrow(); - auto n = this->ncol(); - if (m != n) return false; - for (int i = 0; i < m; i++) - { - auto rowi = this->at(i); - for (int j = 0; j < n; j++) - { - if (i != j && rowi->at(j) != 0) return false; - } - } - return true; -} -template -inline bool FullMatrix::isDiagonalToWithin(double ratio) -{ - double maxMag = this->maxMagnitude(); - auto tol = ratio * maxMag; - auto nrow = this->nrow(); - if (nrow == this->ncol()) { - for (int i = 0; i < 3; i++) - { - for (int j = i + 1; j < 3; j++) - { - if (std::abs(this->at(i)->at(j)) > tol) return false; - if (std::abs(this->at(j)->at(i)) > tol) return false; - } - } - return true; - } - else { - return false; - } -} -template -inline std::shared_ptr> FullMatrix::asDiagonalMatrix() -{ - int nrow = this->nrow(); - auto diagMat = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - diagMat->atiput(i, this->at(i)->at(i)); - } - return diagMat; -} -template -inline void FullMatrix::conditionSelfWithTol(double tol) -{ - for (auto row : *this) { - row->conditionSelfWithTol(tol); - } -} -template -inline FColsptr FullMatrix::timesFullColumn(FColsptr fullCol) -{ - return this->timesFullColumn(fullCol.get()); -} -template -inline FColsptr FullMatrix::timesFullColumn(FullColumn* fullCol) -{ - //"a*b = a(i,j)b(j) sum j." - auto nrow = this->nrow(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i)->timesFullColumn(fullCol); - } - return answer; -} diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 3ce6dca..1ae4f85 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -19,8 +19,13 @@ #include "RowTypeMatrix.h" namespace MbD { + template + class FullMatrix; - template + template + using FMatsptr = std::shared_ptr>; + + template class FullMatrix : public RowTypeMatrix> { public: @@ -94,5 +99,13 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; + + class FullMatrixDouble : public FullMatrix {}; + using FMatDsptr = std::shared_ptr; + + using FMatFColDsptr = std::shared_ptr>; + using FMatFMatDsptr = std::shared_ptr>; + + using FColFMatDsptr = std::shared_ptr>; } diff --git a/OndselSolver/FullMatrix.ref.h b/OndselSolver/FullMatrix.ref.h index be8b046..1cb29fa 100644 --- a/OndselSolver/FullMatrix.ref.h +++ b/OndselSolver/FullMatrix.ref.h @@ -3,18 +3,17 @@ #include "FullColumn.ref.h" namespace MbD { - template - class FullMatrix; + class FullMatrixDouble; - using FMatDsptr = std::shared_ptr>; +// using FMatDsptr = std::shared_ptr; - template - using FMatsptr = std::shared_ptr>; +// template +// using FMatsptr = std::shared_ptr>; - using FMatFColDsptr = std::shared_ptr>; - using FMatFMatDsptr = std::shared_ptr>; - - using FColFMatDsptr = std::shared_ptr>; +// using FMatFColDsptr = std::shared_ptr>; +// using FMatFMatDsptr = std::shared_ptr>; +// +// using FColFMatDsptr = std::shared_ptr>; } diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index af1b4d5..d87387b 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -12,11 +12,11 @@ using namespace MbD; template -FMatsptr FullRow::transposeTimesFullRow(FRowsptr fullRow) +std::shared_ptr FullRow::transposeTimesFullRow(std::shared_ptr fullRow) { //"a*b = a(i)b(j)" auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); + auto answer = std::make_shared(nrow); for (int i = 0; i < nrow; i++) { answer->atiput(i, fullRow->times(this->at(i))); @@ -25,7 +25,7 @@ FMatsptr FullRow::transposeTimesFullRow(FRowsptr fullRow) } template -inline FRowsptr FullRow::timesTransposeFullMatrix(FMatsptr fullMat) +inline FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) { //"a*bT = a(1,j)b(k,j)" int ncol = fullMat->nrow(); @@ -37,7 +37,7 @@ inline FRowsptr FullRow::timesTransposeFullMatrix(FMatsptr fullMat) } template -inline FRowsptr FullRow::timesFullMatrix(FMatsptr fullMat) +inline FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) { FRowsptr answer = fullMat->at(0)->times(this->at(0)); for (int j = 1; j < (int) this->size(); j++) diff --git a/OndselSolver/FullRow.h b/OndselSolver/FullRow.h index 540e1d5..78beb8d 100644 --- a/OndselSolver/FullRow.h +++ b/OndselSolver/FullRow.h @@ -30,14 +30,14 @@ namespace MbD { FRowsptr minusFullRow(FRowsptr fullRow); T timesFullColumn(FColsptr fullCol); T timesFullColumn(FullColumn* fullCol); - FRowsptr timesFullMatrix(std::shared_ptr> fullMat); - FRowsptr timesTransposeFullMatrix(std::shared_ptr> fullMat); + FRowsptr timesFullMatrix(std::shared_ptr fullMat); + FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); void equalSelfPlusFullRowTimes(FRowsptr fullRow, double factor); void equalFullRow(FRowsptr fullRow); FColsptr transpose(); FRowsptr copy(); void atiplusFullRow(int j, FRowsptr fullRow); - std::shared_ptr> transposeTimesFullRow(FRowsptr fullRow); + std::shared_ptr transposeTimesFullRow(std::shared_ptr fullRow); std::ostream& printOn(std::ostream& s) const override; }; diff --git a/OndselSolver/GeneralSpline.cpp b/OndselSolver/GeneralSpline.cpp index 9966cb9..ca3c2a1 100644 --- a/OndselSolver/GeneralSpline.cpp +++ b/OndselSolver/GeneralSpline.cpp @@ -119,7 +119,7 @@ void MbD::GeneralSpline::computeDerivatives() } auto solver = CREATE::With(); auto derivsVector = solver->solvewithsaveOriginal(matrix, bvector, false); - derivs = std::make_shared>(n, p); + derivs = std::make_shared(n, p); auto hmaxpowers = std::make_shared>(p); for (int j = 0; j < p; j++) { diff --git a/OndselSolver/LDUFullMat.cpp b/OndselSolver/LDUFullMat.cpp index 532deeb..010b21e 100644 --- a/OndselSolver/LDUFullMat.cpp +++ b/OndselSolver/LDUFullMat.cpp @@ -116,7 +116,7 @@ FMatDsptr LDUFullMat::inversesaveOriginal(FMatDsptr fullMat, bool saveOriginal) this->decomposesaveOriginal(fullMat, saveOriginal); rightHandSideB = std::make_shared>(m); - auto matrixAinverse = std::make_shared >(m, n); + auto matrixAinverse = std::make_shared (m, n); for (int j = 0; j < n; j++) { rightHandSideB->zeroSelf(); diff --git a/OndselSolver/MBDynBody.cpp b/OndselSolver/MBDynBody.cpp index 6f56cfd..396ba93 100644 --- a/OndselSolver/MBDynBody.cpp +++ b/OndselSolver/MBDynBody.cpp @@ -60,7 +60,7 @@ void MbD::MBDynBody::readInertiaMatrix(std::vector& args) { auto parser = std::make_shared(); parser->variables = mbdynVariables(); - aJmat = std::make_shared>(3, 3); + aJmat = std::make_shared(3, 3); auto& str = args.at(0); if (str.find("diag") != std::string::npos) { args.erase(args.begin()); @@ -89,7 +89,7 @@ void MbD::MBDynBody::createASMT() if (aJmat->isDiagonalToWithin(1.0e-6)) { asmtMassMarker->setMomentOfInertias(aJmat->asDiagonalMatrix()); asmtMassMarker->setPosition3D(rPcmP); - asmtMassMarker->setRotationMatrix(FullMatrix::identitysptr(3)); + asmtMassMarker->setRotationMatrix(FullMatrixDouble::identitysptr(3)); auto asmtPart = asmtAssembly()->partPartialNamed(nodeName); asmtPart->setPrincipalMassMarker(asmtMassMarker); } @@ -98,7 +98,7 @@ void MbD::MBDynBody::createASMT() solver->setm(mass); solver->setJPP(aJmat); solver->setrPoP(rPcmP); - solver->setAPo(FullMatrix::identitysptr(3)); + solver->setAPo(FullMatrixDouble::identitysptr(3)); solver->setrPcmP(rPcmP); solver->calc(); asmtMassMarker->setMomentOfInertias(solver->aJpp); diff --git a/OndselSolver/MBDynItem.cpp b/OndselSolver/MBDynItem.cpp index e87fdf2..78272b0 100644 --- a/OndselSolver/MBDynItem.cpp +++ b/OndselSolver/MBDynItem.cpp @@ -155,7 +155,7 @@ FColDsptr MbD::MBDynItem::readBasicPosition(std::vector& args) FMatDsptr MbD::MBDynItem::readOrientation(std::vector& args) { - auto aAOf = FullMatrix::identitysptr(3); + auto aAOf = FullMatrixDouble::identitysptr(3); if (args.empty()) return aAOf; auto& str = args.at(0); if (str.find("reference") != std::string::npos) { @@ -202,7 +202,7 @@ FMatDsptr MbD::MBDynItem::readBasicOrientation(std::vector& args) } if (str.find("eye") != std::string::npos) { args.erase(args.begin()); - auto aAFf = FullMatrix::identitysptr(3); + auto aAFf = FullMatrixDouble::identitysptr(3); return aAFf; } auto iss = std::istringstream(str); @@ -251,7 +251,7 @@ FMatDsptr MbD::MBDynItem::readBasicOrientation(std::vector& args) else { assert(false); } - auto aAFf = FullMatrix::identitysptr(3); + auto aAFf = FullMatrixDouble::identitysptr(3); aAFf->atijputFullColumn(0, 0, vecX); aAFf->atijputFullColumn(0, 1, vecY); aAFf->atijputFullColumn(0, 2, vecZ); diff --git a/OndselSolver/MBDynJoint.cpp b/OndselSolver/MBDynJoint.cpp index 997bf7b..02b0a45 100644 --- a/OndselSolver/MBDynJoint.cpp +++ b/OndselSolver/MBDynJoint.cpp @@ -118,7 +118,7 @@ void MbD::MBDynJoint::parseMBDyn(std::string line) mkr1->owner = this; mkr1->nodeStr = "Assembly"; mkr1->rPmP = std::make_shared>(3); - mkr1->aAPm = FullMatrix::identitysptr(3); + mkr1->aAPm = FullMatrixDouble::identitysptr(3); readMarkerJ(arguments); return; } diff --git a/OndselSolver/MBDynMarker.cpp b/OndselSolver/MBDynMarker.cpp index a8ac3a3..37fd175 100644 --- a/OndselSolver/MBDynMarker.cpp +++ b/OndselSolver/MBDynMarker.cpp @@ -11,7 +11,7 @@ using namespace MbD; void MbD::MBDynMarker::parseMBDyn(std::vector& args) { rPmP = std::make_shared>(3); - aAPm = FullMatrix::identitysptr(3); + aAPm = FullMatrixDouble::identitysptr(3); if (args.empty()) return; auto& str = args.at(0); if (str.find("reference") != std::string::npos) { diff --git a/OndselSolver/MBDynStructural.cpp b/OndselSolver/MBDynStructural.cpp index d53f5a2..992b939 100644 --- a/OndselSolver/MBDynStructural.cpp +++ b/OndselSolver/MBDynStructural.cpp @@ -12,7 +12,7 @@ using namespace MbD; MbD::MBDynStructural::MBDynStructural() { rOfO = std::make_shared>(3); - aAOf = FullMatrix::identitysptr(3); + aAOf = FullMatrixDouble::identitysptr(3); vOfO = std::make_shared>(3); omeOfO = std::make_shared>(3); } diff --git a/OndselSolver/MarkerFrame.cpp b/OndselSolver/MarkerFrame.cpp index db8fd07..72075d0 100644 --- a/OndselSolver/MarkerFrame.cpp +++ b/OndselSolver/MarkerFrame.cpp @@ -31,7 +31,7 @@ System* MarkerFrame::root() void MarkerFrame::initialize() { - prOmOpE = std::make_shared>(3, 4); + prOmOpE = std::make_shared(3, 4); pAOmpE = std::make_shared>(4); endFrames = std::make_shared>(); auto endFrm = CREATE::With(); diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index 8fd2cd6..84fcc13 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -7,7 +7,7 @@ using namespace MbD; void MbD::MomentOfInertiaSolver::example1() { - auto aJpp = std::make_shared>(ListListD{ + auto aJpp = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 2, 0 }, { 0, 0, 3 } @@ -179,10 +179,10 @@ void MbD::MomentOfInertiaSolver::calcJoo() if (!rPoP) { rPoP = rPcmP; - aAPo = FullMatrix::identitysptr(3); + aAPo = FullMatrixDouble::identitysptr(3); } - auto rocmPtilde = FullMatrix::tildeMatrix(rPcmP->minusFullColumn(rPoP)); - auto rPoPtilde = FullMatrix::tildeMatrix(rPoP); + auto rocmPtilde = FullMatrixDouble::tildeMatrix(rPcmP->minusFullColumn(rPoP)); + auto rPoPtilde = FullMatrixDouble::tildeMatrix(rPoP); auto term1 = aJPP; auto term21 = rPoPtilde->timesFullMatrix(rPoPtilde); auto term22 = rPoPtilde->timesFullMatrix(rocmPtilde); diff --git a/OndselSolver/OrbitAnglezIeqcJec.cpp b/OndselSolver/OrbitAnglezIeqcJec.cpp index b9bb400..e8d5208 100644 --- a/OndselSolver/OrbitAnglezIeqcJec.cpp +++ b/OndselSolver/OrbitAnglezIeqcJec.cpp @@ -138,9 +138,9 @@ void MbD::OrbitAngleZIeqcJec::initialize() OrbitAngleZIecJec::initialize(); pthezpXI = std::make_shared>(3); pthezpEI = std::make_shared>(4); - ppthezpXIpXI = std::make_shared>(3, 3); - ppthezpXIpEI = std::make_shared>(3, 4); - ppthezpEIpEI = std::make_shared>(4, 4); + ppthezpXIpXI = std::make_shared(3, 3); + ppthezpXIpEI = std::make_shared(3, 4); + ppthezpEIpEI = std::make_shared(4, 4); } FMatDsptr MbD::OrbitAngleZIeqcJec::ppvaluepEIpEI() diff --git a/OndselSolver/OrbitAnglezIeqcJeqc.cpp b/OndselSolver/OrbitAnglezIeqcJeqc.cpp index b8e689c..35f96ca 100644 --- a/OndselSolver/OrbitAnglezIeqcJeqc.cpp +++ b/OndselSolver/OrbitAnglezIeqcJeqc.cpp @@ -242,13 +242,13 @@ void MbD::OrbitAngleZIeqcJeqc::initialize() OrbitAngleZIeqcJec::initialize(); pthezpXJ = std::make_shared>(3); pthezpEJ = std::make_shared>(4); - ppthezpXIpXJ = std::make_shared>(3, 3); - ppthezpXIpEJ = std::make_shared>(3, 4); - ppthezpEIpXJ = std::make_shared>(4, 3); - ppthezpEIpEJ = std::make_shared>(4, 4); - ppthezpXJpXJ = std::make_shared>(3, 3); - ppthezpXJpEJ = std::make_shared>(3, 4); - ppthezpEJpEJ = std::make_shared>(4, 4); + ppthezpXIpXJ = std::make_shared(3, 3); + ppthezpXIpEJ = std::make_shared>(3, 4); + ppthezpEIpXJ = std::make_shared(4, 3); + ppthezpEIpEJ = std::make_shared(4, 4); + ppthezpXJpXJ = std::make_shared(3, 3); + ppthezpXJpEJ = std::make_shared(3, 4); + ppthezpEJpEJ = std::make_shared(4, 4); } FMatDsptr MbD::OrbitAngleZIeqcJeqc::ppvaluepEIpEJ() diff --git a/OndselSolver/Part.cpp b/OndselSolver/Part.cpp index d05ef7a..701874c 100644 --- a/OndselSolver/Part.cpp +++ b/OndselSolver/Part.cpp @@ -33,8 +33,8 @@ void Part::initialize() partFrame = CREATE::With(); partFrame->setPart(this); pTpE = std::make_shared>(4); - ppTpEpE = std::make_shared>(4, 4); - ppTpEpEdot = std::make_shared>(4, 4); + ppTpEpE = std::make_shared(4, 4); + ppTpEpEdot = std::make_shared(4, 4); } void Part::initializeLocally() diff --git a/OndselSolver/RowTypeMatrix.cpp b/OndselSolver/RowTypeMatrix.cpp index 33821e2..c607e8e 100644 --- a/OndselSolver/RowTypeMatrix.cpp +++ b/OndselSolver/RowTypeMatrix.cpp @@ -9,13 +9,3 @@ #include "RowTypeMatrix.h" using namespace MbD; - -template -int RowTypeMatrix::nrow() { - return (int) this->size(); -} - -template -int RowTypeMatrix::ncol() { - return this->at(0)->numberOfElements(); -} diff --git a/OndselSolver/RowTypeMatrix.h b/OndselSolver/RowTypeMatrix.h index 2a7fb8c..59298c9 100644 --- a/OndselSolver/RowTypeMatrix.h +++ b/OndselSolver/RowTypeMatrix.h @@ -24,8 +24,12 @@ namespace MbD { virtual void zeroSelf() override = 0; //double maxMagnitude() override; int numberOfElements() override; - int nrow(); - int ncol(); + int nrow() { + return (int) this->size(); + } + int ncol() { + return this->at(0)->numberOfElements(); + } }; template diff --git a/OndselSolver/StableBackwardDifference.cpp b/OndselSolver/StableBackwardDifference.cpp index c594e0f..09c07e3 100644 --- a/OndselSolver/StableBackwardDifference.cpp +++ b/OndselSolver/StableBackwardDifference.cpp @@ -28,7 +28,7 @@ void StableBackwardDifference::formTaylorMatrix() void StableBackwardDifference::instantiateTaylorMatrix() { if (taylorMatrix == nullptr || (taylorMatrix->nrow() != (order))) { - taylorMatrix = std::make_shared>(order, order); + taylorMatrix = std::make_shared(order, order); } } From 67bef75bab68794f6d6760be79b9668d8dab6d41 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Fri, 3 Nov 2023 21:16:49 -0500 Subject: [PATCH 02/17] hides FullMatrix; instances FullMatrixDouble FullMatrixFullMatrixDouble --- OndselSolver/ASMTAssembly.cpp | 2 +- OndselSolver/ASMTMarker.cpp | 2 +- OndselSolver/CADSystem.cpp | 38 +- OndselSolver/ConstVelConstraintIqcJc.cpp | 2 +- OndselSolver/DirectionCosineIeqcJeqc.cpp | 2 +- OndselSolver/DispCompIecJecKeqc.cpp | 2 +- OndselSolver/DispCompIeqcJecO.cpp | 2 +- OndselSolver/DispCompIeqcJeqcIe.cpp | 2 +- OndselSolver/DispCompIeqctJeqcO.cpp | 2 +- OndselSolver/DistancexyConstraintIqcJc.cpp | 14 +- OndselSolver/DistancexyConstraintIqcJqc.cpp | 26 +- OndselSolver/DistxyIeqcJeqc.cpp | 14 +- OndselSolver/EndFramec.cpp | 2 +- OndselSolver/EndFrameqc.cpp | 2 +- OndselSolver/EndFrameqct.cpp | 26 +- OndselSolver/EulerAngles.h | 16 +- OndselSolver/EulerAnglesDDot.h | 12 +- OndselSolver/EulerAnglesDot.h | 16 +- OndselSolver/EulerAngleszxz.h | 8 +- OndselSolver/EulerAngleszxzDDot.h | 10 +- OndselSolver/EulerAngleszxzDot.h | 2 +- OndselSolver/EulerParameters.cpp | 26 +- OndselSolver/EulerParameters.h | 2 +- OndselSolver/EulerParametersDot.h | 8 +- OndselSolver/FullMatrix.cpp | 698 +++++++++++++++++++ OndselSolver/FullMatrix.h | 64 +- OndselSolver/FullMatrix.ref.h | 1 + OndselSolver/FullRow.cpp | 26 +- OndselSolver/FullRow.h | 12 +- OndselSolver/GearConstraintIqcJc.cpp | 7 +- OndselSolver/GearConstraintIqcJqc.cpp | 14 +- OndselSolver/Item.h | 2 +- OndselSolver/LDUFullMat.cpp | 2 +- OndselSolver/MBDynItem.cpp | 6 +- OndselSolver/MBDynMarker.cpp | 2 +- OndselSolver/MarkerFrame.cpp | 4 +- OndselSolver/MarkerFrame.h | 4 +- OndselSolver/MomentOfInertiaSolver.cpp | 14 +- OndselSolver/OrbitAnglezIeqcJeqc.cpp | 2 +- OndselSolver/Part.cpp | 8 +- OndselSolver/RackPinConstraintIqcJc.cpp | 6 +- OndselSolver/RackPinConstraintIqcJqc.cpp | 9 +- OndselSolver/ScrewConstraintIqcJc.cpp | 6 +- OndselSolver/ScrewConstraintIqcJqc.cpp | 9 +- OndselSolver/TranslationConstraintIqcJc.cpp | 6 +- OndselSolver/TranslationConstraintIqcJqc.cpp | 4 +- 46 files changed, 966 insertions(+), 178 deletions(-) diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index 8578ea6..dc830b9 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -997,7 +997,7 @@ void MbD::ASMTAssembly::initprincipalMassMarker() principalMassMarker->density = 0.0; principalMassMarker->momentOfInertias = std::make_shared>(3, 0); //principalMassMarker->position3D = std::make_shared>(3, 0); - //principalMassMarker->rotationMatrix = FullMatrix>::identitysptr(3); + //principalMassMarker->rotationMatrix = FullMatrixDouble>::identitysptr(3); } std::shared_ptr MbD::ASMTAssembly::spatialContainerAt(std::shared_ptr self, std::string& longname) diff --git a/OndselSolver/ASMTMarker.cpp b/OndselSolver/ASMTMarker.cpp index a190e96..dd60b31 100644 --- a/OndselSolver/ASMTMarker.cpp +++ b/OndselSolver/ASMTMarker.cpp @@ -47,7 +47,7 @@ FMatDsptr MbD::ASMTMarker::aApm() auto& principalMassMarker = static_cast(refItem->owner)->principalMassMarker; auto& aAPcm = principalMassMarker->rotationMatrix; auto aApm = aAPcm->transposeTimesFullMatrix(aAPref->timesFullMatrix(aArefm)); - return aApm; + return toFMDsptr(aApm); } void MbD::ASMTMarker::createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) diff --git a/OndselSolver/CADSystem.cpp b/OndselSolver/CADSystem.cpp index baa9694..900eb83 100644 --- a/OndselSolver/CADSystem.cpp +++ b/OndselSolver/CADSystem.cpp @@ -295,7 +295,7 @@ void CADSystem::runOndselDoublePendulum() auto marker2 = CREATE::With("/Assembly1/Part1/Marker2"); rpmp = std::make_shared>(ListD{ 0.4, 0.0, 0.05 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -325,7 +325,7 @@ void CADSystem::runOndselDoublePendulum() auto marker1 = CREATE::With("/Assembly1/Part2/Marker1"); rpmp = std::make_shared>(ListD{ -0.65, 0.0, -0.05 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} @@ -336,7 +336,7 @@ void CADSystem::runOndselDoublePendulum() auto marker2 = CREATE::With("/Assembly1/Part2/Marker2"); rpmp = std::make_shared>(ListD{ 0.65, 0.0, -0.05 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} @@ -417,7 +417,7 @@ void CADSystem::runOndselPiston() auto marker2 = CREATE::With("/Assembly1/Marker2"); rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -428,7 +428,7 @@ void CADSystem::runOndselPiston() auto marker1 = CREATE::With("/Assembly1/Marker1"); rpmp = std::make_shared>(ListD{ 0.0, 3.0, 0.0 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 } @@ -460,7 +460,7 @@ void CADSystem::runOndselPiston() auto marker1 = CREATE::With("/Assembly1/Part1/Marker1"); rpmp = std::make_shared>(ListD{ -0.4, 0.0, 0.05 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -471,7 +471,7 @@ void CADSystem::runOndselPiston() auto marker2 = CREATE::With("/Assembly1/Part1/Marker2"); rpmp = std::make_shared>(ListD{ 0.4, 0.0, 0.05 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -502,7 +502,7 @@ void CADSystem::runOndselPiston() auto marker1 = CREATE::With("/Assembly1/Part2/Marker1"); rpmp = std::make_shared>(ListD{ -0.65, 0.0, -0.05 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} @@ -513,7 +513,7 @@ void CADSystem::runOndselPiston() auto marker2 = CREATE::With("/Assembly1/Part2/Marker2"); rpmp = std::make_shared>(ListD{ 0.65, 0.0, -0.05 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0} @@ -544,7 +544,7 @@ void CADSystem::runOndselPiston() auto marker1 = CREATE::With("/Assembly1/Part3/Marker1"); rpmp = std::make_shared>(ListD{ -0.5, 0.0, 0.0 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 0.0, -1.0} @@ -555,7 +555,7 @@ void CADSystem::runOndselPiston() auto marker2 = CREATE::With("/Assembly1/Part3/Marker2"); rpmp = std::make_shared>(ListD{ 0.5, 0.0, 0.0 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0} @@ -654,7 +654,7 @@ void CADSystem::runPiston() auto marker2 = CREATE::With("/Assembly1/Marker2"); rpmp = std::make_shared>(ListD{ 0.0, 0.0, 0.0 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -665,7 +665,7 @@ void CADSystem::runPiston() auto marker1 = CREATE::With("/Assembly1/Marker1"); rpmp = std::make_shared>(ListD{ 0.0, 2.8817526385684, 0.0 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 } @@ -697,7 +697,7 @@ void CADSystem::runPiston() auto marker1 = CREATE::With("/Assembly1/Part1/Marker1"); rpmp = std::make_shared>(ListD{ -0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -708,7 +708,7 @@ void CADSystem::runPiston() auto marker2 = CREATE::With("/Assembly1/Part1/Marker2"); rpmp = std::make_shared>(ListD{ 0.38423368514246, -2.6661567755108e-17, 0.048029210642807 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + aApm = std::make_shared(ListListD{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } @@ -739,7 +739,7 @@ void CADSystem::runPiston() auto marker1 = CREATE::With("/Assembly1/Part2/Marker1"); rpmp = std::make_shared>(ListD{ -0.6243797383565, 1.1997705489799e-16, -0.048029210642807 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + 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} @@ -750,7 +750,7 @@ void CADSystem::runPiston() auto marker2 = CREATE::With("/Assembly1/Part2/Marker2"); rpmp = std::make_shared>(ListD{ 0.6243797383565, -2.1329254204087e-16, -0.048029210642807 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + 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} @@ -781,7 +781,7 @@ void CADSystem::runPiston() auto marker1 = CREATE::With("/Assembly1/Part3/Marker1"); rpmp = std::make_shared>(ListD{ -0.48029210642807, 7.6201599718927e-18, -2.816737703896e-17 }); marker1->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + 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} @@ -792,7 +792,7 @@ void CADSystem::runPiston() auto marker2 = CREATE::With("/Assembly1/Part3/Marker2"); rpmp = std::make_shared>(ListD{ 0.48029210642807, 1.7618247880058e-17, 2.5155758471256e-17 }); marker2->setrpmp(rpmp); - aApm = std::make_shared>(ListListD{ + 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} diff --git a/OndselSolver/ConstVelConstraintIqcJc.cpp b/OndselSolver/ConstVelConstraintIqcJc.cpp index 992a85c..bfeaa42 100644 --- a/OndselSolver/ConstVelConstraintIqcJc.cpp +++ b/OndselSolver/ConstVelConstraintIqcJc.cpp @@ -97,7 +97,7 @@ void MbD::ConstVelConstraintIqcJc::initialize() { ConstVelConstraintIJ::initialize(); pGpEI = std::make_shared>(4); - ppGpEIpEI = std::make_shared>(4, 4); + ppGpEIpEI = std::make_shared(4, 4); } void MbD::ConstVelConstraintIqcJc::useEquationNumbers() diff --git a/OndselSolver/DirectionCosineIeqcJeqc.cpp b/OndselSolver/DirectionCosineIeqcJeqc.cpp index 52a5535..e01444f 100644 --- a/OndselSolver/DirectionCosineIeqcJeqc.cpp +++ b/OndselSolver/DirectionCosineIeqcJeqc.cpp @@ -25,7 +25,7 @@ void DirectionCosineIeqcJeqc::initialize() DirectionCosineIeqcJec::initialize(); pAijIeJepEJ = std::make_shared>(4); ppAijIeJepEIpEJ = std::make_shared(4, 4); - ppAijIeJepEJpEJ = std::make_shared>(4, 4); + ppAijIeJepEJpEJ = std::make_shared(4, 4); } void DirectionCosineIeqcJeqc::initializeGlobally() diff --git a/OndselSolver/DispCompIecJecKeqc.cpp b/OndselSolver/DispCompIecJecKeqc.cpp index efe61f5..b423512 100644 --- a/OndselSolver/DispCompIecJecKeqc.cpp +++ b/OndselSolver/DispCompIecJecKeqc.cpp @@ -22,7 +22,7 @@ DispCompIecJecKeqc::DispCompIecJecKeqc(EndFrmsptr frmi, EndFrmsptr frmj, EndFrms void DispCompIecJecKeqc::initialize() { priIeJeKepEK = std::make_shared>(4); - ppriIeJeKepEKpEK = std::make_shared>(4, 4); + ppriIeJeKepEKpEK = std::make_shared(4, 4); } void DispCompIecJecKeqc::initializeGlobally() diff --git a/OndselSolver/DispCompIeqcJecO.cpp b/OndselSolver/DispCompIeqcJecO.cpp index 87960a0..bd701fd 100644 --- a/OndselSolver/DispCompIeqcJecO.cpp +++ b/OndselSolver/DispCompIeqcJecO.cpp @@ -23,7 +23,7 @@ void DispCompIeqcJecO::initializeGlobally() { priIeJeOpXI = std::make_shared>(3, 0.0); priIeJeOpXI->at(axis) = -1.0; - ppriIeJeOpEIpEI = std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated(); + ppriIeJeOpEIpEI = toFMDsptr(std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated()); } FMatDsptr MbD::DispCompIeqcJecO::ppvaluepEIpEI() diff --git a/OndselSolver/DispCompIeqcJeqcIe.cpp b/OndselSolver/DispCompIeqcJeqcIe.cpp index e02461f..9dc5ec1 100644 --- a/OndselSolver/DispCompIeqcJeqcIe.cpp +++ b/OndselSolver/DispCompIeqcJeqcIe.cpp @@ -23,7 +23,7 @@ void MbD::DispCompIeqcJeqcIe::calc_ppvaluepEIpEJ() { auto frmJeqc = std::static_pointer_cast(frmJ); auto& prIeJeOpEJ = frmJeqc->prOeOpE; - ppriIeJeIepEIpEJ = pAjOIepEIT->timesFullMatrix(prIeJeOpEJ); + ppriIeJeIepEIpEJ = toFMDsptr(pAjOIepEIT->timesFullMatrix(prIeJeOpEJ)); } void MbD::DispCompIeqcJeqcIe::calc_ppvaluepEIpXJ() diff --git a/OndselSolver/DispCompIeqctJeqcO.cpp b/OndselSolver/DispCompIeqctJeqcO.cpp index 56b2ec2..90c4d03 100644 --- a/OndselSolver/DispCompIeqctJeqcO.cpp +++ b/OndselSolver/DispCompIeqctJeqcO.cpp @@ -39,7 +39,7 @@ void DispCompIeqctJeqcO::calcPostDynCorrectorIteration() { //"ppriIeJeOpEIpEI is not a constant now." DispCompIeqcJeqcO::calcPostDynCorrectorIteration(); - ppriIeJeOpEIpEI = std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated(); + ppriIeJeOpEIpEI = toFMDsptr(std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated()); } void DispCompIeqctJeqcO::preVelIC() diff --git a/OndselSolver/DistancexyConstraintIqcJc.cpp b/OndselSolver/DistancexyConstraintIqcJc.cpp index b60d526..1229c74 100644 --- a/OndselSolver/DistancexyConstraintIqcJc.cpp +++ b/OndselSolver/DistancexyConstraintIqcJc.cpp @@ -65,18 +65,18 @@ void MbD::DistancexyConstraintIqcJc::calc_pGpXI() void MbD::DistancexyConstraintIqcJc::calc_ppGpEIpEI() { ppGpEIpEI = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepEI())); - ppGpEIpEI = ppGpEIpEI->plusFullMatrix(xIeJeIe->ppvaluepEIpEI()->times(xIeJeIe->value())); - ppGpEIpEI = ppGpEIpEI->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEI())); - ppGpEIpEI = ppGpEIpEI->plusFullMatrix(yIeJeIe->ppvaluepEIpEI()->times(yIeJeIe->value())); + ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(xIeJeIe->ppvaluepEIpEI()->times(xIeJeIe->value()))); + ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEI()))); + ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(yIeJeIe->ppvaluepEIpEI()->times(yIeJeIe->value()))); ppGpEIpEI->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJc::calc_ppGpXIpEI() { ppGpXIpEI = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepEI())); - ppGpXIpEI = ppGpXIpEI->plusFullMatrix(xIeJeIe->ppvaluepXIpEI()->times(xIeJeIe->value())); - ppGpXIpEI = ppGpXIpEI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEI())); - ppGpXIpEI = ppGpXIpEI->plusFullMatrix(yIeJeIe->ppvaluepXIpEI()->times(yIeJeIe->value())); + ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(xIeJeIe->ppvaluepXIpEI()->times(xIeJeIe->value()))); + ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEI()))); + ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(yIeJeIe->ppvaluepXIpEI()->times(yIeJeIe->value()))); ppGpXIpEI->magnifySelf(2.0); } @@ -85,7 +85,7 @@ void MbD::DistancexyConstraintIqcJc::calc_ppGpXIpXI() //xIeJeIe ppvaluepXIpXI = 0 //yIeJeIe ppvaluepXIpXI = 0 ppGpXIpXI = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepXI())); - ppGpXIpXI = ppGpXIpXI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXI())); + ppGpXIpXI = toFMDsptr(ppGpXIpXI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXI()))); ppGpXIpXI->magnifySelf(2.0); } diff --git a/OndselSolver/DistancexyConstraintIqcJqc.cpp b/OndselSolver/DistancexyConstraintIqcJqc.cpp index 270c836..2d34f63 100644 --- a/OndselSolver/DistancexyConstraintIqcJqc.cpp +++ b/OndselSolver/DistancexyConstraintIqcJqc.cpp @@ -30,16 +30,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXIpXJ() //xIeJeIe ppvaluepXIpXJ = 0 //yIeJeIe ppvaluepXIpXJ = 0 ppGpXIpXJ = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpXIpXJ = ppGpXIpXJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); + ppGpXIpXJ = toFMDsptr(ppGpXIpXJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); ppGpXIpXJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEIpXJ() { ppGpEIpXJ = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(xIeJeIe->ppvaluepEIpXJ()->times(xIeJeIe->value())); - ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); - ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(yIeJeIe->ppvaluepEIpXJ()->times(yIeJeIe->value())); + ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(xIeJeIe->ppvaluepEIpXJ()->times(xIeJeIe->value()))); + ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); + ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(yIeJeIe->ppvaluepEIpXJ()->times(yIeJeIe->value()))); ppGpEIpXJ->magnifySelf(2.0); } @@ -48,7 +48,7 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXJpXJ() //xIeJeIe ppvaluepXJpXJ = 0 //yIeJeIe ppvaluepXJpXJ = 0 ppGpXJpXJ = (xIeJeIe->pvaluepXJ()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpXJpXJ = ppGpXJpXJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); + ppGpXJpXJ = toFMDsptr(ppGpXJpXJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); ppGpXJpXJ->magnifySelf(2.0); } @@ -57,16 +57,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXIpEJ() //xIeJeIe ppvaluepXIpEJ = 0 //yIeJeIe ppvaluepXIpEJ = 0 ppGpXIpEJ = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpXIpEJ = ppGpXIpEJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); + ppGpXIpEJ = toFMDsptr(ppGpXIpEJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); ppGpXIpEJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEIpEJ() { ppGpEIpEJ = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(xIeJeIe->ppvaluepEIpEJ()->times(xIeJeIe->value())); - ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); - ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(yIeJeIe->ppvaluepEIpEJ()->times(yIeJeIe->value())); + ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(xIeJeIe->ppvaluepEIpEJ()->times(xIeJeIe->value()))); + ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); + ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(yIeJeIe->ppvaluepEIpEJ()->times(yIeJeIe->value()))); ppGpEIpEJ->magnifySelf(2.0); } @@ -75,16 +75,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXJpEJ() //xIeJeIe ppvaluepXJpEJ = 0 //yIeJeIe ppvaluepXJpEJ = 0 ppGpXJpEJ = (xIeJeIe->pvaluepXJ()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpXJpEJ = ppGpXJpEJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); + ppGpXJpEJ = toFMDsptr(ppGpXJpEJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); ppGpXJpEJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEJpEJ() { ppGpEJpEJ = (xIeJeIe->pvaluepEJ()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(xIeJeIe->ppvaluepEJpEJ()->times(xIeJeIe->value())); - ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(yIeJeIe->pvaluepEJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); - ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(yIeJeIe->ppvaluepEJpEJ()->times(yIeJeIe->value())); + ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(xIeJeIe->ppvaluepEJpEJ()->times(xIeJeIe->value()))); + ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(yIeJeIe->pvaluepEJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); + ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(yIeJeIe->ppvaluepEJpEJ()->times(yIeJeIe->value()))); ppGpEJpEJ->magnifySelf(2.0); } diff --git a/OndselSolver/DistxyIeqcJeqc.cpp b/OndselSolver/DistxyIeqcJeqc.cpp index 92140ff..f422f2d 100644 --- a/OndselSolver/DistxyIeqcJeqc.cpp +++ b/OndselSolver/DistxyIeqcJeqc.cpp @@ -293,13 +293,13 @@ void MbD::DistxyIeqcJeqc::initialize() DistxyIeqcJec::initialize(); pdistxypXJ = std::make_shared>(3); pdistxypEJ = std::make_shared>(4); - ppdistxypXIpXJ = std::make_shared>(3, 3); - ppdistxypXIpEJ = std::make_shared>(3, 4); - ppdistxypEIpXJ = std::make_shared>(4, 3); - ppdistxypEIpEJ = std::make_shared>(4, 4); - ppdistxypXJpXJ = std::make_shared>(3, 3); - ppdistxypXJpEJ = std::make_shared>(3, 4); - ppdistxypEJpEJ = std::make_shared>(4, 4); + ppdistxypXIpXJ = std::make_shared(3, 3); + ppdistxypXIpEJ = std::make_shared(3, 4); + ppdistxypEIpXJ = std::make_shared(4, 3); + ppdistxypEIpEJ = std::make_shared(4, 4); + ppdistxypXJpXJ = std::make_shared(3, 3); + ppdistxypXJpEJ = std::make_shared(3, 4); + ppdistxypEJpEJ = std::make_shared(4, 4); } FMatDsptr MbD::DistxyIeqcJeqc::ppvaluepEIpEJ() diff --git a/OndselSolver/EndFramec.cpp b/OndselSolver/EndFramec.cpp index 84bc5bf..a7c71c9 100644 --- a/OndselSolver/EndFramec.cpp +++ b/OndselSolver/EndFramec.cpp @@ -24,7 +24,7 @@ EndFramec::EndFramec(const char* str) : CartesianFrame(str) { FMatDsptr MbD::EndFramec::aAeO() { - return aAOe->transpose(); + return toFMDsptr(aAOe->transpose()); } System* EndFramec::root() diff --git a/OndselSolver/EndFrameqc.cpp b/OndselSolver/EndFrameqc.cpp index 1837d88..61619f4 100644 --- a/OndselSolver/EndFrameqc.cpp +++ b/OndselSolver/EndFrameqc.cpp @@ -28,7 +28,7 @@ void EndFrameqc::initialize() prOeOpE = std::make_shared(3, 4); pprOeOpEpE = std::make_shared>(4, 4); pAOepE = std::make_shared>(4); - ppAOepEpE = std::make_shared>(4, 4); + ppAOepEpE = std::make_shared(4, 4); } void EndFrameqc::initializeGlobally() diff --git a/OndselSolver/EndFrameqct.cpp b/OndselSolver/EndFrameqct.cpp index 69020d3..ba8ba1f 100644 --- a/OndselSolver/EndFrameqct.cpp +++ b/OndselSolver/EndFrameqct.cpp @@ -32,12 +32,12 @@ void EndFrameqct::initialize() prmempt = std::make_shared>(3); pprmemptpt = std::make_shared>(3); aAme = FullMatrixDouble::identitysptr(3); - pAmept = std::make_shared>(3, 3); - ppAmeptpt = std::make_shared>(3, 3); - pprOeOpEpt = std::make_shared>(3, 4); + pAmept = std::make_shared(3, 3); + ppAmeptpt = std::make_shared(3, 3); + pprOeOpEpt = std::make_shared(3, 4); pprOeOptpt = std::make_shared>(3); ppAOepEpt = std::make_shared>(4); - ppAOeptpt = std::make_shared>(3, 3); + ppAOeptpt = std::make_shared(3, 3); } void EndFrameqct::initializeLocally() @@ -142,12 +142,12 @@ void EndFrameqct::calcPostDynCorrectorIteration() } auto rpep = markerFrame->rpmp->plusFullColumn(markerFrame->aApm->timesFullColumn(rmem)); pprOeOpEpE = EulerParameters::ppApEpEtimesColumn(rpep); - aAOe = aAOm->timesFullMatrix(aAme); + aAOe = toFMDsptr(aAOm->timesFullMatrix(aAme)); for (int i = 0; i < 4; i++) { - pAOepE->at(i) = pAOmpE->at(i)->timesFullMatrix(aAme); + pAOepE->at(i) = toFMDsptr(pAOmpE->at(i)->timesFullMatrix(aAme)); } - auto aApe = markerFrame->aApm->timesFullMatrix(aAme); + auto aApe = toFMDsptr(markerFrame->aApm->timesFullMatrix(aAme)); ppAOepEpE = EulerParameters::ppApEpEtimesMatrix(aApe); } @@ -196,7 +196,7 @@ void EndFrameqct::preVelIC() this->evalpAmept(); auto& aAOm = markerFrame->aAOm; prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = aAOm->timesFullMatrix(pAmept); + pAOept = toFMDsptr(aAOm->timesFullMatrix(pAmept)); } void EndFrameqct::postVelIC() @@ -213,7 +213,7 @@ void EndFrameqct::postVelIC() } for (int i = 0; i < 4; i++) { - ppAOepEpt->atiput(i, pAOmpE->at(i)->timesFullMatrix(pAmept)); + ppAOepEpt->atiput(i, toFMDsptr(pAOmpE->at(i)->timesFullMatrix(pAmept))); } } @@ -224,7 +224,7 @@ FColDsptr EndFrameqct::pAjOept(int j) FMatDsptr EndFrameqct::ppAjOepETpt(int jj) { - auto answer = std::make_shared>(4, 3); + auto answer = std::make_shared(4, 3); for (int i = 0; i < 4; i++) { auto& answeri = answer->at(i); @@ -326,7 +326,7 @@ void EndFrameqct::evalppAmeptpt() phiThePsi->calc(); phiThePsiDot->calc(); phiThePsiDDot->calc(); - ppAmeptpt = phiThePsiDDot->aAddot; + ppAmeptpt = toFMDsptr(phiThePsiDDot->aAddot); } } @@ -353,11 +353,11 @@ void EndFrameqct::preAccIC() this->evalpAmept(); auto& aAOm = markerFrame->aAOm; prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = aAOm->timesFullMatrix(pAmept); + pAOept = toFMDsptr(aAOm->timesFullMatrix(pAmept)); Item::preAccIC(); this->evalpprmemptpt(); this->evalppAmeptpt(); aAOm = markerFrame->aAOm; pprOeOptpt = aAOm->timesFullColumn(pprmemptpt); - ppAOeptpt = aAOm->timesFullMatrix(ppAmeptpt); + ppAOeptpt = toFMDsptr(aAOm->timesFullMatrix(ppAmeptpt)); } diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index 4d1ab62..030a493 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -51,19 +51,19 @@ namespace MbD { auto axis = rotOrder->at(i); auto angle = this->at(i)->getValue(); if (axis == 1) { - cA->atiput(i, FullMatrixDouble::rotatex(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatex(angle))); } else if (axis == 2) { - cA->atiput(i, FullMatrixDouble::rotatey(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatey(angle))); } else if (axis == 3) { - cA->atiput(i, FullMatrixDouble::rotatez(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatez(angle))); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); } } - aA = cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2))); + aA = toFMDsptr(cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2)))); } template<> inline void EulerAngles::calc() @@ -74,19 +74,19 @@ namespace MbD { auto axis = rotOrder->at(i); auto angle = this->at(i); if (axis == 1) { - cA->atiput(i, FullMatrixDouble::rotatex(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatex(angle))); } else if (axis == 2) { - cA->atiput(i, FullMatrixDouble::rotatey(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatey(angle))); } else if (axis == 3) { - cA->atiput(i, FullMatrix::rotatez(angle)); + cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatez(angle))); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); } } - aA = cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2))); + aA = toFMDsptr(cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2)))); } template inline void EulerAngles::calc() diff --git a/OndselSolver/EulerAnglesDDot.h b/OndselSolver/EulerAnglesDDot.h index 6dc561a..547fc2c 100644 --- a/OndselSolver/EulerAnglesDDot.h +++ b/OndselSolver/EulerAnglesDDot.h @@ -47,13 +47,13 @@ namespace MbD { auto angleDot = aEulerAnglesDot->at(i)->getValue(); auto angleDDot = this->at(i)->getValue(); if (axis == 1) { - cAddot->atiput(i, FullMatrixDouble::rotatexrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotatexrotDotrotDDot(angle, angleDot, angleDDot))); } else if (axis == 2) { - cAddot->atiput(i, FullMatrixDouble::rotateyrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotateyrotDotrotDDot(angle, angleDot, angleDDot))); } else if (axis == 3) { - cAddot->atiput(i, FullMatrixDouble::rotatezrotDotrotDDot(angle, angleDot, angleDDot)); + cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotatezrotDotrotDDot(angle, angleDot, angleDDot))); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); @@ -79,8 +79,10 @@ namespace MbD { auto term7 = phiA->timesFullMatrix(theAdot->timesFullMatrix(psiAdot)); auto term8 = phiA->timesFullMatrix(theA->timesFullMatrix(psiAddot)); - aAddot = term->plusFullMatrix(term1)->plusFullMatrix(term2)->plusFullMatrix(term3)->plusFullMatrix(term4) - ->plusFullMatrix(term5)->plusFullMatrix(term6)->plusFullMatrix(term7)->plusFullMatrix(term8); + aAddot = toFMDsptr(term->plusFullMatrix(term1)->plusFullMatrix(term2) + ->plusFullMatrix(term3)->plusFullMatrix(term4) + ->plusFullMatrix(term5)->plusFullMatrix(term6) + ->plusFullMatrix(term7)->plusFullMatrix(term8)); } template inline void EulerAnglesDDot::aEulerAngles(EulerAngles* eulerAngles) diff --git a/OndselSolver/EulerAnglesDot.h b/OndselSolver/EulerAnglesDot.h index 27bd936..1200506 100644 --- a/OndselSolver/EulerAnglesDot.h +++ b/OndselSolver/EulerAnglesDot.h @@ -56,13 +56,13 @@ namespace MbD { auto angle = aEulerAngles->at(i)->getValue(); auto angleDot = this->at(i)->getValue(); if (axis == 1) { - cAdot->atiput(i, FullMatrixDouble::rotatexrotDot(angle, angleDot)); + cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotatexrotDot(angle, angleDot))); } else if (axis == 2) { - cAdot->atiput(i, FullMatrixDouble::rotateyrotDot(angle, angleDot)); + cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotateyrotDot(angle, angleDot))); } else if (axis == 3) { - cAdot->atiput(i, FullMatrixDouble::rotatezrotDot(angle, angleDot)); + cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotatezrotDot(angle, angleDot))); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); @@ -78,12 +78,12 @@ namespace MbD { auto theAdot = cAdot->at(1); auto psiAdot = cAdot->at(2); - aAdot = phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)) - ->plusFullMatrix(phiA->timesFullMatrix(theAdot->timesFullMatrix(psiA))) - ->plusFullMatrix(phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot))); + aAdot = toFMDsptr(phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)) + ->plusFullMatrix(phiA->timesFullMatrix(theAdot->timesFullMatrix(psiA))) + ->plusFullMatrix(phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot)))); omeF = (phiA->column(0)->times(phidot) - ->plusFullColumn(phiA->timesFullMatrix(theA)->column(1)->times(thedot)) - ->plusFullColumn(aEulerAngles->aA->column(2)->times(psidot))); + ->plusFullColumn(phiA->timesFullMatrix(theA)->column(1)->times(thedot)) + ->plusFullColumn(aEulerAngles->aA->column(2)->times(psidot))); omef = aEulerAngles->aA->transposeTimesFullColumn(omeF); } } diff --git a/OndselSolver/EulerAngleszxz.h b/OndselSolver/EulerAngleszxz.h index 55dc48f..01404f5 100644 --- a/OndselSolver/EulerAngleszxz.h +++ b/OndselSolver/EulerAngleszxz.h @@ -29,9 +29,9 @@ namespace MbD { template inline void EulerAngleszxz::initialize() { - phiA = FullMatrix::identitysptr(3); - theA = FullMatrix::identitysptr(3); - psiA = FullMatrix::identitysptr(3); + phiA = FullMatrixDouble::identitysptr(3); + theA = FullMatrixDouble::identitysptr(3); + psiA = FullMatrixDouble::identitysptr(3); } template inline void EulerAngleszxz::calc() @@ -67,7 +67,7 @@ namespace MbD { psiAi = psiA->at(1); psiAi->at(0) = spsi; psiAi->at(1) = cpsi; - aA = phiA->timesFullMatrix(theA->timesFullMatrix(psiA)); + aA = toFMDsptr(phiA->timesFullMatrix(theA->timesFullMatrix(psiA))); } } diff --git a/OndselSolver/EulerAngleszxzDDot.h b/OndselSolver/EulerAngleszxzDDot.h index 69bc344..70c4b3d 100644 --- a/OndselSolver/EulerAngleszxzDDot.h +++ b/OndselSolver/EulerAngleszxzDDot.h @@ -8,6 +8,7 @@ #pragma once +#include "FullMatrix.h" #include "EulerArray.h" #include "EulerAngleszxzDot.h" @@ -23,16 +24,17 @@ namespace MbD { void calc() override; std::shared_ptr> phiThePsiDot; - FMatDsptr phiAddot, theAddot, psiAddot, aAddot; + FMatDsptr phiAddot, theAddot, psiAddot; + std::shared_ptr> aAddot; }; template inline void EulerAngleszxzDDot::initialize() { - phiAddot = std::make_shared>(3, 3); + phiAddot = std::make_shared(3, 3); phiAddot->zeroSelf(); - theAddot = std::make_shared>(3, 3); + theAddot = std::make_shared(3, 3); theAddot->zeroSelf(); - psiAddot = std::make_shared>(3, 3); + psiAddot = std::make_shared(3, 3); psiAddot->zeroSelf(); } template diff --git a/OndselSolver/EulerAngleszxzDot.h b/OndselSolver/EulerAngleszxzDot.h index 03f56b7..f7c333f 100644 --- a/OndselSolver/EulerAngleszxzDot.h +++ b/OndselSolver/EulerAngleszxzDot.h @@ -74,7 +74,7 @@ namespace MbD { auto term1 = phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)); auto term2 = phiA->timesFullMatrix(theAdot->timesFullMatrix(psiA)); auto term3 = phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot)); - aAdot = (term1->plusFullMatrix(term2))->plusFullMatrix(term3); + aAdot = toFMDsptr((term1->plusFullMatrix(term2))->plusFullMatrix(term3)); } } diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 7590fc1..27ac4f1 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -128,14 +128,14 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) FRowDsptr zero = std::make_shared>(3, 0.0); auto mat00 = std::make_shared(ListFRD{ a2m0, m2m1, m2m2 }); auto mat01 = std::make_shared(ListFRD{ a2m1, a2m0, zero }); - auto mat02 = std::make_shared>(ListFRD{ a2m2, zero, a2m0 }); - auto mat03 = std::make_shared>(ListFRD{ zero, m2m2, a2m1 }); - auto mat11 = std::make_shared>(ListFRD{ m2m0, a2m1, m2m2 }); - auto mat12 = std::make_shared>(ListFRD{ zero, a2m2, a2m1 }); - auto mat13 = std::make_shared>(ListFRD{ a2m2, zero, m2m0 }); - auto mat22 = std::make_shared>(ListFRD{ m2m0, m2m1, a2m2 }); - auto mat23 = std::make_shared>(ListFRD{ m2m1, a2m0, zero }); - auto mat33 = std::make_shared>(ListFRD{ a2m0, a2m1, a2m2 }); + auto mat02 = std::make_shared(ListFRD{ a2m2, zero, a2m0 }); + auto mat03 = std::make_shared(ListFRD{ zero, m2m2, a2m1 }); + auto mat11 = std::make_shared(ListFRD{ m2m0, a2m1, m2m2 }); + auto mat12 = std::make_shared(ListFRD{ zero, a2m2, a2m1 }); + auto mat13 = std::make_shared(ListFRD{ a2m2, zero, m2m0 }); + auto mat22 = std::make_shared(ListFRD{ m2m0, m2m1, a2m2 }); + auto mat23 = std::make_shared(ListFRD{ m2m1, a2m0, zero }); + auto mat33 = std::make_shared(ListFRD{ a2m0, a2m1, a2m2 }); auto answer = std::make_shared>(4, 4); auto& row0 = answer->at(0); row0->at(0) = mat00; @@ -157,19 +157,19 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) row3->at(1) = mat13; row3->at(2) = mat23; row3->at(3) = mat33; - return answer; + return toFMFMDsptr(answer); } template<> inline void EulerParameters::initialize() { - aA = FullMatrix::identitysptr(3); - aB = std::make_shared>(3, 4); - aC = std::make_shared>(3, 4); + aA = FullMatrixDouble::identitysptr(3); + aB = std::make_shared(3, 4); + aC = std::make_shared(3, 4); pApE = std::make_shared>(4); for (int i = 0; i < 4; i++) { - pApE->at(i) = std::make_shared>(3, 3); + pApE->at(i) = std::make_shared(3, 3); } } template diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 887ed5d..1a320ec 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -44,7 +44,7 @@ namespace MbD { static std::shared_ptr>> ppApEpEtimesColumn(FColDsptr col); static FMatDsptr pCpEtimesColumn(FColDsptr col); static FMatDsptr pCTpEtimesColumn(FColDsptr col); - static std::shared_ptr>> ppApEpEtimesMatrix(FMatDsptr mat); + static std::shared_ptr ppApEpEtimesMatrix(FMatDsptr mat); void initialize() override; diff --git a/OndselSolver/EulerParametersDot.h b/OndselSolver/EulerParametersDot.h index 46d980f..2423cc4 100644 --- a/OndselSolver/EulerParametersDot.h +++ b/OndselSolver/EulerParametersDot.h @@ -55,13 +55,13 @@ namespace MbD { template inline void EulerParametersDot::initialize() { - aAdot = std::make_shared>(3, 3); - aBdot = std::make_shared>(3, 4); - aCdot = std::make_shared>(3, 4); + aAdot = std::make_shared(3, 3); + aBdot = std::make_shared(3, 4); + aCdot = std::make_shared(3, 4); pAdotpE = std::make_shared>(4); for (int i = 0; i < 4; i++) { - pAdotpE->at(i) = std::make_shared>(3, 3); + pAdotpE->at(i) = std::make_shared(3, 3); } } diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index e69de29..1e07729 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -0,0 +1,698 @@ +/*************************************************************************** + * Copyright (c) 2023 Ondsel, Inc. * + * * + * This file is part of OndselSolver. * + * * + * See LICENSE file for details about copyright. * + ***************************************************************************/ + +#include "FullMatrix.h" +#include "FullColumn.h" +#include "FullRow.h" +#include "DiagonalMatrix.h" +#include "EulerParameters.h" + +using namespace MbD; + +template +inline FMatsptr FullMatrix::rotatex(T the) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 1.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, cthe); + row1->atiput(2, -sthe); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, sthe); + row2->atiput(2, cthe); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatey(T the) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthe); + row0->atiput(1, 0.0); + row0->atiput(2, sthe); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 1.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -sthe); + row2->atiput(1, 0.0); + row2->atiput(2, cthe); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatez(T the) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthe); + row0->atiput(1, -sthe); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, sthe); + row1->atiput(1, cthe); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 1.0); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatexrotDot(T the, T thedot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 0.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, cthedot); + row1->atiput(2, -sthedot); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, sthedot); + row2->atiput(2, cthedot); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotateyrotDot(T the, T thedot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthedot); + row0->atiput(1, 0.0); + row0->atiput(2, sthedot); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 0.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -sthedot); + row2->atiput(1, 0.0); + row2->atiput(2, cthedot); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatezrotDot(T the, T thedot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthedot); + row0->atiput(1, -sthedot); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, sthedot); + row1->atiput(1, cthedot); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 0.0); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatexrotDotrotDDot(T the, T thedot, T theddot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 0.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, ctheddot); + row1->atiput(2, -stheddot); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, stheddot); + row2->atiput(2, ctheddot); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotateyrotDotrotDDot(T the, T thedot, T theddot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, ctheddot); + row0->atiput(1, 0.0); + row0->atiput(2, stheddot); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 0.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -stheddot); + row2->atiput(1, 0.0); + row2->atiput(2, ctheddot); + return rotMat; +} +template +inline FMatsptr FullMatrix::rotatezrotDotrotDDot(T the, T thedot, T theddot) +{ + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, ctheddot); + row0->atiput(1, -stheddot); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, stheddot); + row1->atiput(1, ctheddot); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 0.0); + return rotMat; +} +template +inline FMatsptr FullMatrix::identitysptr(int n) +{ + auto mat = std::make_shared>(n, n); + mat->identity(); + return mat; +} +inline std::shared_ptr FullMatrixDouble::identitysptr(int n) +{ + auto mat = std::make_shared(n, n); + mat->identity(); + return mat; +} +inline std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) +{ + auto mat = std::make_shared(n, n); + mat->identity(); + return mat; +} +template +inline FMatsptr FullMatrix::tildeMatrix(FColDsptr col) +{ + //"tildeMatrix is skew symmetric matrix related to angular velocity and cross product." + if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3"); + auto tilde = std::make_shared(3, 3); + auto c0 = col->at(0); + auto c1 = col->at(1); + auto c2 = col->at(2); + tilde->atijput(0, 0, 0.0); + tilde->atijput(1, 1, 0.0); + tilde->atijput(2, 2, 0.0); + tilde->atijput(1, 2, -c0); + tilde->atijput(0, 2, c1); + tilde->atijput(0, 1, -c2); + tilde->atijput(1, 0, c2); + tilde->atijput(2, 0, -c1); + tilde->atijput(2, 1, c0); + return tilde; +} +template<> +inline void FullMatrix::zeroSelf() +{ + for (int i = 0; i < this->size(); i++) { + this->at(i)->zeroSelf(); + } +} +template +inline void FullMatrix::identity() { + assert(false); +} +inline void FullMatrixDouble::identity() { + this->zeroSelf(); + for (int i = 0; i < this->size(); i++) { + this->at(i)->at(i) = 1.0; + } +} +inline void FullMatrixFullMatrixDouble::identity() { + assert(false); +// this->zeroSelf(); +// for (int i = 0; i < this->size(); i++) { +// this->at(i)->at(i) = 1.0; +// } +} +template +inline FColsptr FullMatrix::column(int j) { + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->at(j); + } + return answer; +} +template +inline FMatsptr FullMatrix::timesFullMatrix(FMatsptr fullMat) +{ + int m = this->nrow(); + auto answer = std::make_shared>(m); + for (int i = 0; i < m; i++) { + answer->at(i) = this->at(i)->timesFullMatrix(fullMat); + } + return answer; +} +template +inline FMatsptr FullMatrix::timesTransposeFullMatrix(FMatsptr fullMat) +{ + assert(false); +// int nrow = this->nrow(); +// auto answer = std::make_shared>(nrow); +// for (int i = 0; i < nrow; i++) { +// answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); +// } +// return answer; +} +inline std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) +{ + int nrow = this->nrow(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) { + answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); + } + return answer; +} +inline std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) +{ + int nrow = this->nrow(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) { + answer->at(i) = this->at(i)->timesTransposeFullMatrixForFMFMDsptr(fullMat); + } + return answer; +} +inline std::shared_ptr FullMatrixDouble::times(double a) +{ + int m = this->nrow(); + auto answer = std::make_shared(m); + for (int i = 0; i < m; i++) { + // auto x = this->at(i); + answer->at(i) = this->at(i)->times(a); + } + return answer; +} +inline std::shared_ptr FullMatrixFullMatrixDouble::times(double a) +{ + assert(false); +} +template +inline FMatsptr FullMatrix::times(T a) +{ + assert(false); +} +template +inline FMatsptr FullMatrix::transposeTimesFullMatrix(FMatsptr fullMat) +{ + return this->transpose()->timesFullMatrix(fullMat); +} +template +inline FMatsptr FullMatrix::plusFullMatrix(FMatsptr fullMat) +{ + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); + } + return answer; +} +template +inline FMatsptr FullMatrix::minusFullMatrix(FMatsptr fullMat) +{ + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); + } + return answer; +} +template +inline FMatsptr FullMatrix::transpose() +{ + int nrow = this->nrow(); + auto ncol = this->ncol(); + auto answer = std::make_shared>(ncol, nrow); + for (int i = 0; i < nrow; i++) { + auto& row = this->at(i); + for (int j = 0; j < ncol; j++) { + answer->at(j)->at(i) = row->at(j); + } + } + return answer; +} +template +inline FMatsptr FullMatrix::negated() +{ + return this->times(-1.0); +} +template +inline void FullMatrix::symLowerWithUpper() +{ + int n = (int)this->size(); + for (int i = 0; i < n; i++) { + for (int j = i + 1; j < n; j++) { + this->at(j)->at(i) = this->at(i)->at(j); + } + } +} +template +inline void FullMatrix::atiput(int i, FRowsptr fullRow) +{ + this->at(i) = fullRow; +} +template +inline void FullMatrix::atijput(int i, int j, T value) +{ + this->at(i)->atiput(j, value); +} +template +inline void FullMatrix::atijputFullColumn(int i1, int j1, FColsptr fullCol) +{ + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i1 + ii)->at(j1) = fullCol->at(ii); + } +} +template +inline void FullMatrix::atijplusFullRow(int i, int j, FRowsptr fullRow) +{ + this->at(i)->atiplusFullRow(j, fullRow); +} +template +inline void FullMatrix::atijplusNumber(int i, int j, T value) +{ + auto rowi = this->at(i); + rowi->at(j) += value; +} +template +inline void FullMatrix::atijminusNumber(int i, int j, T value) +{ + auto rowi = this->at(i); + rowi->at(j) -= value; +} +inline double FullMatrixDouble::sumOfSquares() +{ + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + sum += this->at(i)->sumOfSquares(); + } + return sum; +} +inline double FullMatrixFullMatrixDouble::sumOfSquares() +{ + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + sum += this->at(i)->sumOfSquares(); + } + return sum; +} + +template +inline double FullMatrix::sumOfSquares() +{ + assert(false); + return 0.0; +} +template +inline void FullMatrix::zeroSelf() +{ + assert(false); +} +template +inline FMatsptr FullMatrix::copy() +{ + auto m = (int)this->size(); + auto answer = std::make_shared>(m); + for (int i = 0; i < m; i++) + { + answer->at(i) = this->at(i)->copy(); + } + return answer; +} +template +inline FullMatrix FullMatrix::operator+(const FullMatrix fullMat) +{ + int n = (int)this->size(); + auto answer = FullMatrix(n); + for (int i = 0; i < n; i++) { + answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); + } + return answer; +} +template +inline FColsptr FullMatrix::transposeTimesFullColumn(FColsptr fullCol) +{ + auto sptr = std::make_shared>(*this); + return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); +} +template +inline void FullMatrix::magnifySelf(T factor) +{ + for (int i = 0; i < this->size(); i++) { + this->at(i)->magnifySelf(factor); + } +} +template +inline std::ostream& FullMatrix::printOn(std::ostream& s) const +{ + s << "FullMat[" << std::endl; + for (int i = 0; i < this->size(); i++) + { + s << *(this->at(i)) << std::endl; + } + s << "]"; + return s; +} +template +inline std::shared_ptr> FullMatrix::asEulerParameters() +{ + //"Given [A], compute Euler parameter." + + auto traceA = this->trace(); + T dum = 0.0; + T dumSq = 0.0; + //auto qE = CREATE>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? + auto qE = std::make_shared>(4); + qE->initialize(); + auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0; + for (int i = 0; i < 3; i++) + { + dumSq = this->at(i)->at(i) / 2.0 + OneMinusTraceDivFour; + dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; + qE->atiput(i, dum); + } + dumSq = (1.0 + traceA) / 4.0; + dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; + qE->atiput(3, dum); + T max = 0.0; + int maxE = -1; + for (int i = 0; i < 4; i++) + { + auto num = qE->at(i); + if (max < num) { + max = num; + maxE = i; + } + } + + if (maxE == 0) { + auto FourE = 4.0 * qE->at(0); + qE->atiput(1, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); + qE->atiput(2, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); + qE->atiput(3, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); + } + else if (maxE == 1) { + auto FourE = 4.0 * qE->at(1); + qE->atiput(0, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); + qE->atiput(2, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); + qE->atiput(3, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); + } + else if (maxE == 2) { + auto FourE = 4.0 * qE->at(2); + qE->atiput(0, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); + qE->atiput(1, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); + qE->atiput(3, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); + } + else if (maxE == 3) { + auto FourE = 4.0 * qE->at(3); + qE->atiput(0, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); + qE->atiput(1, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); + qE->atiput(2, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); + } + qE->conditionSelf(); + qE->calc(); + return qE; +} +template +inline T FullMatrix::trace() +{ + T trace = 0.0; + for (int i = 0; i < this->size(); i++) + { + trace += this->at(i)->at(i); + } + return trace; +} +template +inline double FullMatrix::maxMagnitude() +{ + double max = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i)->maxMagnitude(); + if (max < element) max = element; + } + return max; +} +template +inline FColsptr FullMatrix::bryantAngles() +{ + auto answer = std::make_shared>(3); + auto sthe1y = this->at(0)->at(2); + T the0x, the1y, the2z, cthe0x, sthe0x, y, x; + if (std::abs(sthe1y) > 0.9999) { + if (sthe1y > 0.0) { + the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); + the1y = M_PI / 2.0; + the2z = 0.0; + } + else { + the0x = std::atan2(this->at(2)->at(1), this->at(2)->at(0)); + the1y = M_PI / -2.0; + the2z = 0.0; + } + } + else { + the0x = std::atan2(-this->at(1)->at(2), this->at(2)->at(2)); + cthe0x = std::cos(the0x); + sthe0x = std::sin(the0x); + y = sthe1y; + if (std::abs(cthe0x) > std::abs(sthe0x)) { + x = this->at(2)->at(2) / cthe0x; + } + else { + x = this->at(1)->at(2) / -sthe0x; + } + the1y = std::atan2(y, x); + the2z = std::atan2(-this->at(0)->at(1), this->at(0)->at(0)); + } + answer->atiput(0, the0x); + answer->atiput(1, the1y); + answer->atiput(2, the2z); + return answer; +} +template +inline bool FullMatrix::isDiagonal() +{ + auto m = this->nrow(); + auto n = this->ncol(); + if (m != n) return false; + for (int i = 0; i < m; i++) + { + auto rowi = this->at(i); + for (int j = 0; j < n; j++) + { + if (i != j && rowi->at(j) != 0) return false; + } + } + return true; +} +template +inline bool FullMatrix::isDiagonalToWithin(double ratio) +{ + double maxMag = this->maxMagnitude(); + auto tol = ratio * maxMag; + auto nrow = this->nrow(); + if (nrow == this->ncol()) { + for (int i = 0; i < 3; i++) + { + for (int j = i + 1; j < 3; j++) + { + if (std::abs(this->at(i)->at(j)) > tol) return false; + if (std::abs(this->at(j)->at(i)) > tol) return false; + } + } + return true; + } + else { + return false; + } +} +template +inline std::shared_ptr> FullMatrix::asDiagonalMatrix() +{ + int nrow = this->nrow(); + auto diagMat = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + diagMat->atiput(i, this->at(i)->at(i)); + } + return diagMat; +} +template +inline void FullMatrix::conditionSelfWithTol(double tol) +{ + for (auto row : *this) { + row->conditionSelfWithTol(tol); + } +} +template +inline FColsptr FullMatrix::timesFullColumn(FColsptr fullCol) +{ + return this->timesFullColumn(fullCol.get()); +} +template +inline FColsptr FullMatrix::timesFullColumn(FullColumn* fullCol) +{ + //"a*b = a(i,j)b(j) sum j." + auto nrow = this->nrow(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i)->timesFullColumn(fullCol); + } + return answer; +} diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 1ae4f85..ad94b0b 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -17,6 +17,7 @@ #include "DiagonalMatrix.ref.h" #include "EulerParameters.ref.h" #include "RowTypeMatrix.h" +#include "FullRow.h" // exception to normal include pattern namespace MbD { template @@ -29,8 +30,8 @@ namespace MbD { class FullMatrix : public RowTypeMatrix> { public: - FullMatrix() {} - FullMatrix(int m) : RowTypeMatrix>(m) + FullMatrix() {}; + explicit FullMatrix(int m) : RowTypeMatrix>(m) { } FullMatrix(int m, int n) { @@ -63,13 +64,16 @@ namespace MbD { static FMatsptr rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); static FMatsptr identitysptr(int n); static FMatsptr tildeMatrix(FColDsptr col); - void identity(); + + virtual void identity(); FColsptr column(int j); FColsptr timesFullColumn(FColsptr fullCol); FColsptr timesFullColumn(FullColumn* fullCol); FMatsptr timesFullMatrix(FMatsptr fullMat); - FMatsptr timesTransposeFullMatrix(FMatsptr fullMat); - FMatsptr times(T a); + + virtual FMatsptr timesTransposeFullMatrix(FMatsptr fullMat); + + FMatsptr times(T a); FMatsptr transposeTimesFullMatrix(FMatsptr fullMat); FMatsptr plusFullMatrix(FMatsptr fullMat); FMatsptr minusFullMatrix(FMatsptr fullMat); @@ -100,12 +104,54 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - class FullMatrixDouble : public FullMatrix {}; - using FMatDsptr = std::shared_ptr; + // + // FULL MATRIX DOUBLE instantiation + // + class FullMatrixDouble : public FullMatrix { + public: + FullMatrixDouble() : FullMatrix() {}; + explicit FullMatrixDouble(int m) : FullMatrix(m) {}; + FullMatrixDouble(int m, int n) : FullMatrix(m, n) {}; + FullMatrixDouble(std::initializer_list> list2D) : FullMatrix(list2D) {} + FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrix(listOfRows) {}; - using FMatFColDsptr = std::shared_ptr>; - using FMatFMatDsptr = std::shared_ptr>; + std::shared_ptr times(double a); + std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + double sumOfSquares() override; + void identity() override; + static std::shared_ptr identitysptr(int n); + }; + using FMatDsptr = std::shared_ptr; + std::shared_ptr toFMDsptr(FMatsptr s) { + return std::static_pointer_cast(s); + } + + // + // FULL MATRIX FULL MATRIX DOUBLE instantiation + // + class FullMatrixFullMatrixDouble : public FullMatrix { + public: + FullMatrixFullMatrixDouble() : FullMatrix() {}; + explicit FullMatrixFullMatrixDouble(int m) : FullMatrix(m) {}; + FullMatrixFullMatrixDouble(int m, int n) : FullMatrix(m, n) {}; + + std::shared_ptr times(double a); + std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + double sumOfSquares() override; + void identity() override; + static std::shared_ptr identitysptr(int n); + + + + }; + using FMatFMatDsptr = std::shared_ptr; + std::shared_ptr toFMFMDsptr(std::shared_ptr> s) { + return std::static_pointer_cast(s); + } using FColFMatDsptr = std::shared_ptr>; + using FMatFColDsptr = std::shared_ptr>; + + } diff --git a/OndselSolver/FullMatrix.ref.h b/OndselSolver/FullMatrix.ref.h index 1cb29fa..f250568 100644 --- a/OndselSolver/FullMatrix.ref.h +++ b/OndselSolver/FullMatrix.ref.h @@ -4,6 +4,7 @@ namespace MbD { class FullMatrixDouble; + class FullMatrixFullMatrixDouble; // using FMatDsptr = std::shared_ptr; diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index d87387b..6648076 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -12,7 +12,7 @@ using namespace MbD; template -std::shared_ptr FullRow::transposeTimesFullRow(std::shared_ptr fullRow) +std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) { //"a*b = a(i)b(j)" auto nrow = (int)this->size(); @@ -36,6 +36,18 @@ inline FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr +inline FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat) +{ + //"a*bT = a(1,j)b(k,j)" + int ncol = fullMat->nrow(); + auto answer = std::make_shared>(ncol); + for (int k = 0; k < ncol; k++) { + answer->at(k) = this->dot(fullMat->at(k)); + } + return answer; +} + template inline FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) { @@ -45,5 +57,15 @@ inline FRowsptr FullRow::timesFullMatrix(std::shared_ptr answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); } return answer; - //return FRowsptr(); +} + +template +inline FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) +{ + FRowsptr answer = fullMat->at(0)->times(this->at(0)); + for (int j = 1; j < (int) this->size(); j++) + { + answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); + } + return answer; } diff --git a/OndselSolver/FullRow.h b/OndselSolver/FullRow.h index 78beb8d..75d1935 100644 --- a/OndselSolver/FullRow.h +++ b/OndselSolver/FullRow.h @@ -30,17 +30,21 @@ namespace MbD { FRowsptr minusFullRow(FRowsptr fullRow); T timesFullColumn(FColsptr fullCol); T timesFullColumn(FullColumn* fullCol); - FRowsptr timesFullMatrix(std::shared_ptr fullMat); - FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); void equalSelfPlusFullRowTimes(FRowsptr fullRow, double factor); void equalFullRow(FRowsptr fullRow); FColsptr transpose(); FRowsptr copy(); void atiplusFullRow(int j, FRowsptr fullRow); - std::shared_ptr transposeTimesFullRow(std::shared_ptr fullRow); std::ostream& printOn(std::ostream& s) const override; - }; + FRowsptr timesFullMatrix(std::shared_ptr fullMat); + FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); + std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); + + FRowsptr timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat); + FRowsptr timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat); + // std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); + }; template<> inline FRowDsptr FullRow::times(double a) diff --git a/OndselSolver/GearConstraintIqcJc.cpp b/OndselSolver/GearConstraintIqcJc.cpp index cd348ff..a5cff8c 100644 --- a/OndselSolver/GearConstraintIqcJc.cpp +++ b/OndselSolver/GearConstraintIqcJc.cpp @@ -52,17 +52,18 @@ void MbD::GearConstraintIqcJc::calc_pGpXI() void MbD::GearConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = orbitJeIe->ppvaluepEJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepEIpEI()->times(this->ratio())); + ppGpEIpEI = toFMDsptr(orbitJeIe->ppvaluepEJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepEIpEI()->times(this->ratio()))); } void MbD::GearConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = orbitJeIe->ppvaluepXJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepXIpEI()->times(this->ratio())); + ppGpXIpEI = toFMDsptr(orbitJeIe->ppvaluepXJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepXIpEI()->times(this->ratio()))); } void MbD::GearConstraintIqcJc::calc_ppGpXIpXI() { - ppGpXIpXI = orbitJeIe->ppvaluepXJpXJ()->plusFullMatrix(orbitIeJe->ppvaluepXIpXI()->times(this->ratio())); + ppGpXIpXI = toFMDsptr(orbitJeIe->ppvaluepXJpXJ() + ->plusFullMatrix(orbitIeJe->ppvaluepXIpXI()->times(this->ratio()))); } void MbD::GearConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/GearConstraintIqcJqc.cpp b/OndselSolver/GearConstraintIqcJqc.cpp index 717c815..418f198 100644 --- a/OndselSolver/GearConstraintIqcJqc.cpp +++ b/OndselSolver/GearConstraintIqcJqc.cpp @@ -29,37 +29,37 @@ void MbD::GearConstraintIqcJqc::calc_pGpXJ() void MbD::GearConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = orbitJeIe->ppvaluepEIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpEJ()->times(this->ratio())); + ppGpEIpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpEJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = orbitJeIe->ppvaluepXIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpXJ()->times(this->ratio())); + ppGpEIpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpXJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = orbitJeIe->ppvaluepEIpEI()->plusFullMatrix(orbitIeJe->ppvaluepEJpEJ()->times(this->ratio())); + ppGpEJpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpEI()->plusFullMatrix(orbitIeJe->ppvaluepEJpEJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpXIpEJ() { - ppGpXIpEJ = orbitJeIe->ppvaluepEIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpEJ()->times(this->ratio())); + ppGpXIpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpEJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpXIpXJ() { - ppGpXIpXJ = orbitJeIe->ppvaluepXIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpXJ()->times(this->ratio())); + ppGpXIpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpXJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpXJpEJ() { - ppGpXJpEJ = orbitJeIe->ppvaluepXIpEI()->plusFullMatrix(orbitIeJe->ppvaluepXJpEJ()->times(this->ratio())); + ppGpXJpEJ = toFMDsptr(orbitJeIe->ppvaluepXIpEI()->plusFullMatrix(orbitIeJe->ppvaluepXJpEJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calc_ppGpXJpXJ() { - ppGpXJpXJ = orbitJeIe->ppvaluepXIpXI()->plusFullMatrix(orbitIeJe->ppvaluepXJpXJ()->times(this->ratio())); + ppGpXJpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpXI()->plusFullMatrix(orbitIeJe->ppvaluepXJpXJ()->times(this->ratio()))); } void MbD::GearConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/Item.h b/OndselSolver/Item.h index 79a5690..dd1a6c1 100644 --- a/OndselSolver/Item.h +++ b/OndselSolver/Item.h @@ -12,7 +12,7 @@ #include #include "FullColumn.h" -#include "FullMatrix.h" +// #include "FullMatrix.h" #include "DiagonalMatrix.h" #include "SparseMatrix.h" #include "enum.h" diff --git a/OndselSolver/LDUFullMat.cpp b/OndselSolver/LDUFullMat.cpp index 010b21e..b3d0498 100644 --- a/OndselSolver/LDUFullMat.cpp +++ b/OndselSolver/LDUFullMat.cpp @@ -63,7 +63,7 @@ void LDUFullMat::postSolve() void LDUFullMat::preSolvesaveOriginal(FMatDsptr fullMat, bool saveOriginal) { if (saveOriginal) { - matrixA = fullMat->copy(); + matrixA = toFMDsptr(fullMat->copy()); } else { matrixA = fullMat; diff --git a/OndselSolver/MBDynItem.cpp b/OndselSolver/MBDynItem.cpp index 78272b0..31a328d 100644 --- a/OndselSolver/MBDynItem.cpp +++ b/OndselSolver/MBDynItem.cpp @@ -164,7 +164,7 @@ FMatDsptr MbD::MBDynItem::readOrientation(std::vector& args) auto ref = mbdynReferences()->at(refName); auto aAFf = readBasicOrientation(args); auto aAOF = ref->aAOf; - aAOf = aAOF->timesFullMatrix(aAFf); + aAOf = toFMDsptr(aAOF->timesFullMatrix(aAFf)); } else if (str.find("hinge") != std::string::npos) { args.erase(args.begin()); @@ -300,13 +300,13 @@ FMatDsptr MbD::MBDynItem::readBasicOrientation(std::vector& args) else { assert(false); } - auto aAFf = FullMatrix::identitysptr(3); + auto aAFf = FullMatrixDouble::identitysptr(3); aAFf->atijputFullColumn(0, 0, vecX); aAFf->atijputFullColumn(0, 1, vecY); aAFf->atijputFullColumn(0, 2, vecZ); return aAFf; } - auto aAFf = FullMatrix::identitysptr(3); + auto aAFf = FullMatrixDouble::identitysptr(3); for (int i = 0; i < 3; i++) { auto rowi = aAFf->at(i); diff --git a/OndselSolver/MBDynMarker.cpp b/OndselSolver/MBDynMarker.cpp index 37fd175..9c789a3 100644 --- a/OndselSolver/MBDynMarker.cpp +++ b/OndselSolver/MBDynMarker.cpp @@ -21,7 +21,7 @@ void MbD::MBDynMarker::parseMBDyn(std::vector& args) auto rOmO = readPosition(args); auto aAOm = readOrientation(args); rPmP = aAOP->transposeTimesFullColumn(rOmO->minusFullColumn(rOPO)); - aAPm = aAOP->transposeTimesFullMatrix(aAOm); + aAPm = toFMDsptr(aAOP->transposeTimesFullMatrix(aAOm)); } else if (str.find("offset") != std::string::npos) { rPmP = readPosition(args); diff --git a/OndselSolver/MarkerFrame.cpp b/OndselSolver/MarkerFrame.cpp index 72075d0..81c115e 100644 --- a/OndselSolver/MarkerFrame.cpp +++ b/OndselSolver/MarkerFrame.cpp @@ -70,13 +70,13 @@ void MarkerFrame::calcPostDynCorrectorIteration() auto rOpO = partFrame->rOpO(); auto aAOp = partFrame->aAOp(); rOmO = rOpO->plusFullColumn(aAOp->timesFullColumn(rpmp)); - aAOm = aAOp->timesFullMatrix(aApm); + aAOm = toFMDsptr(aAOp->timesFullMatrix(aApm)); auto pAOppE = partFrame->pAOppE(); for (int i = 0; i < 4; i++) { auto& pAOppEi = pAOppE->at(i); prOmOpE->atijputFullColumn(0, i, pAOppEi->timesFullColumn(rpmp)); - pAOmpE->at(i) = pAOppEi->timesFullMatrix(aApm); + pAOmpE->at(i) = toFMDsptr(pAOppEi->timesFullMatrix(aApm)); } } diff --git a/OndselSolver/MarkerFrame.h b/OndselSolver/MarkerFrame.h index 7c67474..ac49416 100644 --- a/OndselSolver/MarkerFrame.h +++ b/OndselSolver/MarkerFrame.h @@ -72,9 +72,9 @@ namespace MbD { PartFrame* partFrame; //Use raw pointer when pointing backwards. FColDsptr rpmp = std::make_shared>(3); - FMatDsptr aApm = FullMatrix::identitysptr(3); + FMatDsptr aApm = FullMatrixDouble::identitysptr(3); FColDsptr rOmO = std::make_shared>(3); - FMatDsptr aAOm = FullMatrix::identitysptr(3); + FMatDsptr aAOm = FullMatrixDouble::identitysptr(3); FMatDsptr prOmOpE; FColFMatDsptr pAOmpE; FMatFColDsptr pprOmOpEpE; diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index 84fcc13..04240a9 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -32,7 +32,7 @@ void MbD::MomentOfInertiaSolver::example1() solver->setJPP(aJPP); auto rPoP = aApP->transposeTimesFullColumn(rpPp->negated()); solver->setrPoP(rPoP); - auto aAPo = aApP->transpose(); + auto aAPo = toFMDsptr(aApP->transpose()); solver->setAPo(aAPo); solver->setrPcmP(rPoP); solver->calc(); @@ -188,7 +188,7 @@ void MbD::MomentOfInertiaSolver::calcJoo() auto term22 = rPoPtilde->timesFullMatrix(rocmPtilde); auto term23 = term22->transpose(); auto term2 = term21->plusFullMatrix(term22)->plusFullMatrix(term23)->times(m); - aJoo = aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo); + aJoo = toFMDsptr(aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo)); aJoo->symLowerWithUpper(); aJoo->conditionSelfWithTol(aJoo->maxMagnitude() * 1.0e-6); } @@ -197,8 +197,8 @@ void MbD::MomentOfInertiaSolver::calcJpp() { //"aJcmP = aJPP + mass*(rPcmPTilde*rPcmPTilde)" - auto rPcmPtilde = FullMatrix::tildeMatrix(rPcmP); - aJcmP = aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m)); + auto rPcmPtilde = FullMatrixDouble::tildeMatrix(rPcmP); + aJcmP = toFMDsptr(aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m))); aJcmP->symLowerWithUpper(); aJcmP->conditionSelfWithTol(aJcmP->maxMagnitude() * 1.0e-6); if (aJcmP->isDiagonal()) { @@ -217,7 +217,7 @@ void MbD::MomentOfInertiaSolver::calcAPp() auto lam2 = aJpp->at(2); if (lam0 == lam1) { if (lam1 == lam2) { - aAPp = FullMatrix::identitysptr(3); + aAPp = FullMatrixDouble::identitysptr(3); } else { eigenvector1 = eigenvectorFor(lam1); @@ -238,7 +238,7 @@ void MbD::MomentOfInertiaSolver::calcAPp() if (eigenvector1->at(1) < 0.0) eigenvector1->negateSelf(); eigenvector2 = eigenvector0->cross(eigenvector1); } - aAPp = std::make_shared>(3, 3); + aAPp = std::make_shared(3, 3); aAPp->atijputFullColumn(0, 0, eigenvector0); aAPp->atijputFullColumn(0, 1, eigenvector1); aAPp->atijputFullColumn(0, 2, eigenvector2); @@ -249,7 +249,7 @@ FColDsptr MbD::MomentOfInertiaSolver::eigenvectorFor(double lam) //"[aJcmP] - lam[I]." double e0, e1, e2; - aJcmPcopy = aJcmP->copy(); + aJcmPcopy = toFMDsptr(aJcmP->copy()); colOrder = std::make_shared>(3); auto eigenvector = std::make_shared>(3); for (int i = 0; i < 3; i++) diff --git a/OndselSolver/OrbitAnglezIeqcJeqc.cpp b/OndselSolver/OrbitAnglezIeqcJeqc.cpp index 35f96ca..245fba7 100644 --- a/OndselSolver/OrbitAnglezIeqcJeqc.cpp +++ b/OndselSolver/OrbitAnglezIeqcJeqc.cpp @@ -243,7 +243,7 @@ void MbD::OrbitAngleZIeqcJeqc::initialize() pthezpXJ = std::make_shared>(3); pthezpEJ = std::make_shared>(4); ppthezpXIpXJ = std::make_shared(3, 3); - ppthezpXIpEJ = std::make_shared>(3, 4); + ppthezpXIpEJ = std::make_shared(3, 4); ppthezpEIpXJ = std::make_shared(4, 3); ppthezpEIpEJ = std::make_shared(4, 4); ppthezpXJpXJ = std::make_shared(3, 3); diff --git a/OndselSolver/Part.cpp b/OndselSolver/Part.cpp index 701874c..44e1ad0 100644 --- a/OndselSolver/Part.cpp +++ b/OndselSolver/Part.cpp @@ -462,7 +462,7 @@ void Part::calcmEdot() auto a4J = aJ->times(4.0); auto term1 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(aCdot)); auto term2 = term1->transpose(); - mEdot = term1->plusFullMatrix(term2); + mEdot = toFMDsptr(term1->plusFullMatrix(term2)); } void Part::calcpTpE() @@ -479,7 +479,7 @@ void Part::calcppTpEpE() auto& qEdot = partFrame->qEdot; auto pCpEtimesqEdot = EulerParameters::pCpEtimesColumn(qEdot); auto a4J = aJ->times(4.0); - ppTpEpE = pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot)); + ppTpEpE = toFMDsptr(pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot))); } void Part::calcppTpEpEdot() @@ -491,13 +491,13 @@ void Part::calcppTpEpEdot() auto term1 = EulerParameters::pCTpEtimesColumn(a4J->timesFullColumn(aC->timesFullColumn(qEdot))); auto pCpEtimesqEdot = EulerParameters::pCpEtimesColumn(qEdot); auto term2 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot)); - ppTpEpEdot = term1->plusFullMatrix(term2)->transpose(); + ppTpEpEdot = toFMDsptr(term1->plusFullMatrix(term2)->transpose()); } void Part::calcmE() { auto aC = partFrame->aC(); - mE = aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0); + mE = toFMDsptr(aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0)); } void Part::fillAccICIterError(FColDsptr col) diff --git a/OndselSolver/RackPinConstraintIqcJc.cpp b/OndselSolver/RackPinConstraintIqcJc.cpp index d79a3d8..3b4cebc 100644 --- a/OndselSolver/RackPinConstraintIqcJc.cpp +++ b/OndselSolver/RackPinConstraintIqcJc.cpp @@ -53,12 +53,14 @@ void MbD::RackPinConstraintIqcJc::calc_pGpXI() void MbD::RackPinConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = xIeJeIe->ppvaluepEIpEI()->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius)); + ppGpEIpEI = toFMDsptr(xIeJeIe->ppvaluepEIpEI() + ->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius))); } void MbD::RackPinConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = xIeJeIe->ppvaluepXIpEI()->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius)); + ppGpXIpEI = toFMDsptr(xIeJeIe->ppvaluepXIpEI() + ->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius))); } void MbD::RackPinConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/RackPinConstraintIqcJqc.cpp b/OndselSolver/RackPinConstraintIqcJqc.cpp index 8c25136..144b81b 100644 --- a/OndselSolver/RackPinConstraintIqcJqc.cpp +++ b/OndselSolver/RackPinConstraintIqcJqc.cpp @@ -30,17 +30,20 @@ void MbD::RackPinConstraintIqcJqc::calc_pGpXJ() void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = xIeJeIe->ppvaluepEIpEJ()->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius)); + ppGpEIpEJ = toFMDsptr(xIeJeIe->ppvaluepEIpEJ() + ->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius))); } void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = xIeJeIe->ppvaluepEIpXJ()->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius)); + ppGpEIpXJ = toFMDsptr(xIeJeIe->ppvaluepEIpXJ() + ->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius))); } void MbD::RackPinConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = xIeJeIe->ppvaluepEJpEJ()->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius)); + ppGpEJpEJ = toFMDsptr(xIeJeIe->ppvaluepEJpEJ() + ->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius))); } void MbD::RackPinConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/ScrewConstraintIqcJc.cpp b/OndselSolver/ScrewConstraintIqcJc.cpp index 463954f..9249c97 100644 --- a/OndselSolver/ScrewConstraintIqcJc.cpp +++ b/OndselSolver/ScrewConstraintIqcJc.cpp @@ -55,12 +55,14 @@ void MbD::ScrewConstraintIqcJc::calc_pGpXI() void MbD::ScrewConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI)->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch)); + ppGpEIpEI = toFMDsptr(zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch))); } void MbD::ScrewConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI)->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch)); + ppGpXIpEI = toFMDsptr(zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch))); } void MbD::ScrewConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/ScrewConstraintIqcJqc.cpp b/OndselSolver/ScrewConstraintIqcJqc.cpp index e02d7fe..18c9ce2 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.cpp +++ b/OndselSolver/ScrewConstraintIqcJqc.cpp @@ -32,17 +32,20 @@ void MbD::ScrewConstraintIqcJqc::calc_pGpXJ() void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI)->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch)); + ppGpEIpEJ = toFMDsptr(zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch))); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI)->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch)); + ppGpEIpXJ = toFMDsptr(zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch))); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI)->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch)); + ppGpEJpEJ = toFMDsptr(zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch))); } void MbD::ScrewConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/TranslationConstraintIqcJc.cpp b/OndselSolver/TranslationConstraintIqcJc.cpp index 264ebce..db2ce00 100644 --- a/OndselSolver/TranslationConstraintIqcJc.cpp +++ b/OndselSolver/TranslationConstraintIqcJc.cpp @@ -30,8 +30,10 @@ void TranslationConstraintIqcJc::calcPostDynCorrectorIteration() pGpXI = riIeqJeIeq->pvaluepXI(); pGpEI = (riIeqJeIeq->pvaluepEI())->plusFullRow(riIeqJeIeq->pvaluepEK()); ppGpXIpEI = riIeqJeIeq->ppvaluepXIpEK(); - ppGpEIpEI = riIeqJeIeq->ppvaluepEIpEI()->plusFullMatrix(riIeqJeIeq->ppvaluepEIpEK()) - ->plusFullMatrix((riIeqJeIeq->ppvaluepEIpEK()->transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK()))); + ppGpEIpEI = toFMDsptr(riIeqJeIeq->ppvaluepEIpEI() + ->plusFullMatrix(riIeqJeIeq->ppvaluepEIpEK()) + ->plusFullMatrix((riIeqJeIeq->ppvaluepEIpEK()-> + transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK())))); } void TranslationConstraintIqcJc::useEquationNumbers() diff --git a/OndselSolver/TranslationConstraintIqcJqc.cpp b/OndselSolver/TranslationConstraintIqcJqc.cpp index 5659e02..02377a4 100644 --- a/OndselSolver/TranslationConstraintIqcJqc.cpp +++ b/OndselSolver/TranslationConstraintIqcJqc.cpp @@ -28,8 +28,8 @@ void TranslationConstraintIqcJqc::calcPostDynCorrectorIteration() TranslationConstraintIqcJc::calcPostDynCorrectorIteration(); pGpXJ = riIeJeIe->pvaluepXJ(); pGpEJ = riIeJeIe->pvaluepEJ(); - ppGpEIpXJ = riIeJeIe->ppvaluepXJpEK()->transpose(); - ppGpEIpEJ = riIeJeIe->ppvaluepEJpEK()->transpose(); + ppGpEIpXJ = toFMDsptr(riIeJeIe->ppvaluepXJpEK()->transpose()); + ppGpEIpEJ = toFMDsptr(riIeJeIe->ppvaluepEJpEK()->transpose()); ppGpEJpEJ = riIeJeIe->ppvaluepEJpEJ(); } From 8408c2245e7a93d437c729b2da1118cdfba8fe9b Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sat, 4 Nov 2023 00:04:07 -0500 Subject: [PATCH 03/17] (broken) gettin' some sleep --- OndselSolver/ASMTMarker.cpp | 104 +- OndselSolver/ASMTMarker.h | 1 - OndselSolver/ASMTMotion.cpp | 58 +- OndselSolver/DiagonalMatrix.h | 6 +- OndselSolver/DispCompIeqcJecO.cpp | 2 +- OndselSolver/DispCompIeqcJeqcIe.cpp | 2 +- OndselSolver/DispCompIeqctJeqcO.cpp | 2 +- OndselSolver/DistancexyConstraintIqcJc.cpp | 14 +- OndselSolver/DistancexyConstraintIqcJqc.cpp | 26 +- OndselSolver/EndFramec.cpp | 2 +- OndselSolver/EndFrameqc.cpp | 4 +- OndselSolver/EndFrameqct.cpp | 16 +- OndselSolver/EulerAngles.cpp | 78 + OndselSolver/EulerAngles.h | 76 - OndselSolver/EulerAnglesDDot.h | 6 +- OndselSolver/EulerAnglesDot.h | 10 +- OndselSolver/EulerAngleszxz.h | 2 +- OndselSolver/EulerAngleszxzDDot.h | 4 +- OndselSolver/EulerAngleszxzDot.h | 2 +- OndselSolver/EulerParameters.cpp | 6 +- OndselSolver/EulerParameters.h | 2 +- OndselSolver/FullMatrix.cpp | 1462 +++++++++++-------- OndselSolver/FullMatrix.h | 124 +- OndselSolver/FullMatrix.ref.h | 12 +- OndselSolver/GearConstraintIqcJc.cpp | 8 +- OndselSolver/GearConstraintIqcJqc.cpp | 14 +- OndselSolver/LDUFullMat.cpp | 2 +- OndselSolver/MomentOfInertiaSolver.cpp | 2 +- OndselSolver/SparseMatrix.h | 16 +- 29 files changed, 1117 insertions(+), 946 deletions(-) diff --git a/OndselSolver/ASMTMarker.cpp b/OndselSolver/ASMTMarker.cpp index dd60b31..db8d78a 100644 --- a/OndselSolver/ASMTMarker.cpp +++ b/OndselSolver/ASMTMarker.cpp @@ -14,57 +14,57 @@ #include "MarkerFrame.h" #include "ASMTPrincipalMassMarker.h" -using namespace MbD; +namespace MbD { + void ASMTMarker::parseASMT(std::vector& lines) + { + readName(lines); + readPosition3D(lines); + readRotationMatrix(lines); + } -void MbD::ASMTMarker::parseASMT(std::vector& lines) -{ - readName(lines); - readPosition3D(lines); - readRotationMatrix(lines); -} - -FColDsptr MbD::ASMTMarker::rpmp() -{ - //p is cm - auto refItem = static_cast(owner); - auto& rPrefP = refItem->position3D; - auto& aAPref = refItem->rotationMatrix; - auto& rrefmref = position3D; - auto rPmP = rPrefP->plusFullColumn(aAPref->timesFullColumn(rrefmref)); - auto& principalMassMarker = static_cast(refItem->owner)->principalMassMarker; - auto& rPcmP = principalMassMarker->position3D; - auto& aAPcm = principalMassMarker->rotationMatrix; - auto rpmp = aAPcm->transposeTimesFullColumn(rPmP->minusFullColumn(rPcmP)); - return rpmp; -} - -FMatDsptr MbD::ASMTMarker::aApm() -{ - //p is cm - auto refItem = static_cast(owner); - auto& aAPref = refItem->rotationMatrix; - auto& aArefm = rotationMatrix; - auto& principalMassMarker = static_cast(refItem->owner)->principalMassMarker; - auto& aAPcm = principalMassMarker->rotationMatrix; - auto aApm = aAPcm->transposeTimesFullMatrix(aAPref->timesFullMatrix(aArefm)); - return toFMDsptr(aApm); -} - -void MbD::ASMTMarker::createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) -{ - auto mkr = CREATE::With(name.c_str()); - auto prt = std::static_pointer_cast(partOrAssembly()->mbdObject); - prt->partFrame->addMarkerFrame(mkr); - - mkr->rpmp = rpmp()->times(1.0 / mbdUnits->length); - mkr->aApm = aApm(); - mbdObject = mkr->endFrames->at(0); -} - -void MbD::ASMTMarker::storeOnLevel(std::ofstream& os, int level) -{ - storeOnLevelString(os, level, "Marker"); - storeOnLevelString(os, level + 1, "Name"); - storeOnLevelString(os, level + 2, name); - ASMTSpatialItem::storeOnLevel(os, level); + FColDsptr ASMTMarker::rpmp() + { + //p is cm + auto refItem = static_cast(owner); + auto& rPrefP = refItem->position3D; + auto& aAPref = refItem->rotationMatrix; + auto& rrefmref = position3D; + auto rPmP = rPrefP->plusFullColumn(aAPref->timesFullColumn(rrefmref)); + auto& principalMassMarker = static_cast(refItem->owner)->principalMassMarker; + auto& rPcmP = principalMassMarker->position3D; + auto& aAPcm = principalMassMarker->rotationMatrix; + auto rpmp = aAPcm->transposeTimesFullColumn(rPmP->minusFullColumn(rPcmP)); + return rpmp; + } + + FMatDsptr ASMTMarker::aApm() + { + //p is cm + auto refItem = static_cast(owner); + auto& aAPref = refItem->rotationMatrix; + auto& aArefm = rotationMatrix; + auto& principalMassMarker = static_cast(refItem->owner)->principalMassMarker; + auto& aAPcm = principalMassMarker->rotationMatrix; + auto aApm = aAPcm->transposeTimesFullMatrix(aAPref->timesFullMatrix(aArefm)); + return aApm; + } + + void ASMTMarker::createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) + { + auto mkr = CREATE::With(name.c_str()); + auto prt = std::static_pointer_cast(partOrAssembly()->mbdObject); + prt->partFrame->addMarkerFrame(mkr); + + mkr->rpmp = rpmp()->times(1.0 / mbdUnits->length); + mkr->aApm = aApm(); + mbdObject = mkr->endFrames->at(0); + } + + void ASMTMarker::storeOnLevel(std::ofstream& os, int level) + { + storeOnLevelString(os, level, "Marker"); + storeOnLevelString(os, level + 1, "Name"); + storeOnLevelString(os, level + 2, name); + ASMTSpatialItem::storeOnLevel(os, level); + } } diff --git a/OndselSolver/ASMTMarker.h b/OndselSolver/ASMTMarker.h index a8d8eeb..07ed6f6 100644 --- a/OndselSolver/ASMTMarker.h +++ b/OndselSolver/ASMTMarker.h @@ -23,7 +23,6 @@ namespace MbD { FMatDsptr aApm(); void createMbD(std::shared_ptr mbdSys, std::shared_ptr mbdUnits) override; void storeOnLevel(std::ofstream& os, int level) override; - }; } diff --git a/OndselSolver/ASMTMotion.cpp b/OndselSolver/ASMTMotion.cpp index 8cb66bc..884e482 100644 --- a/OndselSolver/ASMTMotion.cpp +++ b/OndselSolver/ASMTMotion.cpp @@ -9,36 +9,36 @@ #include "ASMTMotion.h" -using namespace MbD; +namespace MbD { + void ASMTMotion::readMotionSeries(std::vector& lines) + { + std::string str = lines[0]; + std::string substr = "MotionSeries"; + auto pos = str.find(substr); + assert(pos != std::string::npos); + str.erase(0, pos + substr.length()); + auto seriesName = readString(str); + assert(fullName("") == seriesName); + lines.erase(lines.begin()); + readFXonIs(lines); + readFYonIs(lines); + readFZonIs(lines); + readTXonIs(lines); + readTYonIs(lines); + readTZonIs(lines); + } -void MbD::ASMTMotion::readMotionSeries(std::vector& lines) -{ - std::string str = lines[0]; - std::string substr = "MotionSeries"; - auto pos = str.find(substr); - assert(pos != std::string::npos); - str.erase(0, pos + substr.length()); - auto seriesName = readString(str); - assert(fullName("") == seriesName); - lines.erase(lines.begin()); - readFXonIs(lines); - readFYonIs(lines); - readFZonIs(lines); - readTXonIs(lines); - readTYonIs(lines); - readTZonIs(lines); -} + void ASMTMotion::initMarkers() + { + } -void MbD::ASMTMotion::initMarkers() -{ -} + void ASMTMotion::storeOnLevel(std::ofstream& os, int level) + { + assert(false); + } -void MbD::ASMTMotion::storeOnLevel(std::ofstream& os, int level) -{ - assert(false); -} - -void MbD::ASMTMotion::storeOnTimeSeries(std::ofstream& os) -{ - assert(false); + void ASMTMotion::storeOnTimeSeries(std::ofstream& os) + { + assert(false); + } } diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index 13010c3..f158195 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -26,7 +26,7 @@ namespace MbD { void atiputDiagonalMatrix(int i, std::shared_ptr> diagMat); DiagMatsptr times(T factor); FColsptr timesFullColumn(FColsptr fullCol); - FMatsptr timesFullMatrix(FMatsptr fullMat); + FMatDsptr timesFullMatrix(FMatDsptr fullMat); int nrow() { return (int)this->size(); } @@ -79,10 +79,10 @@ namespace MbD { return answer; } template - inline FMatsptr DiagonalMatrix::timesFullMatrix(FMatsptr fullMat) + inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) { auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); + auto answer = std::make_shared(nrow); for (int i = 0; i < nrow; i++) { answer->at(i) = fullMat->at(i)->times(this->at(i)); diff --git a/OndselSolver/DispCompIeqcJecO.cpp b/OndselSolver/DispCompIeqcJecO.cpp index bd701fd..87960a0 100644 --- a/OndselSolver/DispCompIeqcJecO.cpp +++ b/OndselSolver/DispCompIeqcJecO.cpp @@ -23,7 +23,7 @@ void DispCompIeqcJecO::initializeGlobally() { priIeJeOpXI = std::make_shared>(3, 0.0); priIeJeOpXI->at(axis) = -1.0; - ppriIeJeOpEIpEI = toFMDsptr(std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated()); + ppriIeJeOpEIpEI = std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated(); } FMatDsptr MbD::DispCompIeqcJecO::ppvaluepEIpEI() diff --git a/OndselSolver/DispCompIeqcJeqcIe.cpp b/OndselSolver/DispCompIeqcJeqcIe.cpp index 9dc5ec1..e02461f 100644 --- a/OndselSolver/DispCompIeqcJeqcIe.cpp +++ b/OndselSolver/DispCompIeqcJeqcIe.cpp @@ -23,7 +23,7 @@ void MbD::DispCompIeqcJeqcIe::calc_ppvaluepEIpEJ() { auto frmJeqc = std::static_pointer_cast(frmJ); auto& prIeJeOpEJ = frmJeqc->prOeOpE; - ppriIeJeIepEIpEJ = toFMDsptr(pAjOIepEIT->timesFullMatrix(prIeJeOpEJ)); + ppriIeJeIepEIpEJ = pAjOIepEIT->timesFullMatrix(prIeJeOpEJ); } void MbD::DispCompIeqcJeqcIe::calc_ppvaluepEIpXJ() diff --git a/OndselSolver/DispCompIeqctJeqcO.cpp b/OndselSolver/DispCompIeqctJeqcO.cpp index 90c4d03..56b2ec2 100644 --- a/OndselSolver/DispCompIeqctJeqcO.cpp +++ b/OndselSolver/DispCompIeqctJeqcO.cpp @@ -39,7 +39,7 @@ void DispCompIeqctJeqcO::calcPostDynCorrectorIteration() { //"ppriIeJeOpEIpEI is not a constant now." DispCompIeqcJeqcO::calcPostDynCorrectorIteration(); - ppriIeJeOpEIpEI = toFMDsptr(std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated()); + ppriIeJeOpEIpEI = std::static_pointer_cast(frmI)->ppriOeOpEpE(axis)->negated(); } void DispCompIeqctJeqcO::preVelIC() diff --git a/OndselSolver/DistancexyConstraintIqcJc.cpp b/OndselSolver/DistancexyConstraintIqcJc.cpp index 1229c74..b60d526 100644 --- a/OndselSolver/DistancexyConstraintIqcJc.cpp +++ b/OndselSolver/DistancexyConstraintIqcJc.cpp @@ -65,18 +65,18 @@ void MbD::DistancexyConstraintIqcJc::calc_pGpXI() void MbD::DistancexyConstraintIqcJc::calc_ppGpEIpEI() { ppGpEIpEI = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepEI())); - ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(xIeJeIe->ppvaluepEIpEI()->times(xIeJeIe->value()))); - ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEI()))); - ppGpEIpEI = toFMDsptr(ppGpEIpEI->plusFullMatrix(yIeJeIe->ppvaluepEIpEI()->times(yIeJeIe->value()))); + ppGpEIpEI = ppGpEIpEI->plusFullMatrix(xIeJeIe->ppvaluepEIpEI()->times(xIeJeIe->value())); + ppGpEIpEI = ppGpEIpEI->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEI())); + ppGpEIpEI = ppGpEIpEI->plusFullMatrix(yIeJeIe->ppvaluepEIpEI()->times(yIeJeIe->value())); ppGpEIpEI->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJc::calc_ppGpXIpEI() { ppGpXIpEI = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepEI())); - ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(xIeJeIe->ppvaluepXIpEI()->times(xIeJeIe->value()))); - ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEI()))); - ppGpXIpEI = toFMDsptr(ppGpXIpEI->plusFullMatrix(yIeJeIe->ppvaluepXIpEI()->times(yIeJeIe->value()))); + ppGpXIpEI = ppGpXIpEI->plusFullMatrix(xIeJeIe->ppvaluepXIpEI()->times(xIeJeIe->value())); + ppGpXIpEI = ppGpXIpEI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEI())); + ppGpXIpEI = ppGpXIpEI->plusFullMatrix(yIeJeIe->ppvaluepXIpEI()->times(yIeJeIe->value())); ppGpXIpEI->magnifySelf(2.0); } @@ -85,7 +85,7 @@ void MbD::DistancexyConstraintIqcJc::calc_ppGpXIpXI() //xIeJeIe ppvaluepXIpXI = 0 //yIeJeIe ppvaluepXIpXI = 0 ppGpXIpXI = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepXI())); - ppGpXIpXI = toFMDsptr(ppGpXIpXI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXI()))); + ppGpXIpXI = ppGpXIpXI->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXI())); ppGpXIpXI->magnifySelf(2.0); } diff --git a/OndselSolver/DistancexyConstraintIqcJqc.cpp b/OndselSolver/DistancexyConstraintIqcJqc.cpp index 2d34f63..270c836 100644 --- a/OndselSolver/DistancexyConstraintIqcJqc.cpp +++ b/OndselSolver/DistancexyConstraintIqcJqc.cpp @@ -30,16 +30,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXIpXJ() //xIeJeIe ppvaluepXIpXJ = 0 //yIeJeIe ppvaluepXIpXJ = 0 ppGpXIpXJ = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpXIpXJ = toFMDsptr(ppGpXIpXJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); + ppGpXIpXJ = ppGpXIpXJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); ppGpXIpXJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEIpXJ() { ppGpEIpXJ = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(xIeJeIe->ppvaluepEIpXJ()->times(xIeJeIe->value()))); - ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); - ppGpEIpXJ = toFMDsptr(ppGpEIpXJ->plusFullMatrix(yIeJeIe->ppvaluepEIpXJ()->times(yIeJeIe->value()))); + ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(xIeJeIe->ppvaluepEIpXJ()->times(xIeJeIe->value())); + ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); + ppGpEIpXJ = ppGpEIpXJ->plusFullMatrix(yIeJeIe->ppvaluepEIpXJ()->times(yIeJeIe->value())); ppGpEIpXJ->magnifySelf(2.0); } @@ -48,7 +48,7 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXJpXJ() //xIeJeIe ppvaluepXJpXJ = 0 //yIeJeIe ppvaluepXJpXJ = 0 ppGpXJpXJ = (xIeJeIe->pvaluepXJ()->transposeTimesFullRow(xIeJeIe->pvaluepXJ())); - ppGpXJpXJ = toFMDsptr(ppGpXJpXJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepXJ()))); + ppGpXJpXJ = ppGpXJpXJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepXJ())); ppGpXJpXJ->magnifySelf(2.0); } @@ -57,16 +57,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXIpEJ() //xIeJeIe ppvaluepXIpEJ = 0 //yIeJeIe ppvaluepXIpEJ = 0 ppGpXIpEJ = (xIeJeIe->pvaluepXI()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpXIpEJ = toFMDsptr(ppGpXIpEJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); + ppGpXIpEJ = ppGpXIpEJ->plusFullMatrix(yIeJeIe->pvaluepXI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); ppGpXIpEJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEIpEJ() { ppGpEIpEJ = (xIeJeIe->pvaluepEI()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(xIeJeIe->ppvaluepEIpEJ()->times(xIeJeIe->value()))); - ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); - ppGpEIpEJ = toFMDsptr(ppGpEIpEJ->plusFullMatrix(yIeJeIe->ppvaluepEIpEJ()->times(yIeJeIe->value()))); + ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(xIeJeIe->ppvaluepEIpEJ()->times(xIeJeIe->value())); + ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(yIeJeIe->pvaluepEI()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); + ppGpEIpEJ = ppGpEIpEJ->plusFullMatrix(yIeJeIe->ppvaluepEIpEJ()->times(yIeJeIe->value())); ppGpEIpEJ->magnifySelf(2.0); } @@ -75,16 +75,16 @@ void MbD::DistancexyConstraintIqcJqc::calc_ppGpXJpEJ() //xIeJeIe ppvaluepXJpEJ = 0 //yIeJeIe ppvaluepXJpEJ = 0 ppGpXJpEJ = (xIeJeIe->pvaluepXJ()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpXJpEJ = toFMDsptr(ppGpXJpEJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); + ppGpXJpEJ = ppGpXJpEJ->plusFullMatrix(yIeJeIe->pvaluepXJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); ppGpXJpEJ->magnifySelf(2.0); } void MbD::DistancexyConstraintIqcJqc::calc_ppGpEJpEJ() { ppGpEJpEJ = (xIeJeIe->pvaluepEJ()->transposeTimesFullRow(xIeJeIe->pvaluepEJ())); - ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(xIeJeIe->ppvaluepEJpEJ()->times(xIeJeIe->value()))); - ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(yIeJeIe->pvaluepEJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ()))); - ppGpEJpEJ = toFMDsptr(ppGpEJpEJ->plusFullMatrix(yIeJeIe->ppvaluepEJpEJ()->times(yIeJeIe->value()))); + ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(xIeJeIe->ppvaluepEJpEJ()->times(xIeJeIe->value())); + ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(yIeJeIe->pvaluepEJ()->transposeTimesFullRow(yIeJeIe->pvaluepEJ())); + ppGpEJpEJ = ppGpEJpEJ->plusFullMatrix(yIeJeIe->ppvaluepEJpEJ()->times(yIeJeIe->value())); ppGpEJpEJ->magnifySelf(2.0); } diff --git a/OndselSolver/EndFramec.cpp b/OndselSolver/EndFramec.cpp index a7c71c9..84bc5bf 100644 --- a/OndselSolver/EndFramec.cpp +++ b/OndselSolver/EndFramec.cpp @@ -24,7 +24,7 @@ EndFramec::EndFramec(const char* str) : CartesianFrame(str) { FMatDsptr MbD::EndFramec::aAeO() { - return toFMDsptr(aAOe->transpose()); + return aAOe->transpose(); } System* EndFramec::root() diff --git a/OndselSolver/EndFrameqc.cpp b/OndselSolver/EndFrameqc.cpp index 61619f4..e710821 100644 --- a/OndselSolver/EndFrameqc.cpp +++ b/OndselSolver/EndFrameqc.cpp @@ -26,7 +26,7 @@ EndFrameqc::EndFrameqc(const char* str) : EndFramec(str) { void EndFrameqc::initialize() { prOeOpE = std::make_shared(3, 4); - pprOeOpEpE = std::make_shared>(4, 4); + pprOeOpEpE = std::make_shared(4, 4); pAOepE = std::make_shared>(4); ppAOepEpE = std::make_shared(4, 4); } @@ -59,7 +59,7 @@ void MbD::EndFrameqc::initEndFrameqct2() FMatFColDsptr EndFrameqc::ppAjOepEpE(int jj) { - auto answer = std::make_shared>(4, 4); + auto answer = std::make_shared(4, 4); for (int i = 0; i < 4; i++) { auto& answeri = answer->at(i); auto& ppAOepEipE = ppAOepEpE->at(i); diff --git a/OndselSolver/EndFrameqct.cpp b/OndselSolver/EndFrameqct.cpp index ba8ba1f..dfc7848 100644 --- a/OndselSolver/EndFrameqct.cpp +++ b/OndselSolver/EndFrameqct.cpp @@ -142,12 +142,12 @@ void EndFrameqct::calcPostDynCorrectorIteration() } auto rpep = markerFrame->rpmp->plusFullColumn(markerFrame->aApm->timesFullColumn(rmem)); pprOeOpEpE = EulerParameters::ppApEpEtimesColumn(rpep); - aAOe = toFMDsptr(aAOm->timesFullMatrix(aAme)); + aAOe = aAOm->timesFullMatrix(aAme); for (int i = 0; i < 4; i++) { - pAOepE->at(i) = toFMDsptr(pAOmpE->at(i)->timesFullMatrix(aAme)); + pAOepE->at(i) = pAOmpE->at(i)->timesFullMatrix(aAme); } - auto aApe = toFMDsptr(markerFrame->aApm->timesFullMatrix(aAme)); + auto aApe = markerFrame->aApm->timesFullMatrix(aAme); ppAOepEpE = EulerParameters::ppApEpEtimesMatrix(aApe); } @@ -196,7 +196,7 @@ void EndFrameqct::preVelIC() this->evalpAmept(); auto& aAOm = markerFrame->aAOm; prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = toFMDsptr(aAOm->timesFullMatrix(pAmept)); + pAOept = aAOm->timesFullMatrix(pAmept); } void EndFrameqct::postVelIC() @@ -213,7 +213,7 @@ void EndFrameqct::postVelIC() } for (int i = 0; i < 4; i++) { - ppAOepEpt->atiput(i, toFMDsptr(pAOmpE->at(i)->timesFullMatrix(pAmept))); + ppAOepEpt->atiput(i, pAOmpE->at(i)->timesFullMatrix(pAmept)); } } @@ -326,7 +326,7 @@ void EndFrameqct::evalppAmeptpt() phiThePsi->calc(); phiThePsiDot->calc(); phiThePsiDDot->calc(); - ppAmeptpt = toFMDsptr(phiThePsiDDot->aAddot); + ppAmeptpt = phiThePsiDDot->aAddot; } } @@ -353,11 +353,11 @@ void EndFrameqct::preAccIC() this->evalpAmept(); auto& aAOm = markerFrame->aAOm; prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = toFMDsptr(aAOm->timesFullMatrix(pAmept)); + pAOept = aAOm->timesFullMatrix(pAmept); Item::preAccIC(); this->evalpprmemptpt(); this->evalppAmeptpt(); aAOm = markerFrame->aAOm; pprOeOptpt = aAOm->timesFullColumn(pprmemptpt); - ppAOeptpt = toFMDsptr(aAOm->timesFullMatrix(ppAmeptpt)); + ppAOeptpt = aAOm->timesFullMatrix(ppAmeptpt); } diff --git a/OndselSolver/EulerAngles.cpp b/OndselSolver/EulerAngles.cpp index e2a88f9..d243282 100644 --- a/OndselSolver/EulerAngles.cpp +++ b/OndselSolver/EulerAngles.cpp @@ -7,3 +7,81 @@ ***************************************************************************/ #include "EulerAngles.h" + +namespace MbD { + template + inline void EulerAngles::initialize() + { + assert(false); + } + template<> + inline void EulerAngles::calc() + { + cA = std::make_shared>(3); + for (int i = 0; i < 3; i++) + { + auto axis = rotOrder->at(i); + auto angle = this->at(i)->getValue(); + if (axis == 1) { + cA->atiput(i, FullMatrixDouble::rotatex(angle)); + } + else if (axis == 2) { + cA->atiput(i, FullMatrixDouble::rotatey(angle)); + } + else if (axis == 3) { + cA->atiput(i, FullMatrixDouble::rotatez(angle)); + } + else { + throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); + } + } + aA = cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2))); + } + template<> + inline void EulerAngles::calc() + { + cA = std::make_shared>(3); + for (int i = 0; i < 3; i++) + { + auto axis = rotOrder->at(i); + auto angle = this->at(i); + if (axis == 1) { + cA->atiput(i, FullMatrixDouble::rotatex(angle)); + } + else if (axis == 2) { + cA->atiput(i, FullMatrixDouble::rotatey(angle)); + } + else if (axis == 3) { + cA->atiput(i, FullMatrixDouble::rotatez(angle)); + } + else { + throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); + } + } + aA = cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2))); + } + template + inline void EulerAngles::calc() + { + assert(false); + } + template + inline std::shared_ptr> EulerAngles::differentiateWRT(T var) + { + auto derivatives = std::make_shared>(); + std::transform(this->begin(), this->end(), derivatives->begin(), + [var](T term) { return term->differentiateWRT(var); } + ); + derivatives->aEulerAngles = this; + return derivatives; + } + template + inline void EulerAngles::setRotOrder(int i, int j, int k) + { + rotOrder = std::make_shared>(3); + rotOrder->at(0) = i; + rotOrder->at(1) = j; + rotOrder->at(2) = k; + } +} + diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index 030a493..ef3a678 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -16,8 +16,6 @@ #include "Symbolic.h" namespace MbD { - //template - //class EulerAnglesDot; template class EulerAngles : public EulerArray @@ -37,79 +35,5 @@ namespace MbD { FMatDsptr aA; }; - template - inline void EulerAngles::initialize() - { - assert(false); - } - template<> - inline void EulerAngles::calc() - { - cA = std::make_shared>(3); - for (int i = 0; i < 3; i++) - { - auto axis = rotOrder->at(i); - auto angle = this->at(i)->getValue(); - if (axis == 1) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatex(angle))); - } - else if (axis == 2) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatey(angle))); - } - else if (axis == 3) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatez(angle))); - } - else { - throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); - } - } - aA = toFMDsptr(cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2)))); - } - template<> - inline void EulerAngles::calc() - { - cA = std::make_shared>(3); - for (int i = 0; i < 3; i++) - { - auto axis = rotOrder->at(i); - auto angle = this->at(i); - if (axis == 1) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatex(angle))); - } - else if (axis == 2) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatey(angle))); - } - else if (axis == 3) { - cA->atiput(i, toFMDsptr(FullMatrixDouble::rotatez(angle))); - } - else { - throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); - } - } - aA = toFMDsptr(cA->at(0)->timesFullMatrix(cA->at(1)->timesFullMatrix(cA->at(2)))); - } - template - inline void EulerAngles::calc() - { - assert(false); - } - template - inline std::shared_ptr> EulerAngles::differentiateWRT(T var) - { - auto derivatives = std::make_shared>(); - std::transform(this->begin(), this->end(), derivatives->begin(), - [var](T term) { return term->differentiateWRT(var); } - ); - derivatives->aEulerAngles = this; - return derivatives; - } - template - inline void EulerAngles::setRotOrder(int i, int j, int k) - { - rotOrder = std::make_shared>(3); - rotOrder->at(0) = i; - rotOrder->at(1) = j; - rotOrder->at(2) = k; - } } diff --git a/OndselSolver/EulerAnglesDDot.h b/OndselSolver/EulerAnglesDDot.h index 547fc2c..f724905 100644 --- a/OndselSolver/EulerAnglesDDot.h +++ b/OndselSolver/EulerAnglesDDot.h @@ -47,13 +47,13 @@ namespace MbD { auto angleDot = aEulerAnglesDot->at(i)->getValue(); auto angleDDot = this->at(i)->getValue(); if (axis == 1) { - cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotatexrotDotrotDDot(angle, angleDot, angleDDot))); + cAddot->atiput(i, FullMatrixDouble::rotatexrotDotrotDDot(angle, angleDot, angleDDot)); } else if (axis == 2) { - cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotateyrotDotrotDDot(angle, angleDot, angleDDot))); + cAddot->atiput(i, FullMatrixDouble::rotateyrotDotrotDDot(angle, angleDot, angleDDot)); } else if (axis == 3) { - cAddot->atiput(i, toFMDsptr(FullMatrixDouble::rotatezrotDotrotDDot(angle, angleDot, angleDDot))); + cAddot->atiput(i, FullMatrixDouble::rotatezrotDotrotDDot(angle, angleDot, angleDDot)); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); diff --git a/OndselSolver/EulerAnglesDot.h b/OndselSolver/EulerAnglesDot.h index 1200506..e02c7a3 100644 --- a/OndselSolver/EulerAnglesDot.h +++ b/OndselSolver/EulerAnglesDot.h @@ -56,13 +56,13 @@ namespace MbD { auto angle = aEulerAngles->at(i)->getValue(); auto angleDot = this->at(i)->getValue(); if (axis == 1) { - cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotatexrotDot(angle, angleDot))); + cAdot->atiput(i, FullMatrixDouble::rotatexrotDot(angle, angleDot)); } else if (axis == 2) { - cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotateyrotDot(angle, angleDot))); + cAdot->atiput(i, FullMatrixDouble::rotateyrotDot(angle, angleDot)); } else if (axis == 3) { - cAdot->atiput(i, toFMDsptr(FullMatrixDouble::rotatezrotDot(angle, angleDot))); + cAdot->atiput(i, FullMatrixDouble::rotatezrotDot(angle, angleDot)); } else { throw std::runtime_error("Euler angle rotation order must be any permutation of 1,2,3 without consecutive repeats."); @@ -78,9 +78,9 @@ namespace MbD { auto theAdot = cAdot->at(1); auto psiAdot = cAdot->at(2); - aAdot = toFMDsptr(phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)) + aAdot = phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)) ->plusFullMatrix(phiA->timesFullMatrix(theAdot->timesFullMatrix(psiA))) - ->plusFullMatrix(phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot)))); + ->plusFullMatrix(phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot))); omeF = (phiA->column(0)->times(phidot) ->plusFullColumn(phiA->timesFullMatrix(theA)->column(1)->times(thedot)) ->plusFullColumn(aEulerAngles->aA->column(2)->times(psidot))); diff --git a/OndselSolver/EulerAngleszxz.h b/OndselSolver/EulerAngleszxz.h index 01404f5..23a7617 100644 --- a/OndselSolver/EulerAngleszxz.h +++ b/OndselSolver/EulerAngleszxz.h @@ -67,7 +67,7 @@ namespace MbD { psiAi = psiA->at(1); psiAi->at(0) = spsi; psiAi->at(1) = cpsi; - aA = toFMDsptr(phiA->timesFullMatrix(theA->timesFullMatrix(psiA))); + aA = phiA->timesFullMatrix(theA->timesFullMatrix(psiA)); } } diff --git a/OndselSolver/EulerAngleszxzDDot.h b/OndselSolver/EulerAngleszxzDDot.h index 70c4b3d..10879af 100644 --- a/OndselSolver/EulerAngleszxzDDot.h +++ b/OndselSolver/EulerAngleszxzDDot.h @@ -25,7 +25,7 @@ namespace MbD { std::shared_ptr> phiThePsiDot; FMatDsptr phiAddot, theAddot, psiAddot; - std::shared_ptr> aAddot; + std::shared_ptr aAddot; }; template inline void EulerAngleszxzDDot::initialize() @@ -92,7 +92,7 @@ namespace MbD { + *(phiAdot->timesFullMatrix(theA->timesFullMatrix(psiAdot))) + *(phiA->timesFullMatrix(theAdot->timesFullMatrix(psiAdot))) + *(phiA->timesFullMatrix(theA->timesFullMatrix(psiAddot))); - aAddot = std::make_shared>(mat); + aAddot = std::make_shared(mat); } } diff --git a/OndselSolver/EulerAngleszxzDot.h b/OndselSolver/EulerAngleszxzDot.h index f7c333f..03f56b7 100644 --- a/OndselSolver/EulerAngleszxzDot.h +++ b/OndselSolver/EulerAngleszxzDot.h @@ -74,7 +74,7 @@ namespace MbD { auto term1 = phiAdot->timesFullMatrix(theA->timesFullMatrix(psiA)); auto term2 = phiA->timesFullMatrix(theAdot->timesFullMatrix(psiA)); auto term3 = phiA->timesFullMatrix(theA->timesFullMatrix(psiAdot)); - aAdot = toFMDsptr((term1->plusFullMatrix(term2))->plusFullMatrix(term3)); + aAdot = (term1->plusFullMatrix(term2))->plusFullMatrix(term3); } } diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 27ac4f1..4c4b999 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -28,7 +28,7 @@ inline FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) auto col22 = std::make_shared>(ListD{ m2c0, m2c1, a2c2 }); auto col23 = std::make_shared>(ListD{ m2c1, a2c0, 0 }); auto col33 = std::make_shared>(ListD{ a2c0, a2c1, a2c2 }); - auto answer = std::make_shared>(4, 4); + auto answer = std::make_shared(4, 4); auto& row0 = answer->at(0); row0->at(0) = col00; row0->at(1) = col01; @@ -136,7 +136,7 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) auto mat22 = std::make_shared(ListFRD{ m2m0, m2m1, a2m2 }); auto mat23 = std::make_shared(ListFRD{ m2m1, a2m0, zero }); auto mat33 = std::make_shared(ListFRD{ a2m0, a2m1, a2m2 }); - auto answer = std::make_shared>(4, 4); + auto answer = std::make_shared(4, 4); auto& row0 = answer->at(0); row0->at(0) = mat00; row0->at(1) = mat01; @@ -157,7 +157,7 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) row3->at(1) = mat13; row3->at(2) = mat23; row3->at(3) = mat33; - return toFMFMDsptr(answer); + return answer; } template<> diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 1a320ec..05d475b 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -41,7 +41,7 @@ namespace MbD { this->calc(); } - static std::shared_ptr>> ppApEpEtimesColumn(FColDsptr col); + static std::shared_ptr ppApEpEtimesColumn(FColDsptr col); static FMatDsptr pCpEtimesColumn(FColDsptr col); static FMatDsptr pCTpEtimesColumn(FColDsptr col); static std::shared_ptr ppApEpEtimesMatrix(FMatDsptr mat); diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 1e07729..5989ad5 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -12,687 +12,855 @@ #include "DiagonalMatrix.h" #include "EulerParameters.h" -using namespace MbD; - -template -inline FMatsptr FullMatrix::rotatex(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 1.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, cthe); - row1->atiput(2, -sthe); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, sthe); - row2->atiput(2, cthe); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatey(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthe); - row0->atiput(1, 0.0); - row0->atiput(2, sthe); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 1.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -sthe); - row2->atiput(1, 0.0); - row2->atiput(2, cthe); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatez(T the) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthe); - row0->atiput(1, -sthe); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, sthe); - row1->atiput(1, cthe); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 1.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatexrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 0.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, cthedot); - row1->atiput(2, -sthedot); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, sthedot); - row2->atiput(2, cthedot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotateyrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthedot); - row0->atiput(1, 0.0); - row0->atiput(2, sthedot); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 0.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -sthedot); - row2->atiput(1, 0.0); - row2->atiput(2, cthedot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatezrotDot(T the, T thedot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, cthedot); - row0->atiput(1, -sthedot); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, sthedot); - row1->atiput(1, cthedot); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 0.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatexrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, 0.0); - row0->atiput(1, 0.0); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, ctheddot); - row1->atiput(2, -stheddot); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, stheddot); - row2->atiput(2, ctheddot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotateyrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, ctheddot); - row0->atiput(1, 0.0); - row0->atiput(2, stheddot); - auto row1 = rotMat->at(1); - row1->atiput(0, 0.0); - row1->atiput(1, 0.0); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, -stheddot); - row2->atiput(1, 0.0); - row2->atiput(2, ctheddot); - return rotMat; -} -template -inline FMatsptr FullMatrix::rotatezrotDotrotDDot(T the, T thedot, T theddot) -{ - auto sthe = std::sin(the); - auto cthe = std::cos(the); - auto sthedot = cthe * thedot; - auto cthedot = -sthe * thedot; - auto stheddot = cthedot * thedot + (cthe * theddot); - auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); - auto row0 = rotMat->at(0); - row0->atiput(0, ctheddot); - row0->atiput(1, -stheddot); - row0->atiput(2, 0.0); - auto row1 = rotMat->at(1); - row1->atiput(0, stheddot); - row1->atiput(1, ctheddot); - row1->atiput(2, 0.0); - auto row2 = rotMat->at(2); - row2->atiput(0, 0.0); - row2->atiput(1, 0.0); - row2->atiput(2, 0.0); - return rotMat; -} -template -inline FMatsptr FullMatrix::identitysptr(int n) -{ - auto mat = std::make_shared>(n, n); - mat->identity(); - return mat; -} -inline std::shared_ptr FullMatrixDouble::identitysptr(int n) -{ - auto mat = std::make_shared(n, n); - mat->identity(); - return mat; -} -inline std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) -{ - auto mat = std::make_shared(n, n); - mat->identity(); - return mat; -} -template -inline FMatsptr FullMatrix::tildeMatrix(FColDsptr col) -{ - //"tildeMatrix is skew symmetric matrix related to angular velocity and cross product." - if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3"); - auto tilde = std::make_shared(3, 3); - auto c0 = col->at(0); - auto c1 = col->at(1); - auto c2 = col->at(2); - tilde->atijput(0, 0, 0.0); - tilde->atijput(1, 1, 0.0); - tilde->atijput(2, 2, 0.0); - tilde->atijput(1, 2, -c0); - tilde->atijput(0, 2, c1); - tilde->atijput(0, 1, -c2); - tilde->atijput(1, 0, c2); - tilde->atijput(2, 0, -c1); - tilde->atijput(2, 1, c0); - return tilde; -} -template<> -inline void FullMatrix::zeroSelf() -{ - for (int i = 0; i < this->size(); i++) { - this->at(i)->zeroSelf(); +namespace MbD { +// template +// +// inline std::shared_ptr> rotatex(T the) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, 1.0); +// row0->atiput(1, 0.0); +// row0->atiput(2, 0.0); +// auto row1 = rotMat->at(1); +// row1->atiput(0, 0.0); +// row1->atiput(1, cthe); +// row1->atiput(2, -sthe); +// auto row2 = rotMat->at(2); +// row2->atiput(0, 0.0); +// row2->atiput(1, sthe); +// row2->atiput(2, cthe); +// return rotMat; +// } +// template +// inline std::shared_ptr> rotatey(T the) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, cthe); +// row0->atiput(1, 0.0); +// row0->atiput(2, sthe); +// auto row1 = rotMat->at(1); +// row1->atiput(0, 0.0); +// row1->atiput(1, 1.0); +// row1->atiput(2, 0.0); +// auto row2 = rotMat->at(2); +// row2->atiput(0, -sthe); +// row2->atiput(1, 0.0); +// row2->atiput(2, cthe); +// return rotMat; +// } +// template +// inline std::shared_ptr> rotatez(T the) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, cthe); +// row0->atiput(1, -sthe); +// row0->atiput(2, 0.0); +// auto row1 = rotMat->at(1); +// row1->atiput(0, sthe); +// row1->atiput(1, cthe); +// row1->atiput(2, 0.0); +// auto row2 = rotMat->at(2); +// row2->atiput(0, 0.0); +// row2->atiput(1, 0.0); +// row2->atiput(2, 1.0); +// return rotMat; +// } + inline std::shared_ptr rotatex(double the) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 1.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, cthe); + row1->atiput(2, -sthe); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, sthe); + row2->atiput(2, cthe); + return rotMat; } -} -template -inline void FullMatrix::identity() { - assert(false); -} -inline void FullMatrixDouble::identity() { - this->zeroSelf(); - for (int i = 0; i < this->size(); i++) { - this->at(i)->at(i) = 1.0; + inline std::shared_ptr rotatey(double the) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthe); + row0->atiput(1, 0.0); + row0->atiput(2, sthe); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 1.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -sthe); + row2->atiput(1, 0.0); + row2->atiput(2, cthe); + return rotMat; } -} -inline void FullMatrixFullMatrixDouble::identity() { - assert(false); + inline std::shared_ptr rotatez(double the) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthe); + row0->atiput(1, -sthe); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, sthe); + row1->atiput(1, cthe); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 1.0); + return rotMat; + } +// template +// inline std::shared_ptr> rotatexrotDot(T the, T thedot) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto sthedot = cthe * thedot; +// auto cthedot = -sthe * thedot; +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, 0.0); +// row0->atiput(1, 0.0); +// row0->atiput(2, 0.0); +// auto row1 = rotMat->at(1); +// row1->atiput(0, 0.0); +// row1->atiput(1, cthedot); +// row1->atiput(2, -sthedot); +// auto row2 = rotMat->at(2); +// row2->atiput(0, 0.0); +// row2->atiput(1, sthedot); +// row2->atiput(2, cthedot); +// return rotMat; +// } +// template +// inline std::shared_ptr> rotateyrotDot(T the, T thedot) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto sthedot = cthe * thedot; +// auto cthedot = -sthe * thedot; +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, cthedot); +// row0->atiput(1, 0.0); +// row0->atiput(2, sthedot); +// auto row1 = rotMat->at(1); +// row1->atiput(0, 0.0); +// row1->atiput(1, 0.0); +// row1->atiput(2, 0.0); +// auto row2 = rotMat->at(2); +// row2->atiput(0, -sthedot); +// row2->atiput(1, 0.0); +// row2->atiput(2, cthedot); +// return rotMat; +// } +// template +// inline std::shared_ptr> rotatezrotDot(T the, T thedot) +// { +// auto sthe = std::sin(the); +// auto cthe = std::cos(the); +// auto sthedot = cthe * thedot; +// auto cthedot = -sthe * thedot; +// auto rotMat = std::make_shared>(3, 3); +// auto row0 = rotMat->at(0); +// row0->atiput(0, cthedot); +// row0->atiput(1, -sthedot); +// row0->atiput(2, 0.0); +// auto row1 = rotMat->at(1); +// row1->atiput(0, sthedot); +// row1->atiput(1, cthedot); +// row1->atiput(2, 0.0); +// auto row2 = rotMat->at(2); +// row2->atiput(0, 0.0); +// row2->atiput(1, 0.0); +// row2->atiput(2, 0.0); +// return rotMat; +// } + inline std::shared_ptr rotatexrotDot(double the, double thedot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 0.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, cthedot); + row1->atiput(2, -sthedot); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, sthedot); + row2->atiput(2, cthedot); + return rotMat; + } + inline std::shared_ptr rotateyrotDot(double the, double thedot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthedot); + row0->atiput(1, 0.0); + row0->atiput(2, sthedot); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 0.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -sthedot); + row2->atiput(1, 0.0); + row2->atiput(2, cthedot); + return rotMat; + } + inline std::shared_ptr rotatezrotDot(double the, double thedot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto rotMat = std::make_shared(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, cthedot); + row0->atiput(1, -sthedot); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, sthedot); + row1->atiput(1, cthedot); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 0.0); + return rotMat; + } + template + inline std::shared_ptr> rotatexrotDotrotDDot(T the, T thedot, T theddot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, 0.0); + row0->atiput(1, 0.0); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, ctheddot); + row1->atiput(2, -stheddot); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, stheddot); + row2->atiput(2, ctheddot); + return rotMat; + } + template + inline std::shared_ptr> rotateyrotDotrotDDot(T the, T thedot, T theddot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, ctheddot); + row0->atiput(1, 0.0); + row0->atiput(2, stheddot); + auto row1 = rotMat->at(1); + row1->atiput(0, 0.0); + row1->atiput(1, 0.0); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, -stheddot); + row2->atiput(1, 0.0); + row2->atiput(2, ctheddot); + return rotMat; + } + template + inline std::shared_ptr> rotatezrotDotrotDDot(T the, T thedot, T theddot) + { + auto sthe = std::sin(the); + auto cthe = std::cos(the); + auto sthedot = cthe * thedot; + auto cthedot = -sthe * thedot; + auto stheddot = cthedot * thedot + (cthe * theddot); + auto ctheddot = -(sthedot * thedot) - (sthe * theddot); + auto rotMat = std::make_shared>(3, 3); + auto row0 = rotMat->at(0); + row0->atiput(0, ctheddot); + row0->atiput(1, -stheddot); + row0->atiput(2, 0.0); + auto row1 = rotMat->at(1); + row1->atiput(0, stheddot); + row1->atiput(1, ctheddot); + row1->atiput(2, 0.0); + auto row2 = rotMat->at(2); + row2->atiput(0, 0.0); + row2->atiput(1, 0.0); + row2->atiput(2, 0.0); + return rotMat; + } + template + inline std::shared_ptr> FullMatrixTemplate::identitysptr(int n) + { + auto mat = std::make_shared>(n, n); + mat->identity(); + return mat; + } + inline std::shared_ptr FullMatrixDouble::identitysptr(int n) + { + auto mat = std::make_shared(n, n); + mat->identity(); + return mat; + } + inline std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) + { + auto mat = std::make_shared(n, n); + mat->identity(); + return mat; + } + template + inline std::shared_ptr> FullMatrixTemplate::tildeMatrix(FColDsptr col) + { + //"tildeMatrix is skew symmetric matrix related to angular velocity and cross product." + if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3"); + auto tilde = std::make_shared(3, 3); + auto c0 = col->at(0); + auto c1 = col->at(1); + auto c2 = col->at(2); + tilde->atijput(0, 0, 0.0); + tilde->atijput(1, 1, 0.0); + tilde->atijput(2, 2, 0.0); + tilde->atijput(1, 2, -c0); + tilde->atijput(0, 2, c1); + tilde->atijput(0, 1, -c2); + tilde->atijput(1, 0, c2); + tilde->atijput(2, 0, -c1); + tilde->atijput(2, 1, c0); + return tilde; + } + template<> + inline void FullMatrixTemplate::zeroSelf() + { + for (int i = 0; i < this->size(); i++) { + this->at(i)->zeroSelf(); + } + } + template + inline void FullMatrixTemplate::identity() { + assert(false); + } + inline void FullMatrixDouble::identity() { + this->zeroSelf(); + for (int i = 0; i < this->size(); i++) { + this->at(i)->at(i) = 1.0; + } + } + inline void FullMatrixFullMatrixDouble::identity() { + assert(false); // this->zeroSelf(); // for (int i = 0; i < this->size(); i++) { // this->at(i)->at(i) = 1.0; // } -} -template -inline FColsptr FullMatrix::column(int j) { - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->at(j); } - return answer; -} -template -inline FMatsptr FullMatrix::timesFullMatrix(FMatsptr fullMat) -{ - int m = this->nrow(); - auto answer = std::make_shared>(m); - for (int i = 0; i < m; i++) { - answer->at(i) = this->at(i)->timesFullMatrix(fullMat); + template + inline FColsptr FullMatrixTemplate::column(int j) { + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->at(j); + } + return answer; } - return answer; -} -template -inline FMatsptr FullMatrix::timesTransposeFullMatrix(FMatsptr fullMat) -{ - assert(false); -// int nrow = this->nrow(); -// auto answer = std::make_shared>(nrow); -// for (int i = 0; i < nrow; i++) { -// answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); +// template +// inline std::shared_ptr> FullMatrixTemplate::timesFullMatrix(std::shared_ptr> fullMat) +// { +// int m = this->nrow(); +// auto answer = std::make_shared>(m); +// for (int i = 0; i < m; i++) { +// answer->at(i) = this->at(i)->timesFullMatrix(fullMat); +// } +// return answer; // } -// return answer; -} -inline std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) -{ - int nrow = this->nrow(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) { - answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); + inline std::shared_ptr FullMatrixDouble::timesFullMatrix(std::shared_ptr fullMat) + { + int m = this->nrow(); + auto answer = std::make_shared(m); + for (int i = 0; i < m; i++) { + answer->at(i) = this->at(i)->timesFullMatrix(fullMat); + } + return answer; } - return answer; -} -inline std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) -{ - int nrow = this->nrow(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) { - answer->at(i) = this->at(i)->timesTransposeFullMatrixForFMFMDsptr(fullMat); + inline std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + { + int nrow = this->nrow(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) { + answer->at(i) = this->at(i)->timesTransposeFullMatrix(fullMat); + } + return answer; } - return answer; -} -inline std::shared_ptr FullMatrixDouble::times(double a) -{ - int m = this->nrow(); - auto answer = std::make_shared(m); - for (int i = 0; i < m; i++) { - // auto x = this->at(i); - answer->at(i) = this->at(i)->times(a); + inline std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + { + int nrow = this->nrow(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) { + answer->at(i) = this->at(i)->timesTransposeFullMatrixForFMFMDsptr(fullMat); + } + return answer; } - return answer; -} -inline std::shared_ptr FullMatrixFullMatrixDouble::times(double a) -{ - assert(false); -} -template -inline FMatsptr FullMatrix::times(T a) -{ - assert(false); -} -template -inline FMatsptr FullMatrix::transposeTimesFullMatrix(FMatsptr fullMat) -{ - return this->transpose()->timesFullMatrix(fullMat); -} -template -inline FMatsptr FullMatrix::plusFullMatrix(FMatsptr fullMat) -{ - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); + inline std::shared_ptr FullMatrixDouble::times(double a) + { + int m = this->nrow(); + auto answer = std::make_shared(m); + for (int i = 0; i < m; i++) { + // auto x = this->at(i); + answer->at(i) = this->at(i)->times(a); + } + return answer; } - return answer; -} -template -inline FMatsptr FullMatrix::minusFullMatrix(FMatsptr fullMat) -{ - int n = (int)this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); + inline std::shared_ptr FullMatrixFullMatrixDouble::times(double a) + { + assert(false); } - return answer; -} -template -inline FMatsptr FullMatrix::transpose() -{ - int nrow = this->nrow(); - auto ncol = this->ncol(); - auto answer = std::make_shared>(ncol, nrow); - for (int i = 0; i < nrow; i++) { - auto& row = this->at(i); - for (int j = 0; j < ncol; j++) { - answer->at(j)->at(i) = row->at(j); + inline std::shared_ptr FullMatrixFullColumnDouble::times(double a) + { +// int m = this->nrow(); +// auto answer = std::make_shared(m); +// for (int i = 0; i < m; i++) { +// answer->at(i) = this->at(i)->times(a); +// } +// return answer; + assert(false); + } + template + inline std::shared_ptr> FullMatrixTemplate::times(T a) + { + assert(false); + } +// template +// inline std::shared_ptr> FullMatrixTemplate::transposeTimesFullMatrix(std::shared_ptr> fullMat) +// { +// return this->transpose()->timesFullMatrix(fullMat); +// } + inline std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) + { + return this->transpose()->timesFullMatrix(fullMat); + } +// template +// inline std::shared_ptr> FullMatrixTemplate::plusFullMatrix(std::shared_ptr> fullMat) +// { +// int n = (int)this->size(); +// auto answer = std::make_shared>(n); +// for (int i = 0; i < n; i++) { +// answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); +// } +// return answer; +// } + inline std::shared_ptr FullMatrixDouble::plusFullMatrix(std::shared_ptr fullMat) + { + int n = (int)this->size(); + auto answer = std::make_shared(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); + } + return answer; + } + template + inline std::shared_ptr> FullMatrixTemplate::minusFullMatrix(std::shared_ptr> fullMat) + { + int n = (int)this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); + } + return answer; + } +// template +// inline std::shared_ptr> FullMatrixTemplate::transpose() +// { +// int nrow = this->nrow(); +// auto ncol = this->ncol(); +// auto answer = std::make_shared>(ncol, nrow); +// for (int i = 0; i < nrow; i++) { +// auto& row = this->at(i); +// for (int j = 0; j < ncol; j++) { +// answer->at(j)->at(i) = row->at(j); +// } +// } +// return answer; +// } + inline std::shared_ptr FullMatrixDouble::transpose() { + int nrow = this->nrow(); + auto ncol = this->ncol(); + auto answer = std::make_shared(ncol, nrow); + for (int i = 0; i < nrow; i++) { + auto& row = this->at(i); + for (int j = 0; j < ncol; j++) { + answer->at(j)->at(i) = row->at(j); + } + } + return answer; + } +// template +// inline std::shared_ptr> FullMatrixTemplate::negated() +// { +// return this->times(-1.0); +// } + inline std::shared_ptr FullMatrixDouble::negated() + { + return this->times(-1.0); + } + template + inline void FullMatrixTemplate::symLowerWithUpper() + { + int n = (int)this->size(); + for (int i = 0; i < n; i++) { + for (int j = i + 1; j < n; j++) { + this->at(j)->at(i) = this->at(i)->at(j); + } } } - return answer; -} -template -inline FMatsptr FullMatrix::negated() -{ - return this->times(-1.0); -} -template -inline void FullMatrix::symLowerWithUpper() -{ - int n = (int)this->size(); - for (int i = 0; i < n; i++) { - for (int j = i + 1; j < n; j++) { - this->at(j)->at(i) = this->at(i)->at(j); + template + inline void FullMatrixTemplate::atiput(int i, FRowsptr fullRow) + { + this->at(i) = fullRow; + } + template + inline void FullMatrixTemplate::atijput(int i, int j, T value) + { + this->at(i)->atiput(j, value); + } + template + inline void FullMatrixTemplate::atijputFullColumn(int i1, int j1, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i1 + ii)->at(j1) = fullCol->at(ii); } } -} -template -inline void FullMatrix::atiput(int i, FRowsptr fullRow) -{ - this->at(i) = fullRow; -} -template -inline void FullMatrix::atijput(int i, int j, T value) -{ - this->at(i)->atiput(j, value); -} -template -inline void FullMatrix::atijputFullColumn(int i1, int j1, FColsptr fullCol) -{ - for (int ii = 0; ii < fullCol->size(); ii++) + template + inline void FullMatrixTemplate::atijplusFullRow(int i, int j, FRowsptr fullRow) { - this->at(i1 + ii)->at(j1) = fullCol->at(ii); + this->at(i)->atiplusFullRow(j, fullRow); } -} -template -inline void FullMatrix::atijplusFullRow(int i, int j, FRowsptr fullRow) -{ - this->at(i)->atiplusFullRow(j, fullRow); -} -template -inline void FullMatrix::atijplusNumber(int i, int j, T value) -{ - auto rowi = this->at(i); - rowi->at(j) += value; -} -template -inline void FullMatrix::atijminusNumber(int i, int j, T value) -{ - auto rowi = this->at(i); - rowi->at(j) -= value; -} -inline double FullMatrixDouble::sumOfSquares() -{ - double sum = 0.0; - for (int i = 0; i < this->size(); i++) - { - sum += this->at(i)->sumOfSquares(); - } - return sum; -} -inline double FullMatrixFullMatrixDouble::sumOfSquares() -{ - double sum = 0.0; - for (int i = 0; i < this->size(); i++) - { - sum += this->at(i)->sumOfSquares(); - } - return sum; -} - -template -inline double FullMatrix::sumOfSquares() -{ - assert(false); - return 0.0; -} -template -inline void FullMatrix::zeroSelf() -{ - assert(false); -} -template -inline FMatsptr FullMatrix::copy() -{ - auto m = (int)this->size(); - auto answer = std::make_shared>(m); - for (int i = 0; i < m; i++) - { - answer->at(i) = this->at(i)->copy(); - } - return answer; -} -template -inline FullMatrix FullMatrix::operator+(const FullMatrix fullMat) -{ - int n = (int)this->size(); - auto answer = FullMatrix(n); - for (int i = 0; i < n; i++) { - answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); - } - return answer; -} -template -inline FColsptr FullMatrix::transposeTimesFullColumn(FColsptr fullCol) -{ - auto sptr = std::make_shared>(*this); - return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); -} -template -inline void FullMatrix::magnifySelf(T factor) -{ - for (int i = 0; i < this->size(); i++) { - this->at(i)->magnifySelf(factor); - } -} -template -inline std::ostream& FullMatrix::printOn(std::ostream& s) const -{ - s << "FullMat[" << std::endl; - for (int i = 0; i < this->size(); i++) - { - s << *(this->at(i)) << std::endl; - } - s << "]"; - return s; -} -template -inline std::shared_ptr> FullMatrix::asEulerParameters() -{ - //"Given [A], compute Euler parameter." - - auto traceA = this->trace(); - T dum = 0.0; - T dumSq = 0.0; - //auto qE = CREATE>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? - auto qE = std::make_shared>(4); - qE->initialize(); - auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0; - for (int i = 0; i < 3; i++) - { - dumSq = this->at(i)->at(i) / 2.0 + OneMinusTraceDivFour; - dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; - qE->atiput(i, dum); - } - dumSq = (1.0 + traceA) / 4.0; - dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; - qE->atiput(3, dum); - T max = 0.0; - int maxE = -1; - for (int i = 0; i < 4; i++) - { - auto num = qE->at(i); - if (max < num) { - max = num; - maxE = i; - } - } - - if (maxE == 0) { - auto FourE = 4.0 * qE->at(0); - qE->atiput(1, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); - qE->atiput(2, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); - qE->atiput(3, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); - } - else if (maxE == 1) { - auto FourE = 4.0 * qE->at(1); - qE->atiput(0, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); - qE->atiput(2, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); - qE->atiput(3, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); - } - else if (maxE == 2) { - auto FourE = 4.0 * qE->at(2); - qE->atiput(0, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); - qE->atiput(1, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); - qE->atiput(3, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); - } - else if (maxE == 3) { - auto FourE = 4.0 * qE->at(3); - qE->atiput(0, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); - qE->atiput(1, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); - qE->atiput(2, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); - } - qE->conditionSelf(); - qE->calc(); - return qE; -} -template -inline T FullMatrix::trace() -{ - T trace = 0.0; - for (int i = 0; i < this->size(); i++) - { - trace += this->at(i)->at(i); - } - return trace; -} -template -inline double FullMatrix::maxMagnitude() -{ - double max = 0.0; - for (int i = 0; i < this->size(); i++) - { - double element = this->at(i)->maxMagnitude(); - if (max < element) max = element; - } - return max; -} -template -inline FColsptr FullMatrix::bryantAngles() -{ - auto answer = std::make_shared>(3); - auto sthe1y = this->at(0)->at(2); - T the0x, the1y, the2z, cthe0x, sthe0x, y, x; - if (std::abs(sthe1y) > 0.9999) { - if (sthe1y > 0.0) { - the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); - the1y = M_PI / 2.0; - the2z = 0.0; - } - else { - the0x = std::atan2(this->at(2)->at(1), this->at(2)->at(0)); - the1y = M_PI / -2.0; - the2z = 0.0; - } - } - else { - the0x = std::atan2(-this->at(1)->at(2), this->at(2)->at(2)); - cthe0x = std::cos(the0x); - sthe0x = std::sin(the0x); - y = sthe1y; - if (std::abs(cthe0x) > std::abs(sthe0x)) { - x = this->at(2)->at(2) / cthe0x; - } - else { - x = this->at(1)->at(2) / -sthe0x; - } - the1y = std::atan2(y, x); - the2z = std::atan2(-this->at(0)->at(1), this->at(0)->at(0)); - } - answer->atiput(0, the0x); - answer->atiput(1, the1y); - answer->atiput(2, the2z); - return answer; -} -template -inline bool FullMatrix::isDiagonal() -{ - auto m = this->nrow(); - auto n = this->ncol(); - if (m != n) return false; - for (int i = 0; i < m; i++) + template + inline void FullMatrixTemplate::atijplusNumber(int i, int j, T value) { auto rowi = this->at(i); - for (int j = 0; j < n; j++) + rowi->at(j) += value; + } + template + inline void FullMatrixTemplate::atijminusNumber(int i, int j, T value) + { + auto rowi = this->at(i); + rowi->at(j) -= value; + } + inline double FullMatrixDouble::sumOfSquares() + { + double sum = 0.0; + for (int i = 0; i < this->size(); i++) { - if (i != j && rowi->at(j) != 0) return false; + sum += this->at(i)->sumOfSquares(); + } + return sum; + } + inline double FullMatrixFullMatrixDouble::sumOfSquares() + { + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + sum += this->at(i)->sumOfSquares(); + } + return sum; + } + + template + inline double FullMatrixTemplate::sumOfSquares() + { + assert(false); + return 0.0; + } + template + inline void FullMatrixTemplate::zeroSelf() + { + assert(false); + } +// template +// inline std::shared_ptr> FullMatrixTemplate::copy() +// { +// auto m = (int)this->size(); +// auto answer = std::make_shared>(m); +// for (int i = 0; i < m; i++) +// { +// answer->at(i) = this->at(i)->copy(); +// } +// return answer; +// } + inline std::shared_ptr FullMatrixDouble::copy() + { + auto m = (int)this->size(); + auto answer = std::make_shared(m); + for (int i = 0; i < m; i++) + { + answer->at(i) = this->at(i)->copy(); + } + return answer; + } + template + inline FullMatrixTemplate FullMatrixTemplate::operator+(const FullMatrixTemplate fullMat) + { + int n = (int)this->size(); + auto answer = FullMatrixTemplate(n); + for (int i = 0; i < n; i++) { + answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); + } + return answer; + } + template + inline FColsptr FullMatrixTemplate::transposeTimesFullColumn(FColsptr fullCol) + { + auto sptr = std::make_shared>(*this); + return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); + } + template + inline void FullMatrixTemplate::magnifySelf(T factor) + { + for (int i = 0; i < this->size(); i++) { + this->at(i)->magnifySelf(factor); } } - return true; -} -template -inline bool FullMatrix::isDiagonalToWithin(double ratio) -{ - double maxMag = this->maxMagnitude(); - auto tol = ratio * maxMag; - auto nrow = this->nrow(); - if (nrow == this->ncol()) { + template + inline std::ostream& FullMatrixTemplate::printOn(std::ostream& s) const + { + s << "FullMat[" << std::endl; + for (int i = 0; i < this->size(); i++) + { + s << *(this->at(i)) << std::endl; + } + s << "]"; + return s; + } + template + inline std::shared_ptr> FullMatrixTemplate::asEulerParameters() + { + //"Given [A], compute Euler parameter." + + auto traceA = this->trace(); + T dum = 0.0; + T dumSq = 0.0; + //auto qE = CREATE>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? + auto qE = std::make_shared>(4); + qE->initialize(); + auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0; for (int i = 0; i < 3; i++) { - for (int j = i + 1; j < 3; j++) + dumSq = this->at(i)->at(i) / 2.0 + OneMinusTraceDivFour; + dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; + qE->atiput(i, dum); + } + dumSq = (1.0 + traceA) / 4.0; + dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; + qE->atiput(3, dum); + T max = 0.0; + int maxE = -1; + for (int i = 0; i < 4; i++) + { + auto num = qE->at(i); + if (max < num) { + max = num; + maxE = i; + } + } + + if (maxE == 0) { + auto FourE = 4.0 * qE->at(0); + qE->atiput(1, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); + qE->atiput(2, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); + qE->atiput(3, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); + } + else if (maxE == 1) { + auto FourE = 4.0 * qE->at(1); + qE->atiput(0, (this->at(0)->at(1) + this->at(1)->at(0)) / FourE); + qE->atiput(2, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); + qE->atiput(3, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); + } + else if (maxE == 2) { + auto FourE = 4.0 * qE->at(2); + qE->atiput(0, (this->at(0)->at(2) + this->at(2)->at(0)) / FourE); + qE->atiput(1, (this->at(1)->at(2) + this->at(2)->at(1)) / FourE); + qE->atiput(3, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); + } + else if (maxE == 3) { + auto FourE = 4.0 * qE->at(3); + qE->atiput(0, (this->at(2)->at(1) - this->at(1)->at(2)) / FourE); + qE->atiput(1, (this->at(0)->at(2) - this->at(2)->at(0)) / FourE); + qE->atiput(2, (this->at(1)->at(0) - this->at(0)->at(1)) / FourE); + } + qE->conditionSelf(); + qE->calc(); + return qE; + } + template + inline T FullMatrixTemplate::trace() + { + T trace = 0.0; + for (int i = 0; i < this->size(); i++) + { + trace += this->at(i)->at(i); + } + return trace; + } + template + inline double FullMatrixTemplate::maxMagnitude() + { + double max = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i)->maxMagnitude(); + if (max < element) max = element; + } + return max; + } + template + inline FColsptr FullMatrixTemplate::bryantAngles() + { + auto answer = std::make_shared>(3); + auto sthe1y = this->at(0)->at(2); + T the0x, the1y, the2z, cthe0x, sthe0x, y, x; + if (std::abs(sthe1y) > 0.9999) { + if (sthe1y > 0.0) { + the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); + the1y = M_PI / 2.0; + the2z = 0.0; + } + else { + the0x = std::atan2(this->at(2)->at(1), this->at(2)->at(0)); + the1y = M_PI / -2.0; + the2z = 0.0; + } + } + else { + the0x = std::atan2(-this->at(1)->at(2), this->at(2)->at(2)); + cthe0x = std::cos(the0x); + sthe0x = std::sin(the0x); + y = sthe1y; + if (std::abs(cthe0x) > std::abs(sthe0x)) { + x = this->at(2)->at(2) / cthe0x; + } + else { + x = this->at(1)->at(2) / -sthe0x; + } + the1y = std::atan2(y, x); + the2z = std::atan2(-this->at(0)->at(1), this->at(0)->at(0)); + } + answer->atiput(0, the0x); + answer->atiput(1, the1y); + answer->atiput(2, the2z); + return answer; + } + template + inline bool FullMatrixTemplate::isDiagonal() + { + auto m = this->nrow(); + auto n = this->ncol(); + if (m != n) return false; + for (int i = 0; i < m; i++) + { + auto rowi = this->at(i); + for (int j = 0; j < n; j++) { - if (std::abs(this->at(i)->at(j)) > tol) return false; - if (std::abs(this->at(j)->at(i)) > tol) return false; + if (i != j && rowi->at(j) != 0) return false; } } return true; } - else { - return false; - } -} -template -inline std::shared_ptr> FullMatrix::asDiagonalMatrix() -{ - int nrow = this->nrow(); - auto diagMat = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) + template + inline bool FullMatrixTemplate::isDiagonalToWithin(double ratio) { - diagMat->atiput(i, this->at(i)->at(i)); + double maxMag = this->maxMagnitude(); + auto tol = ratio * maxMag; + auto nrow = this->nrow(); + if (nrow == this->ncol()) { + for (int i = 0; i < 3; i++) + { + for (int j = i + 1; j < 3; j++) + { + if (std::abs(this->at(i)->at(j)) > tol) return false; + if (std::abs(this->at(j)->at(i)) > tol) return false; + } + } + return true; + } + else { + return false; + } } - return diagMat; -} -template -inline void FullMatrix::conditionSelfWithTol(double tol) -{ - for (auto row : *this) { - row->conditionSelfWithTol(tol); - } -} -template -inline FColsptr FullMatrix::timesFullColumn(FColsptr fullCol) -{ - return this->timesFullColumn(fullCol.get()); -} -template -inline FColsptr FullMatrix::timesFullColumn(FullColumn* fullCol) -{ - //"a*b = a(i,j)b(j) sum j." - auto nrow = this->nrow(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) + template + inline std::shared_ptr> FullMatrixTemplate::asDiagonalMatrix() { - answer->at(i) = this->at(i)->timesFullColumn(fullCol); + int nrow = this->nrow(); + auto diagMat = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + diagMat->atiput(i, this->at(i)->at(i)); + } + return diagMat; + } + template + inline void FullMatrixTemplate::conditionSelfWithTol(double tol) + { + for (auto row : *this) { + row->conditionSelfWithTol(tol); + } + } + template + inline FColsptr FullMatrixTemplate::timesFullColumn(FColsptr fullCol) + { + return this->timesFullColumn(fullCol.get()); + } + template + inline FColsptr FullMatrixTemplate::timesFullColumn(FullColumn* fullCol) + { + //"a*b = a(i,j)b(j) sum j." + auto nrow = this->nrow(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i)->timesFullColumn(fullCol); + } + return answer; } - return answer; } diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index ad94b0b..28a8eba 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -21,64 +21,58 @@ namespace MbD { template - class FullMatrix; - - template - using FMatsptr = std::shared_ptr>; - - template - class FullMatrix : public RowTypeMatrix> + class FullMatrixTemplate : public RowTypeMatrix> { public: - FullMatrix() {}; - explicit FullMatrix(int m) : RowTypeMatrix>(m) + FullMatrixTemplate() = default; + explicit FullMatrixTemplate(int m) : RowTypeMatrix>(m) { } - FullMatrix(int m, int n) { + FullMatrixTemplate(int m, int n) { for (int i = 0; i < m; i++) { auto row = std::make_shared>(n); this->push_back(row); } } - FullMatrix(std::initializer_list> listOfRows) { + FullMatrixTemplate(std::initializer_list> listOfRows) { for (auto& row : listOfRows) { this->push_back(row); } } - FullMatrix(std::initializer_list> list2D) { + FullMatrixTemplate(std::initializer_list> list2D) { for (auto& rowList : list2D) { auto row = std::make_shared>(rowList); this->push_back(row); } } - static FMatsptr rotatex(T angle); - static FMatsptr rotatey(T angle); - static FMatsptr rotatez(T angle); - static FMatsptr rotatexrotDot(T angle, T angledot); - static FMatsptr rotateyrotDot(T angle, T angledot); - static FMatsptr rotatezrotDot(T angle, T angledot); - static FMatsptr rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot); - static FMatsptr rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot); - static FMatsptr rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); - static FMatsptr identitysptr(int n); - static FMatsptr tildeMatrix(FColDsptr col); +// static std::shared_ptr> rotatex(T angle); +// static std::shared_ptr> rotatey(T angle); +// static std::shared_ptr> rotatez(T angle); +// static std::shared_ptr> rotatexrotDot(T angle, T angledot); +// static std::shared_ptr> rotateyrotDot(T angle, T angledot); +// static std::shared_ptr> rotatezrotDot(T angle, T angledot); + static std::shared_ptr> rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot); + static std::shared_ptr> rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot); + static std::shared_ptr> rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); + static std::shared_ptr> identitysptr(int n); + static std::shared_ptr> tildeMatrix(FColDsptr col); virtual void identity(); FColsptr column(int j); FColsptr timesFullColumn(FColsptr fullCol); FColsptr timesFullColumn(FullColumn* fullCol); - FMatsptr timesFullMatrix(FMatsptr fullMat); + // std::shared_ptr> timesFullMatrix(std::shared_ptr> fullMat); - virtual FMatsptr timesTransposeFullMatrix(FMatsptr fullMat); + virtual std::shared_ptr> timesTransposeFullMatrix(std::shared_ptr> fullMat); - FMatsptr times(T a); - FMatsptr transposeTimesFullMatrix(FMatsptr fullMat); - FMatsptr plusFullMatrix(FMatsptr fullMat); - FMatsptr minusFullMatrix(FMatsptr fullMat); - FMatsptr transpose(); - FMatsptr negated(); + std::shared_ptr> times(T a); + // std::shared_ptr> transposeTimesFullMatrix(std::shared_ptr> fullMat); + // std::shared_ptr> plusFullMatrix(std::shared_ptr> fullMat); + std::shared_ptr> minusFullMatrix(std::shared_ptr> fullMat); + // std::shared_ptr> transpose(); +// std::shared_ptr> negated(); void symLowerWithUpper(); void atiput(int i, FRowsptr fullRow) override; void atijput(int i, int j, T value); @@ -88,8 +82,8 @@ namespace MbD { void atijminusNumber(int i, int j, T value); double sumOfSquares() override; void zeroSelf() override; - FMatsptr copy(); - FullMatrix operator+(const FullMatrix fullMat); +// std::shared_ptr> copy(); + FullMatrixTemplate operator+(const FullMatrixTemplate fullMat); FColsptr transposeTimesFullColumn(const FColsptr fullCol); void magnifySelf(T factor); std::shared_ptr> asEulerParameters(); @@ -107,51 +101,61 @@ namespace MbD { // // FULL MATRIX DOUBLE instantiation // - class FullMatrixDouble : public FullMatrix { + class FullMatrixDouble : public FullMatrixTemplate { public: - FullMatrixDouble() : FullMatrix() {}; - explicit FullMatrixDouble(int m) : FullMatrix(m) {}; - FullMatrixDouble(int m, int n) : FullMatrix(m, n) {}; - FullMatrixDouble(std::initializer_list> list2D) : FullMatrix(list2D) {} - FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrix(listOfRows) {}; + FullMatrixDouble() : FullMatrixTemplate() {}; + explicit FullMatrixDouble(int m) : FullMatrixTemplate(m) {}; + FullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + FullMatrixDouble(std::initializer_list> list2D) : FullMatrixTemplate(list2D) {} + FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrixTemplate(listOfRows) {}; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); - double sumOfSquares() override; void identity() override; static std::shared_ptr identitysptr(int n); + double sumOfSquares(); + std::shared_ptr transposeTimesFullMatrix(std::shared_ptr fullMat); + std::shared_ptr timesFullMatrix(std::shared_ptr fullMat); + std::shared_ptr transpose(); + std::shared_ptr negated(); + std::shared_ptr plusFullMatrix(std::shared_ptr fullMat); + static std::shared_ptr rotatex(double angle); + static std::shared_ptr rotatey(double angle); + static std::shared_ptr rotatez(double angle); + static std::shared_ptr rotatexrotDot(double angle, double angledot); + static std::shared_ptr rotateyrotDot(double angle, double angledot); + static std::shared_ptr rotatezrotDot(double angle, double angledot); + std::shared_ptr copy(); }; - using FMatDsptr = std::shared_ptr; - std::shared_ptr toFMDsptr(FMatsptr s) { - return std::static_pointer_cast(s); - } // // FULL MATRIX FULL MATRIX DOUBLE instantiation // - class FullMatrixFullMatrixDouble : public FullMatrix { + class FullMatrixFullMatrixDouble : public FullMatrixTemplate { public: - FullMatrixFullMatrixDouble() : FullMatrix() {}; - explicit FullMatrixFullMatrixDouble(int m) : FullMatrix(m) {}; - FullMatrixFullMatrixDouble(int m, int n) : FullMatrix(m, n) {}; + FullMatrixFullMatrixDouble() : FullMatrixTemplate() {}; + explicit FullMatrixFullMatrixDouble(int m) : FullMatrixTemplate(m) {}; + FullMatrixFullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; void identity() override; static std::shared_ptr identitysptr(int n); - - - }; - using FMatFMatDsptr = std::shared_ptr; - std::shared_ptr toFMFMDsptr(std::shared_ptr> s) { - return std::static_pointer_cast(s); - } - - using FColFMatDsptr = std::shared_ptr>; - using FMatFColDsptr = std::shared_ptr>; - + // + // FULL MATRIX FULL COLUMN DOUBLE instantiation + // + class FullMatrixFullColumnDouble : public FullMatrixTemplate { + public: + FullMatrixFullColumnDouble() : FullMatrixTemplate() {}; + explicit FullMatrixFullColumnDouble(int m) : FullMatrixTemplate(m) {}; + FullMatrixFullColumnDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + std::shared_ptr times(double a); + std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + double sumOfSquares() override; + void identity() override; + static std::shared_ptr identitysptr(int n); + }; } - diff --git a/OndselSolver/FullMatrix.ref.h b/OndselSolver/FullMatrix.ref.h index f250568..db820ec 100644 --- a/OndselSolver/FullMatrix.ref.h +++ b/OndselSolver/FullMatrix.ref.h @@ -5,16 +5,14 @@ namespace MbD { class FullMatrixDouble; class FullMatrixFullMatrixDouble; + class FullMatrixFullColumnDouble; -// using FMatDsptr = std::shared_ptr; + using FMatDsptr = std::shared_ptr; -// template -// using FMatsptr = std::shared_ptr>; + using FMatFMatDsptr = std::shared_ptr; -// using FMatFColDsptr = std::shared_ptr>; -// using FMatFMatDsptr = std::shared_ptr>; -// -// using FColFMatDsptr = std::shared_ptr>; + using FColFMatDsptr = std::shared_ptr>; + using FMatFColDsptr = std::shared_ptr; } diff --git a/OndselSolver/GearConstraintIqcJc.cpp b/OndselSolver/GearConstraintIqcJc.cpp index a5cff8c..af49703 100644 --- a/OndselSolver/GearConstraintIqcJc.cpp +++ b/OndselSolver/GearConstraintIqcJc.cpp @@ -52,18 +52,18 @@ void MbD::GearConstraintIqcJc::calc_pGpXI() void MbD::GearConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = toFMDsptr(orbitJeIe->ppvaluepEJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepEIpEI()->times(this->ratio()))); + ppGpEIpEI = orbitJeIe->ppvaluepEJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepEIpEI()->times(this->ratio())); } void MbD::GearConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = toFMDsptr(orbitJeIe->ppvaluepXJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepXIpEI()->times(this->ratio()))); + ppGpXIpEI = orbitJeIe->ppvaluepXJpEJ()->plusFullMatrix(orbitIeJe->ppvaluepXIpEI()->times(this->ratio())); } void MbD::GearConstraintIqcJc::calc_ppGpXIpXI() { - ppGpXIpXI = toFMDsptr(orbitJeIe->ppvaluepXJpXJ() - ->plusFullMatrix(orbitIeJe->ppvaluepXIpXI()->times(this->ratio()))); + ppGpXIpXI = orbitJeIe->ppvaluepXJpXJ() + ->plusFullMatrix(orbitIeJe->ppvaluepXIpXI()->times(this->ratio())); } void MbD::GearConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/GearConstraintIqcJqc.cpp b/OndselSolver/GearConstraintIqcJqc.cpp index 418f198..717c815 100644 --- a/OndselSolver/GearConstraintIqcJqc.cpp +++ b/OndselSolver/GearConstraintIqcJqc.cpp @@ -29,37 +29,37 @@ void MbD::GearConstraintIqcJqc::calc_pGpXJ() void MbD::GearConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpEJ()->times(this->ratio()))); + ppGpEIpEJ = orbitJeIe->ppvaluepEIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpEJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpXJ()->times(this->ratio()))); + ppGpEIpXJ = orbitJeIe->ppvaluepXIpEJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepEIpXJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpEI()->plusFullMatrix(orbitIeJe->ppvaluepEJpEJ()->times(this->ratio()))); + ppGpEJpEJ = orbitJeIe->ppvaluepEIpEI()->plusFullMatrix(orbitIeJe->ppvaluepEJpEJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpXIpEJ() { - ppGpXIpEJ = toFMDsptr(orbitJeIe->ppvaluepEIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpEJ()->times(this->ratio()))); + ppGpXIpEJ = orbitJeIe->ppvaluepEIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpEJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpXIpXJ() { - ppGpXIpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpXJ()->times(this->ratio()))); + ppGpXIpXJ = orbitJeIe->ppvaluepXIpXJ()->transpose()->plusFullMatrix(orbitIeJe->ppvaluepXIpXJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpXJpEJ() { - ppGpXJpEJ = toFMDsptr(orbitJeIe->ppvaluepXIpEI()->plusFullMatrix(orbitIeJe->ppvaluepXJpEJ()->times(this->ratio()))); + ppGpXJpEJ = orbitJeIe->ppvaluepXIpEI()->plusFullMatrix(orbitIeJe->ppvaluepXJpEJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calc_ppGpXJpXJ() { - ppGpXJpXJ = toFMDsptr(orbitJeIe->ppvaluepXIpXI()->plusFullMatrix(orbitIeJe->ppvaluepXJpXJ()->times(this->ratio()))); + ppGpXJpXJ = orbitJeIe->ppvaluepXIpXI()->plusFullMatrix(orbitIeJe->ppvaluepXJpXJ()->times(this->ratio())); } void MbD::GearConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/LDUFullMat.cpp b/OndselSolver/LDUFullMat.cpp index b3d0498..010b21e 100644 --- a/OndselSolver/LDUFullMat.cpp +++ b/OndselSolver/LDUFullMat.cpp @@ -63,7 +63,7 @@ void LDUFullMat::postSolve() void LDUFullMat::preSolvesaveOriginal(FMatDsptr fullMat, bool saveOriginal) { if (saveOriginal) { - matrixA = toFMDsptr(fullMat->copy()); + matrixA = fullMat->copy(); } else { matrixA = fullMat; diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index 04240a9..a5acf7a 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -32,7 +32,7 @@ void MbD::MomentOfInertiaSolver::example1() solver->setJPP(aJPP); auto rPoP = aApP->transposeTimesFullColumn(rpPp->negated()); solver->setrPoP(rPoP); - auto aAPo = toFMDsptr(aApP->transpose()); + auto aAPo = aApP->transpose(); solver->setAPo(aAPo); solver->setrPcmP(rPoP); solver->calc(); diff --git a/OndselSolver/SparseMatrix.h b/OndselSolver/SparseMatrix.h index 22276c2..eea8d69 100644 --- a/OndselSolver/SparseMatrix.h +++ b/OndselSolver/SparseMatrix.h @@ -47,10 +47,10 @@ namespace MbD { void zeroSelf() override; void atijplusFullRow(int i, int j, FRowsptr fullRow); void atijplusFullColumn(int i, int j, FColsptr fullCol); - void atijplusFullMatrix(int i, int j, FMatsptr fullMat); - void atijminusFullMatrix(int i, int j, FMatsptr fullMat); - void atijplusTransposeFullMatrix(int i, int j, FMatsptr fullMat); - void atijplusFullMatrixtimes(int i, int j, FMatsptr fullMat, T factor); + void atijplusFullMatrix(int i, int j, FMatDsptr fullMat); + void atijminusFullMatrix(int i, int j, FMatDsptr fullMat); + void atijplusTransposeFullMatrix(int i, int j, FMatDsptr fullMat); + void atijplusFullMatrixtimes(int i, int j, FMatDsptr fullMat, T factor); void atijplusNumber(int i, int j, double value); void atijminusNumber(int i, int j, double value); void atijput(int i, int j, T value); @@ -117,7 +117,7 @@ namespace MbD { } } template - inline void SparseMatrix::atijplusFullMatrix(int i, int j, FMatsptr fullMat) + inline void SparseMatrix::atijplusFullMatrix(int i, int j, FMatDsptr fullMat) { for (int ii = 0; ii < fullMat->nrow(); ii++) { @@ -125,7 +125,7 @@ namespace MbD { } } template - inline void SparseMatrix::atijminusFullMatrix(int i, int j, FMatsptr fullMat) + inline void SparseMatrix::atijminusFullMatrix(int i, int j, FMatDsptr fullMat) { for (int ii = 0; ii < fullMat->nrow(); ii++) { @@ -133,7 +133,7 @@ namespace MbD { } } template - inline void SparseMatrix::atijplusTransposeFullMatrix(int i, int j, FMatsptr fullMat) + inline void SparseMatrix::atijplusTransposeFullMatrix(int i, int j, FMatDsptr fullMat) { for (int ii = 0; ii < fullMat->nrow(); ii++) { @@ -141,7 +141,7 @@ namespace MbD { } } template - inline void SparseMatrix::atijplusFullMatrixtimes(int i, int j, FMatsptr fullMat, T factor) + inline void SparseMatrix::atijplusFullMatrixtimes(int i, int j, FMatDsptr fullMat, T factor) { for (int ii = 0; ii < fullMat->nrow(); ii++) { From ede688e7dacba0603096ec08efcad6f75c9546e7 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 01:07:12 -0500 Subject: [PATCH 04/17] FullMatrix version are now all visible in lib. Now need FullColumn etc to work. --- CMakeLists.txt | 627 ++++++++++--------- OndselSolver/ASMTConstraintSet.cpp | 1 + OndselSolver/ASMTMarker.cpp | 1 + OndselSolver/DiagonalMatrix.cpp | 108 +++- OndselSolver/DiagonalMatrix.h | 110 +--- OndselSolver/EulerAnglesDDot.h | 4 +- OndselSolver/EulerParameters.cpp | 15 +- OndselSolver/EulerParameters.h | 6 +- OndselSolver/EulerParametersDot.h | 2 +- OndselSolver/FullColumn.cpp | 168 ++++- OndselSolver/FullColumn.h | 176 +----- OndselSolver/FullColumn.ref.h | 3 + OndselSolver/FullMatrix.cpp | 444 ++++--------- OndselSolver/FullMatrix.h | 196 +++--- OndselSolver/FullMatrix.ref.h | 1 + OndselSolver/FullRow.cpp | 103 ++- OndselSolver/Item.h | 8 +- OndselSolver/MBDynItem.cpp | 2 +- OndselSolver/MBDynMarker.cpp | 2 +- OndselSolver/MarkerFrame.cpp | 4 +- OndselSolver/MomentOfInertiaSolver.cpp | 6 +- OndselSolver/Part.cpp | 8 +- OndselSolver/RackPinConstraintIqcJc.cpp | 8 +- OndselSolver/RackPinConstraintIqcJqc.cpp | 12 +- OndselSolver/ScrewConstraintIqcJc.cpp | 8 +- OndselSolver/ScrewConstraintIqcJqc.cpp | 12 +- OndselSolver/TranslationConstraintIqcJc.cpp | 4 +- OndselSolver/TranslationConstraintIqcJqc.cpp | 4 +- 28 files changed, 939 insertions(+), 1104 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7ce907..95c5fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,19 +5,301 @@ project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibo set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -include(GNUInstallDirs) +set(ONDSELSOLVER_HEADERS + OndselSolver/AbsConstraint.h + OndselSolver/Abs.h + OndselSolver/AccICKineNewtonRaphson.h + OndselSolver/AccICNewtonRaphson.h + OndselSolver/AccKineNewtonRaphson.h + OndselSolver/AccNewtonRaphson.h + OndselSolver/AngleJoint.h + OndselSolver/AngleZIecJec.h + OndselSolver/AngleZIeqcJec.h + OndselSolver/AngleZIeqcJeqc.h + OndselSolver/AnyGeneralSpline.h + OndselSolver/AnyPosICNewtonRaphson.h + OndselSolver/APIExport.h + OndselSolver/ArcSine.h + OndselSolver/ArcTan2.h + OndselSolver/ArcTan.h + OndselSolver/Array.h + OndselSolver/ASMTAnimationParameters.h + OndselSolver/ASMTAssembly.h + OndselSolver/ASMTConstantGravity.h + OndselSolver/ASMTConstraintSet.h + OndselSolver/ASMTCylindricalJoint.h + OndselSolver/ASMTExtrusion.h + OndselSolver/ASMTFixedJoint.h + OndselSolver/ASMTForceTorque.h + OndselSolver/ASMTGeneralMotion.h + OndselSolver/ASMTItem.h + OndselSolver/ASMTItemIJ.h + OndselSolver/ASMTJoint.h + OndselSolver/ASMTKinematicIJ.h + OndselSolver/ASMTMarker.h + OndselSolver/ASMTMotion.h + OndselSolver/ASMTNoRotationJoint.h + OndselSolver/ASMTPart.h + OndselSolver/ASMTPointInLineJoint.h + OndselSolver/ASMTPointInPlaneJoint.h + OndselSolver/ASMTPrincipalMassMarker.h + OndselSolver/ASMTRefCurve.h + OndselSolver/ASMTRefItem.h + OndselSolver/ASMTRefPoint.h + OndselSolver/ASMTRefSurface.h + OndselSolver/ASMTRevoluteJoint.h + OndselSolver/ASMTRotationalMotion.h + OndselSolver/ASMTSimulationParameters.h + OndselSolver/ASMTSpatialContainer.h + OndselSolver/ASMTSpatialItem.h + OndselSolver/ASMTSphericalJoint.h + OndselSolver/ASMTTime.h + OndselSolver/ASMTTranslationalJoint.h + OndselSolver/ASMTTranslationalMotion.h + OndselSolver/ASMTUniversalJoint.h + OndselSolver/AtPointConstraintIJ.h + OndselSolver/AtPointConstraintIqcJc.h + OndselSolver/AtPointConstraintIqcJqc.h + OndselSolver/AtPointConstraintIqctJqc.h + OndselSolver/AtPointJoint.h + OndselSolver/BasicIntegrator.h + OndselSolver/BasicQuasiIntegrator.h + OndselSolver/BasicUserFunction.h + OndselSolver/CADSystem.h + OndselSolver/CartesianFrame.h + OndselSolver/CompoundJoint.h + OndselSolver/ConstantGravity.h + OndselSolver/Constant.h + OndselSolver/ConstantVelocityJoint.h + OndselSolver/Constraint.h + OndselSolver/ConstraintIJ.h + OndselSolver/ConstVelConstraintIJ.h + OndselSolver/ConstVelConstraintIqcJc.h + OndselSolver/ConstVelConstraintIqcJqc.h + OndselSolver/corecrt_math_defines.h + OndselSolver/Cosine.h + OndselSolver/CREATE.h + OndselSolver/CylindricalJoint.h + OndselSolver/CylSphJoint.h + OndselSolver/DiagonalMatrix.h + OndselSolver/DifferenceOperator.h + OndselSolver/DifferentiatedGeneralSpline.h + OndselSolver/DirectionCosineConstraintIJ.h + OndselSolver/DirectionCosineConstraintIqcJc.h + OndselSolver/DirectionCosineConstraintIqcJqc.h + OndselSolver/DirectionCosineConstraintIqctJqc.h + OndselSolver/DirectionCosineIecJec.h + OndselSolver/DirectionCosineIeqcJec.h + OndselSolver/DirectionCosineIeqcJeqc.h + OndselSolver/DirectionCosineIeqctJeqc.h + OndselSolver/DiscontinuityError.h + OndselSolver/DispCompIecJecIe.h + OndselSolver/DispCompIecJecKec.h + OndselSolver/DispCompIecJecKeqc.h + OndselSolver/DispCompIecJecO.h + OndselSolver/DispCompIeqcJecIe.h + OndselSolver/DispCompIeqcJecKeqc.h + OndselSolver/DispCompIeqcJecO.h + OndselSolver/DispCompIeqcJeqcIe.h + OndselSolver/DispCompIeqcJeqcKeqc.h + OndselSolver/DispCompIeqcJeqcKeqct.h + OndselSolver/DispCompIeqcJeqcO.h + OndselSolver/DispCompIeqctJeqcIe.h + OndselSolver/DispCompIeqctJeqcKeqct.h + OndselSolver/DispCompIeqctJeqcO.h + OndselSolver/DistanceConstraintIJ.h + OndselSolver/DistanceConstraintIqcJc.h + OndselSolver/DistanceConstraintIqcJqc.h + OndselSolver/DistanceConstraintIqctJqc.h + OndselSolver/DistancexyConstraintIJ.h + OndselSolver/DistancexyConstraintIqcJc.h + OndselSolver/DistancexyConstraintIqcJqc.h + OndselSolver/DistIecJec.h + OndselSolver/DistIeqcJec.h + OndselSolver/DistIeqcJeqc.h + OndselSolver/DistIeqctJeqc.h + OndselSolver/DistxyIecJec.h + OndselSolver/DistxyIeqcJec.h + OndselSolver/DistxyIeqcJeqc.h + OndselSolver/DistxyIeqctJeqc.h + OndselSolver/EigenDecomposition.h + OndselSolver/EndFramec.h + OndselSolver/EndFrameqc.h + OndselSolver/EndFrameqct2.h + OndselSolver/EndFrameqct.h + OndselSolver/enum.h + OndselSolver/EulerAnglesDDot.h + OndselSolver/EulerAnglesDot.h + OndselSolver/EulerAngles.h + OndselSolver/EulerAngleszxzDDot.h + OndselSolver/EulerAngleszxzDot.h + OndselSolver/EulerAngleszxz.h + OndselSolver/EulerArray.h + OndselSolver/EulerConstraint.h + OndselSolver/EulerParametersDDot.h + OndselSolver/EulerParametersDot.h + OndselSolver/EulerParameters.h + OndselSolver/Exponential.h + OndselSolver/ExpressionX.h + OndselSolver/ExternalSystem.h + OndselSolver/FixedJoint.h + OndselSolver/ForceTorqueData.h + OndselSolver/ForceTorqueItem.h + OndselSolver/FullColumn.h + OndselSolver/FullMatrix.h + OndselSolver/FullMotion.h + OndselSolver/FullRow.h + OndselSolver/FullVector.h + OndselSolver/FunctionFromData.h + OndselSolver/Function.h + OndselSolver/FunctionWithManyArgs.h + OndselSolver/FunctionXcParameter.h + OndselSolver/FunctionX.h + OndselSolver/FunctionXY.h + OndselSolver/GearConstraintIJ.h + OndselSolver/GearConstraintIqcJc.h + OndselSolver/GearConstraintIqcJqc.h + OndselSolver/GearJoint.h + OndselSolver/GEFullMatFullPv.h + OndselSolver/GEFullMat.h + OndselSolver/GEFullMatParPv.h + OndselSolver/GeneralSpline.h + OndselSolver/GESpMatFullPv.h + OndselSolver/GESpMatFullPvPosIC.h + OndselSolver/GESpMat.h + OndselSolver/GESpMatParPv.h + OndselSolver/GESpMatParPvMarkoFast.h + OndselSolver/GESpMatParPvMarko.h + OndselSolver/GESpMatParPvPrecise.h + OndselSolver/ICKineIntegrator.h + OndselSolver/IndependentVariable.h + OndselSolver/InLineJoint.h + OndselSolver/InPlaneJoint.h + OndselSolver/Integrator.h + OndselSolver/IntegratorInterface.h + OndselSolver/Item.h + OndselSolver/Joint.h + OndselSolver/KineIntegrator.h + OndselSolver/KinematicIeJe.h + OndselSolver/LDUFullMat.h + OndselSolver/LDUFullMatParPv.h + OndselSolver/LDUSpMat.h + OndselSolver/LDUSpMatParPv.h + OndselSolver/LDUSpMatParPvMarko.h + OndselSolver/LDUSpMatParPvPrecise.h + OndselSolver/LinearMultiStepMethod.h + OndselSolver/LineInPlaneJoint.h + OndselSolver/Ln.h + OndselSolver/Log10.h + OndselSolver/LogN.h + OndselSolver/MarkerFrame.h + OndselSolver/MatrixDecomposition.h + OndselSolver/MatrixGaussElimination.h + OndselSolver/MatrixLDU.h + OndselSolver/MatrixSolver.h + OndselSolver/MaximumIterationError.h + OndselSolver/MbdMath.h + OndselSolver/MBDynBlock.h + OndselSolver/MBDynBody.h + OndselSolver/MBDynControlData.h + OndselSolver/MBDynData.h + OndselSolver/MBDynElement.h + OndselSolver/MBDynInitialValue.h + OndselSolver/MBDynItem.h + OndselSolver/MBDynJoint.h + OndselSolver/MBDynMarker.h + OndselSolver/MBDynNode.h + OndselSolver/MBDynReference.h + OndselSolver/MBDynStructural.h + OndselSolver/MBDynSystem.h + OndselSolver/MomentOfInertiaSolver.h + OndselSolver/Negative.h + OndselSolver/NewtonRaphsonError.h + OndselSolver/NewtonRaphson.h + OndselSolver/NoRotationJoint.h + OndselSolver/NotKinematicError.h + OndselSolver/Numeric.h + OndselSolver/OndselSolver.h + OndselSolver/OrbitAnglezIecJec.h + OndselSolver/OrbitAnglezIeqcJec.h + OndselSolver/OrbitAnglezIeqcJeqc.h + OndselSolver/Orientation.h + OndselSolver/ParallelAxesJoint.h + OndselSolver/PartFrame.h + OndselSolver/Part.h + OndselSolver/PerpendicularJoint.h + OndselSolver/PlanarJoint.h + OndselSolver/PointInLineJoint.h + OndselSolver/PointInPlaneJoint.h + OndselSolver/PosICKineNewtonRaphson.h + OndselSolver/PosICNewtonRaphson.h + OndselSolver/PosKineNewtonRaphson.h + OndselSolver/PosNewtonRaphson.h + OndselSolver/PosVelAccData.h + OndselSolver/Power.h + OndselSolver/PrescribedMotion.h + OndselSolver/Product.h + OndselSolver/QuasiIntegrator.h + OndselSolver/RackPinConstraintIJ.h + OndselSolver/RackPinConstraintIqcJc.h + OndselSolver/RackPinConstraintIqcJqc.h + OndselSolver/RackPinJoint.h + OndselSolver/Reciprocal.h + OndselSolver/RedundantConstraint.h + OndselSolver/resource.h + OndselSolver/RevCylJoint.h + OndselSolver/RevoluteJoint.h + OndselSolver/RowTypeMatrix.h + OndselSolver/ScalarNewtonRaphson.h + OndselSolver/ScrewConstraintIJ.h + OndselSolver/ScrewConstraintIqcJc.h + OndselSolver/ScrewConstraintIqcJqc.h + OndselSolver/ScrewJoint.h + OndselSolver/SimulationStoppingError.h + OndselSolver/Sine.h + OndselSolver/SingularMatrixError.h + OndselSolver/Solver.h + OndselSolver/SparseColumn.h + OndselSolver/SparseMatrix.h + OndselSolver/SparseRow.h + OndselSolver/SparseVector.h + OndselSolver/SphericalJoint.h + OndselSolver/SphSphJoint.h + OndselSolver/StableBackwardDifference.h + OndselSolver/StateData.h + OndselSolver/Sum.h + OndselSolver/Symbolic.h + OndselSolver/SymbolicParser.h + OndselSolver/SyntaxError.h + OndselSolver/System.h + OndselSolver/SystemNewtonRaphson.h + OndselSolver/SystemSolver.h + OndselSolver/Time.h + OndselSolver/TooManyTriesError.h + OndselSolver/TooSmallStepSizeError.h + OndselSolver/TranslationalJoint.h + OndselSolver/TranslationConstraintIJ.h + OndselSolver/TranslationConstraintIqcJc.h + OndselSolver/TranslationConstraintIqcJqc.h + OndselSolver/TranslationConstraintIqctJqc.h + OndselSolver/Translation.h + OndselSolver/Units.h + OndselSolver/UniversalJoint.h + OndselSolver/UserFunction.h + OndselSolver/Variable.h + OndselSolver/VectorNewtonRaphson.h + OndselSolver/VelICKineSolver.h + OndselSolver/VelICSolver.h + OndselSolver/VelKineSolver.h + OndselSolver/VelSolver.h + OndselSolver/ZRotation.h + OndselSolver/ZTranslation.h +) -add_library(OndselSolver STATIC) - -set(ONDSELSOLVER_SRC - OndselSolver/Array.cpp - OndselSolver/FullVector.cpp - OndselSolver/RowTypeMatrix.cpp - OndselSolver/FullColumn.cpp +set(ONDSELSOLVER_EXPORT OndselSolver/FullMatrix.cpp - OndselSolver/FullRow.cpp - OndselSolver/Abs.cpp OndselSolver/AbsConstraint.cpp + OndselSolver/Abs.cpp OndselSolver/AccICKineNewtonRaphson.cpp OndselSolver/AccICNewtonRaphson.cpp OndselSolver/AccKineNewtonRaphson.cpp @@ -29,8 +311,9 @@ set(ONDSELSOLVER_SRC OndselSolver/AnyGeneralSpline.cpp OndselSolver/AnyPosICNewtonRaphson.cpp OndselSolver/ArcSine.cpp - OndselSolver/ArcTan.cpp OndselSolver/ArcTan2.cpp + OndselSolver/ArcTan.cpp + OndselSolver/Array.cpp OndselSolver/ASMTAnimationParameters.cpp OndselSolver/ASMTAssembly.cpp OndselSolver/ASMTConstantGravity.cpp @@ -132,8 +415,8 @@ set(ONDSELSOLVER_SRC OndselSolver/EigenDecomposition.cpp OndselSolver/EndFramec.cpp OndselSolver/EndFrameqc.cpp - OndselSolver/EndFrameqct.cpp OndselSolver/EndFrameqct2.cpp + OndselSolver/EndFrameqct.cpp OndselSolver/EulerAngles.cpp OndselSolver/EulerAnglesDDot.cpp OndselSolver/EulerAnglesDot.cpp @@ -151,12 +434,15 @@ set(ONDSELSOLVER_SRC OndselSolver/FixedJoint.cpp OndselSolver/ForceTorqueData.cpp OndselSolver/ForceTorqueItem.cpp + OndselSolver/FullColumn.cpp OndselSolver/FullMotion.cpp + OndselSolver/FullRow.cpp + OndselSolver/FullVector.cpp OndselSolver/Function.cpp OndselSolver/FunctionFromData.cpp OndselSolver/FunctionWithManyArgs.cpp - OndselSolver/FunctionX.cpp OndselSolver/FunctionXcParameter.cpp + OndselSolver/FunctionX.cpp OndselSolver/FunctionXY.cpp OndselSolver/GearConstraintIJ.cpp OndselSolver/GearConstraintIqcJc.cpp @@ -221,6 +507,7 @@ set(ONDSELSOLVER_SRC OndselSolver/NoRotationJoint.cpp OndselSolver/NotKinematicError.cpp OndselSolver/Numeric.cpp + OndselSolver/OndselSolver.cpp OndselSolver/OrbitAnglezIecJec.cpp OndselSolver/OrbitAnglezIeqcJec.cpp OndselSolver/OrbitAnglezIeqcJeqc.cpp @@ -249,6 +536,7 @@ set(ONDSELSOLVER_SRC OndselSolver/RedundantConstraint.cpp OndselSolver/RevCylJoint.cpp OndselSolver/RevoluteJoint.cpp + OndselSolver/RowTypeMatrix.cpp OndselSolver/ScalarNewtonRaphson.cpp OndselSolver/ScrewConstraintIJ.cpp OndselSolver/ScrewConstraintIqcJc.cpp @@ -276,12 +564,12 @@ set(ONDSELSOLVER_SRC OndselSolver/Time.cpp OndselSolver/TooManyTriesError.cpp OndselSolver/TooSmallStepSizeError.cpp - OndselSolver/Translation.cpp OndselSolver/TranslationalJoint.cpp OndselSolver/TranslationConstraintIJ.cpp OndselSolver/TranslationConstraintIqcJc.cpp OndselSolver/TranslationConstraintIqcJqc.cpp OndselSolver/TranslationConstraintIqctJqc.cpp + OndselSolver/Translation.cpp OndselSolver/Units.cpp OndselSolver/UniversalJoint.cpp OndselSolver/UserFunction.cpp @@ -295,310 +583,25 @@ set(ONDSELSOLVER_SRC OndselSolver/ZTranslation.cpp ) -set(ONDSELSOLVER_HEADERS - OndselSolver/Array.h - OndselSolver/FullVector.h - OndselSolver/RowTypeMatrix.h - OndselSolver/FullRow.h - OndselSolver/FullColumn.h - OndselSolver/FullMatrix.h - OndselSolver/Abs.h - OndselSolver/AbsConstraint.h - OndselSolver/AccICKineNewtonRaphson.h - OndselSolver/AccICNewtonRaphson.h - OndselSolver/AccKineNewtonRaphson.h - OndselSolver/AccNewtonRaphson.h - OndselSolver/AngleJoint.h - OndselSolver/AngleZIecJec.h - OndselSolver/AngleZIeqcJec.h - OndselSolver/AngleZIeqcJeqc.h - OndselSolver/AnyGeneralSpline.h - OndselSolver/AnyPosICNewtonRaphson.h - OndselSolver/APIExport.h - OndselSolver/ArcSine.h - OndselSolver/ArcTan.h - OndselSolver/ArcTan2.h - OndselSolver/ASMTAnimationParameters.h - OndselSolver/ASMTAssembly.h - OndselSolver/ASMTConstantGravity.h - OndselSolver/ASMTConstraintSet.h - OndselSolver/ASMTCylindricalJoint.h - OndselSolver/ASMTExtrusion.h - OndselSolver/ASMTFixedJoint.h - OndselSolver/ASMTForceTorque.h - OndselSolver/ASMTGeneralMotion.h - OndselSolver/ASMTItem.h - OndselSolver/ASMTItemIJ.h - OndselSolver/ASMTJoint.h - OndselSolver/ASMTKinematicIJ.h - OndselSolver/ASMTMarker.h - OndselSolver/ASMTMotion.h - OndselSolver/ASMTNoRotationJoint.h - OndselSolver/ASMTPart.h - OndselSolver/ASMTPointInLineJoint.h - OndselSolver/ASMTPointInPlaneJoint.h - OndselSolver/ASMTPrincipalMassMarker.h - OndselSolver/ASMTRefCurve.h - OndselSolver/ASMTRefItem.h - OndselSolver/ASMTRefPoint.h - OndselSolver/ASMTRefSurface.h - OndselSolver/ASMTRevoluteJoint.h - OndselSolver/ASMTRotationalMotion.h - OndselSolver/ASMTSimulationParameters.h - OndselSolver/ASMTSpatialContainer.h - OndselSolver/ASMTSpatialItem.h - OndselSolver/ASMTSphericalJoint.h - OndselSolver/ASMTTime.h - OndselSolver/ASMTTranslationalJoint.h - OndselSolver/ASMTTranslationalMotion.h - OndselSolver/ASMTUniversalJoint.h - OndselSolver/AtPointConstraintIJ.h - OndselSolver/AtPointConstraintIqcJc.h - OndselSolver/AtPointConstraintIqcJqc.h - OndselSolver/AtPointConstraintIqctJqc.h - OndselSolver/AtPointJoint.h - OndselSolver/BasicIntegrator.h - OndselSolver/BasicQuasiIntegrator.h - OndselSolver/BasicUserFunction.h - OndselSolver/CADSystem.h - OndselSolver/CartesianFrame.h - OndselSolver/CompoundJoint.h - OndselSolver/Constant.h - OndselSolver/ConstantGravity.h - OndselSolver/ConstantVelocityJoint.h - OndselSolver/Constraint.h - OndselSolver/ConstraintIJ.h - OndselSolver/ConstVelConstraintIJ.h - OndselSolver/ConstVelConstraintIqcJc.h - OndselSolver/ConstVelConstraintIqcJqc.h - OndselSolver/corecrt_math_defines.h - OndselSolver/Cosine.h - OndselSolver/CREATE.h - OndselSolver/CylindricalJoint.h - OndselSolver/CylSphJoint.h - OndselSolver/DiagonalMatrix.h - OndselSolver/DifferenceOperator.h - OndselSolver/DifferentiatedGeneralSpline.h - OndselSolver/DirectionCosineConstraintIJ.h - OndselSolver/DirectionCosineConstraintIqcJc.h - OndselSolver/DirectionCosineConstraintIqcJqc.h - OndselSolver/DirectionCosineConstraintIqctJqc.h - OndselSolver/DirectionCosineIecJec.h - OndselSolver/DirectionCosineIeqcJec.h - OndselSolver/DirectionCosineIeqcJeqc.h - OndselSolver/DirectionCosineIeqctJeqc.h - OndselSolver/DiscontinuityError.h - OndselSolver/DispCompIecJecIe.h - OndselSolver/DispCompIecJecKec.h - OndselSolver/DispCompIecJecKeqc.h - OndselSolver/DispCompIecJecO.h - OndselSolver/DispCompIeqcJecIe.h - OndselSolver/DispCompIeqcJecKeqc.h - OndselSolver/DispCompIeqcJecO.h - OndselSolver/DispCompIeqcJeqcIe.h - OndselSolver/DispCompIeqcJeqcKeqc.h - OndselSolver/DispCompIeqcJeqcKeqct.h - OndselSolver/DispCompIeqcJeqcO.h - OndselSolver/DispCompIeqctJeqcIe.h - OndselSolver/DispCompIeqctJeqcKeqct.h - OndselSolver/DispCompIeqctJeqcO.h - OndselSolver/DistanceConstraintIJ.h - OndselSolver/DistanceConstraintIqcJc.h - OndselSolver/DistanceConstraintIqcJqc.h - OndselSolver/DistanceConstraintIqctJqc.h - OndselSolver/DistancexyConstraintIJ.h - OndselSolver/DistancexyConstraintIqcJc.h - OndselSolver/DistancexyConstraintIqcJqc.h - OndselSolver/DistIecJec.h - OndselSolver/DistIeqcJec.h - OndselSolver/DistIeqcJeqc.h - OndselSolver/DistIeqctJeqc.h - OndselSolver/DistxyIecJec.h - OndselSolver/DistxyIeqcJec.h - OndselSolver/DistxyIeqcJeqc.h - OndselSolver/DistxyIeqctJeqc.h - OndselSolver/EigenDecomposition.h - OndselSolver/EndFramec.h - OndselSolver/EndFrameqc.h - OndselSolver/EndFrameqct.h - OndselSolver/EndFrameqct2.h - OndselSolver/enum.h - OndselSolver/EulerAngles.h - OndselSolver/EulerAnglesDDot.h - OndselSolver/EulerAnglesDot.h - OndselSolver/EulerAngleszxz.h - OndselSolver/EulerAngleszxzDDot.h - OndselSolver/EulerAngleszxzDot.h - OndselSolver/EulerArray.h - OndselSolver/EulerConstraint.h - OndselSolver/EulerParameters.h - OndselSolver/EulerParametersDDot.h - OndselSolver/EulerParametersDot.h - OndselSolver/Exponential.h - OndselSolver/ExpressionX.h - OndselSolver/ExternalSystem.h - OndselSolver/FixedJoint.h - OndselSolver/ForceTorqueData.h - OndselSolver/ForceTorqueItem.h - OndselSolver/FullMotion.h - OndselSolver/FullRow.h - OndselSolver/Function.h - OndselSolver/FunctionFromData.h - OndselSolver/FunctionWithManyArgs.h - OndselSolver/FunctionX.h - OndselSolver/FunctionXcParameter.h - OndselSolver/FunctionXY.h - OndselSolver/GearConstraintIJ.h - OndselSolver/GearConstraintIqcJc.h - OndselSolver/GearConstraintIqcJqc.h - OndselSolver/GearJoint.h - OndselSolver/GEFullMat.h - OndselSolver/GEFullMatFullPv.h - OndselSolver/GEFullMatParPv.h - OndselSolver/GeneralSpline.h - OndselSolver/GESpMat.h - OndselSolver/GESpMatFullPv.h - OndselSolver/GESpMatFullPvPosIC.h - OndselSolver/GESpMatParPv.h - OndselSolver/GESpMatParPvMarko.h - OndselSolver/GESpMatParPvMarkoFast.h - OndselSolver/GESpMatParPvPrecise.h - OndselSolver/ICKineIntegrator.h - OndselSolver/IndependentVariable.h - OndselSolver/InLineJoint.h - OndselSolver/InPlaneJoint.h - OndselSolver/Integrator.h - OndselSolver/IntegratorInterface.h - OndselSolver/Item.h - OndselSolver/Joint.h - OndselSolver/KineIntegrator.h - OndselSolver/KinematicIeJe.h - OndselSolver/LDUFullMat.h - OndselSolver/LDUFullMatParPv.h - OndselSolver/LDUSpMat.h - OndselSolver/LDUSpMatParPv.h - OndselSolver/LDUSpMatParPvMarko.h - OndselSolver/LDUSpMatParPvPrecise.h - OndselSolver/LinearMultiStepMethod.h - OndselSolver/LineInPlaneJoint.h - OndselSolver/Ln.h - OndselSolver/Log10.h - OndselSolver/LogN.h - OndselSolver/MarkerFrame.h - OndselSolver/MatrixDecomposition.h - OndselSolver/MatrixGaussElimination.h - OndselSolver/MatrixLDU.h - OndselSolver/MatrixSolver.h - OndselSolver/MaximumIterationError.h - OndselSolver/MbdMath.h - OndselSolver/MBDynBlock.h - OndselSolver/MBDynBody.h - OndselSolver/MBDynControlData.h - OndselSolver/MBDynData.h - OndselSolver/MBDynElement.h - OndselSolver/MBDynInitialValue.h - OndselSolver/MBDynItem.h - OndselSolver/MBDynJoint.h - OndselSolver/MBDynMarker.h - OndselSolver/MBDynNode.h - OndselSolver/MBDynReference.h - OndselSolver/MBDynStructural.h - OndselSolver/MBDynSystem.h - OndselSolver/MomentOfInertiaSolver.h - OndselSolver/Negative.h - OndselSolver/NewtonRaphson.h - OndselSolver/NewtonRaphsonError.h - OndselSolver/NoRotationJoint.h - OndselSolver/NotKinematicError.h - OndselSolver/Numeric.h - OndselSolver/OrbitAnglezIecJec.h - OndselSolver/OrbitAnglezIeqcJec.h - OndselSolver/OrbitAnglezIeqcJeqc.h - OndselSolver/Orientation.h - OndselSolver/ParallelAxesJoint.h - OndselSolver/Part.h - OndselSolver/PartFrame.h - OndselSolver/PerpendicularJoint.h - OndselSolver/PlanarJoint.h - OndselSolver/PointInLineJoint.h - OndselSolver/PointInPlaneJoint.h - OndselSolver/PosICKineNewtonRaphson.h - OndselSolver/PosICNewtonRaphson.h - OndselSolver/PosKineNewtonRaphson.h - OndselSolver/PosNewtonRaphson.h - OndselSolver/PosVelAccData.h - OndselSolver/Power.h - OndselSolver/PrescribedMotion.h - OndselSolver/Product.h - OndselSolver/QuasiIntegrator.h - OndselSolver/RackPinConstraintIJ.h - OndselSolver/RackPinConstraintIqcJc.h - OndselSolver/RackPinConstraintIqcJqc.h - OndselSolver/RackPinJoint.h - OndselSolver/Reciprocal.h - OndselSolver/RedundantConstraint.h - OndselSolver/resource.h - OndselSolver/RevCylJoint.h - OndselSolver/RevoluteJoint.h - OndselSolver/ScalarNewtonRaphson.h - OndselSolver/ScrewConstraintIJ.h - OndselSolver/ScrewConstraintIqcJc.h - OndselSolver/ScrewConstraintIqcJqc.h - OndselSolver/ScrewJoint.h - OndselSolver/SimulationStoppingError.h - OndselSolver/Sine.h - OndselSolver/SingularMatrixError.h - OndselSolver/Solver.h - OndselSolver/SparseColumn.h - OndselSolver/SparseMatrix.h - OndselSolver/SparseRow.h - OndselSolver/SparseVector.h - OndselSolver/SphericalJoint.h - OndselSolver/SphSphJoint.h - OndselSolver/StableBackwardDifference.h - OndselSolver/StateData.h - OndselSolver/Sum.h - OndselSolver/Symbolic.h - OndselSolver/SymbolicParser.h - OndselSolver/SyntaxError.h - OndselSolver/System.h - OndselSolver/SystemNewtonRaphson.h - OndselSolver/SystemSolver.h - OndselSolver/Time.h - OndselSolver/TooManyTriesError.h - OndselSolver/TooSmallStepSizeError.h - OndselSolver/Translation.h - OndselSolver/TranslationalJoint.h - OndselSolver/TranslationConstraintIJ.h - OndselSolver/TranslationConstraintIqcJc.h - OndselSolver/TranslationConstraintIqcJqc.h - OndselSolver/TranslationConstraintIqctJqc.h - OndselSolver/Units.h - OndselSolver/UniversalJoint.h - OndselSolver/UserFunction.h - OndselSolver/Variable.h - OndselSolver/VectorNewtonRaphson.h - OndselSolver/VelICKineSolver.h - OndselSolver/VelICSolver.h - OndselSolver/VelKineSolver.h - OndselSolver/VelSolver.h - OndselSolver/ZRotation.h - OndselSolver/ZTranslation.h +add_library(OndselSolver "") + +target_sources(OndselSolver + PRIVATE + ${ONDSELSOLVER_EXPORT} + PUBLIC + ${ONDSELSOLVER_HEADERS} ) -target_sources(OndselSolver PRIVATE - "${ONDSELSOLVER_SRC}" - "${ONDSELSOLVER_HEADERS}") - -set_target_properties(OndselSolver - PROPERTIES VERSION ${PROJECT_VERSION} - SOVERSION 1 - PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}" -) +#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_EXPORT}) +#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_HEADERS}) configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) install(TARGETS OndselSolver LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) + +# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) + install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) + diff --git a/OndselSolver/ASMTConstraintSet.cpp b/OndselSolver/ASMTConstraintSet.cpp index b6db283..bd1f36c 100644 --- a/OndselSolver/ASMTConstraintSet.cpp +++ b/OndselSolver/ASMTConstraintSet.cpp @@ -10,6 +10,7 @@ #include "ASMTAssembly.h" #include "ASMTMarker.h" #include "Joint.h" +#include "FullMatrix.h" using namespace MbD; diff --git a/OndselSolver/ASMTMarker.cpp b/OndselSolver/ASMTMarker.cpp index db8d78a..c356bf6 100644 --- a/OndselSolver/ASMTMarker.cpp +++ b/OndselSolver/ASMTMarker.cpp @@ -7,6 +7,7 @@ ***************************************************************************/ #include "ASMTMarker.h" +#include "FullMatrix.h" #include "ASMTRefItem.h" #include "ASMTPart.h" #include "Part.h" diff --git a/OndselSolver/DiagonalMatrix.cpp b/OndselSolver/DiagonalMatrix.cpp index 13bba29..b5b60da 100644 --- a/OndselSolver/DiagonalMatrix.cpp +++ b/OndselSolver/DiagonalMatrix.cpp @@ -7,5 +7,111 @@ ***************************************************************************/ #include "DiagonalMatrix.h" +#include "FullMatrix.h" -using namespace MbD; +namespace MbD { + + template<> + inline DiagMatDsptr DiagonalMatrix::times(double factor) + { + auto nrow = (int)this->size(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i) * factor; + } + return answer; + } + template + inline void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr> diagMat) + { + for (int ii = 0; ii < diagMat->size(); ii++) + { + this->at(i + ii) = diagMat->at(ii); + } + } + template + inline DiagMatsptr DiagonalMatrix::times(T factor) + { + assert(false); + } + template + inline FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) + { + //"a*b = a(i,j)b(j) sum j." + + auto nrow = (int)this->size(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i) * fullCol->at(i); + } + return answer; + } + template + inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) + { + auto nrow = (int)this->size(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = fullMat->at(i)->times(this->at(i)); + } + return answer; + } + template<> + inline double DiagonalMatrix::sumOfSquares() + { + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i); + sum += element * element; + } + return sum; + } + template + inline int DiagonalMatrix::numberOfElements() + { + auto n = (int)this->size(); + return n * n; + } + template<> + inline void DiagonalMatrix::zeroSelf() + { + for (int i = 0; i < this->size(); i++) { + this->at(i) = 0.0; + } + } + template<> + inline double DiagonalMatrix::maxMagnitude() + { + double max = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i); + if (element < 0.0) element = -element; + if (max < element) max = element; + } + return max; + } + template + inline double DiagonalMatrix::maxMagnitude() + { + assert(false); + return 0.0; + } + template + inline std::ostream& DiagonalMatrix::printOn(std::ostream& s) const + { + s << "DiagMat["; + s << this->at(0); + for (int i = 1; i < this->size(); i++) + { + s << ", " << this->at(i); + } + s << "]"; + return s; + } + +} diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index f158195..ac73c50 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -8,10 +8,14 @@ #pragma once +#include "FullColumn.ref.h" +#include "FullRow.ref.h" +#include "FullMatrix.ref.h" #include "DiagonalMatrix.ref.h" #include "Array.h" -#include "FullColumn.h" -#include "FullMatrix.h" +//#include "FullColumn.h" +//#include "FullRow.h" +// #include "FullMatrix.h" namespace MbD { template @@ -41,107 +45,5 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - template<> - inline DiagMatDsptr DiagonalMatrix::times(double factor) - { - auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i) * factor; - } - return answer; - } - template - inline void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr> diagMat) - { - for (int ii = 0; ii < diagMat->size(); ii++) - { - this->at(i + ii) = diagMat->at(ii); - } - } - template - inline DiagMatsptr DiagonalMatrix::times(T factor) - { - assert(false); - } - template - inline FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) - { - //"a*b = a(i,j)b(j) sum j." - - auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i) * fullCol->at(i); - } - return answer; - } - template - inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) - { - auto nrow = (int)this->size(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = fullMat->at(i)->times(this->at(i)); - } - return answer; - } - template<> - inline double DiagonalMatrix::sumOfSquares() - { - double sum = 0.0; - for (int i = 0; i < this->size(); i++) - { - double element = this->at(i); - sum += element * element; - } - return sum; - } - template - inline int DiagonalMatrix::numberOfElements() - { - auto n = (int)this->size(); - return n * n; - } - template<> - inline void DiagonalMatrix::zeroSelf() - { - for (int i = 0; i < this->size(); i++) { - this->at(i) = 0.0; - } - } - template<> - inline double DiagonalMatrix::maxMagnitude() - { - double max = 0.0; - for (int i = 0; i < this->size(); i++) - { - double element = this->at(i); - if (element < 0.0) element = -element; - if (max < element) max = element; - } - return max; - } - template - inline double DiagonalMatrix::maxMagnitude() - { - assert(false); - return 0.0; - } - template - inline std::ostream& DiagonalMatrix::printOn(std::ostream& s) const - { - s << "DiagMat["; - s << this->at(0); - for (int i = 1; i < this->size(); i++) - { - s << ", " << this->at(i); - } - s << "]"; - return s; - } } diff --git a/OndselSolver/EulerAnglesDDot.h b/OndselSolver/EulerAnglesDDot.h index f724905..44edb61 100644 --- a/OndselSolver/EulerAnglesDDot.h +++ b/OndselSolver/EulerAnglesDDot.h @@ -79,10 +79,10 @@ namespace MbD { auto term7 = phiA->timesFullMatrix(theAdot->timesFullMatrix(psiAdot)); auto term8 = phiA->timesFullMatrix(theA->timesFullMatrix(psiAddot)); - aAddot = toFMDsptr(term->plusFullMatrix(term1)->plusFullMatrix(term2) + aAddot = term->plusFullMatrix(term1)->plusFullMatrix(term2) ->plusFullMatrix(term3)->plusFullMatrix(term4) ->plusFullMatrix(term5)->plusFullMatrix(term6) - ->plusFullMatrix(term7)->plusFullMatrix(term8)); + ->plusFullMatrix(term7)->plusFullMatrix(term8); } template inline void EulerAnglesDDot::aEulerAngles(EulerAngles* eulerAngles) diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 4c4b999..009e928 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -7,6 +7,9 @@ ***************************************************************************/ #include "EulerParameters.h" +#include "FullColumn.h" +#include "FullRow.h" +#include "FullMatrix.h" using namespace MbD; template<> @@ -160,8 +163,8 @@ inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) return answer; } -template<> -inline void EulerParameters::initialize() +template // this is ALWAYS double; see note below. +inline void EulerParameters::initialize() { aA = FullMatrixDouble::identitysptr(3); aB = std::make_shared(3, 4); @@ -172,6 +175,14 @@ inline void EulerParameters::initialize() pApE->at(i) = std::make_shared(3, 3); } } + +// the following can't be valid as FullMatrix instatiatiates , yet +// this class needs to see the member functions of FullMatrix +//template<> +//inline void EulerParameters::initialize() +//{ +//} + template inline void EulerParameters::calc() { diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 05d475b..2d93041 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -8,10 +8,12 @@ #pragma once +#include "FullColumn.ref.h" +#include "FullMatrix.ref.h" #include "EulerParameters.ref.h" #include "EulerArray.h" -#include "FullColumn.h" -#include "FullMatrix.h" +// #include "FullColumn.h" +// #include "FullMatrix.h" namespace MbD { diff --git a/OndselSolver/EulerParametersDot.h b/OndselSolver/EulerParametersDot.h index 2423cc4..6389f13 100644 --- a/OndselSolver/EulerParametersDot.h +++ b/OndselSolver/EulerParametersDot.h @@ -185,7 +185,7 @@ namespace MbD { inline FColDsptr EulerParametersDot::omeOpO() { auto aaa = this->aB(); - auto bbb = aaa->timesFullColumn(this); + auto bbb = aaa->timesFullColumn((MbD::FColsptr)this); auto ccc = bbb->times(2.0); return ccc; //return this->aB->timesFullColumn(this)->times(2.0); diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index e689f73..75af3f7 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -9,5 +9,171 @@ #include #include "FullColumn.h" +#include "FullRow.h" +#include "FullMatrix.h" -using namespace MbD; +namespace MbD { + template + FColsptr FullColumn::plusFullColumn(FColsptr fullCol) + { + int n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) + fullCol->at(i); + } + return answer; + } + template + FColsptr FullColumn::minusFullColumn(FColsptr fullCol) + { + int n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) { + answer->at(i) = this->at(i) - fullCol->at(i); + } + return answer; + } + template<> + FColDsptr FullColumn::times(double a) + { + int n = (int)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 + FColsptr FullColumn::times(T a) + { + assert(false); + } + template + FColsptr FullColumn::negated() + { + return this->times(-1.0); + } + template + void FullColumn::atiputFullColumn(int i, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i + ii) = fullCol->at(ii); + } + } + template + void FullColumn::atiplusFullColumn(int i, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + this->at(i + ii) += fullCol->at(ii); + } + } + template + void FullColumn::equalSelfPlusFullColumnAt(FColsptr fullCol, int ii) + { + //self is subcolumn of fullCol + for (int i = 0; i < this->size(); i++) + { + this->at(i) += fullCol->at(ii + i); + } + } + template + void FullColumn::atiminusFullColumn(int i1, FColsptr fullCol) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + int i = i1 + ii; + this->at(i) -= fullCol->at(ii); + } + } + template + void FullColumn::equalFullColumnAt(FColsptr fullCol, int i) + { + this->equalArrayAt(fullCol, i); + //for (int ii = 0; ii < this->size(); ii++) + //{ + // this->at(ii) = fullCol->at(i + ii); + //} + } + template<> + FColDsptr FullColumn::copy() + { + auto n = (int) this->size(); + auto answer = std::make_shared>(n); + for (int i = 0; i < n; i++) + { + answer->at(i) = this->at(i); + } + return answer; + } + template + FRowsptr FullColumn::transpose() + { + return std::make_shared>(*this); + } + template + void FullColumn::atiplusFullColumntimes(int i1, FColsptr fullCol, T factor) + { + for (int ii = 0; ii < fullCol->size(); ii++) + { + int i = i1 + ii; + this->at(i) += fullCol->at(ii) * factor; + } + } + template + T FullColumn::transposeTimesFullColumn(const FColsptr fullCol) + { + return this->dot(fullCol); + } + template + void FullColumn::equalSelfPlusFullColumntimes(FColsptr fullCol, T factor) + { + this->equalSelfPlusFullVectortimes(fullCol, factor); + } + template + FColsptr FullColumn::cross(FColsptr fullCol) + { + auto a0 = this->at(0); + auto a1 = this->at(1); + auto a2 = this->at(2); + auto b0 = fullCol->at(0); + auto b1 = fullCol->at(1); + auto b2 = fullCol->at(2); + auto answer = std::make_shared>(3); + answer->atiput(0, a1 * b2 - (a2 * b1)); + answer->atiput(1, a2 * b0 - (a0 * b2)); + answer->atiput(2, a0 * b1 - (a1 * b0)); + return answer; + } + //template<> + //inline std::shared_ptr> FullColumn::simplified() + //{ + // auto n = this->size(); + // auto answer = std::make_shared>(n); + // for (int i = 0; i < n; i++) + // { + // auto func = this->at(i); + // answer->at(i) = func->simplified(func); + // } + // return answer; + //} + template + FColsptr FullColumn::simplified() + { + assert(false); + return FColsptr(); + } + template + std::ostream& FullColumn::printOn(std::ostream& s) const + { + s << "FullCol{"; + s << this->at(0); + for (int i = 1; i < this->size(); i++) + { + s << ", " << this->at(i); + } + s << "}"; + return s; + } +} \ No newline at end of file diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 4f495bb..9088a97 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -14,19 +14,9 @@ #include "FullVector.h" #include "FullColumn.ref.h" #include "FullRow.ref.h" -#include "FullColumn.h" -#include "FullRow.h" +#include "FullMatrix.ref.h" namespace MbD { -// template -// class FullColumn; -// using FColDsptr = std::shared_ptr>; -// template -// using FColsptr = std::shared_ptr>; -// template -// class FullRow; -// template -// using FRowsptr = std::shared_ptr>; class Symbolic; template @@ -58,168 +48,6 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - template - inline FColsptr FullColumn::plusFullColumn(FColsptr fullCol) - { - int n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i) + fullCol->at(i); - } - return answer; - } - template - inline FColsptr FullColumn::minusFullColumn(FColsptr fullCol) - { - int n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) { - answer->at(i) = this->at(i) - fullCol->at(i); - } - return answer; - } - template<> - inline FColDsptr FullColumn::times(double a) - { - int n = (int)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 FColsptr FullColumn::times(T a) - { - assert(false); - } - template - inline FColsptr FullColumn::negated() - { - return this->times(-1.0); - } - template - inline void FullColumn::atiputFullColumn(int i, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - this->at(i + ii) = fullCol->at(ii); - } - } - template - inline void FullColumn::atiplusFullColumn(int i, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - this->at(i + ii) += fullCol->at(ii); - } - } - template - inline void FullColumn::equalSelfPlusFullColumnAt(FColsptr fullCol, int ii) - { - //self is subcolumn of fullCol - for (int i = 0; i < this->size(); i++) - { - this->at(i) += fullCol->at(ii + i); - } - } - template - inline void FullColumn::atiminusFullColumn(int i1, FColsptr fullCol) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - int i = i1 + ii; - this->at(i) -= fullCol->at(ii); - } - } - template - inline void FullColumn::equalFullColumnAt(FColsptr fullCol, int i) - { - this->equalArrayAt(fullCol, i); - //for (int ii = 0; ii < this->size(); ii++) - //{ - // this->at(ii) = fullCol->at(i + ii); - //} - } - template<> - inline FColDsptr FullColumn::copy() - { - auto n = (int) this->size(); - auto answer = std::make_shared>(n); - for (int i = 0; i < n; i++) - { - answer->at(i) = this->at(i); - } - return answer; - } - template - inline FRowsptr FullColumn::transpose() - { - return std::make_shared>(*this); - } - template - inline void FullColumn::atiplusFullColumntimes(int i1, FColsptr fullCol, T factor) - { - for (int ii = 0; ii < fullCol->size(); ii++) - { - int i = i1 + ii; - this->at(i) += fullCol->at(ii) * factor; - } - } - template - inline T FullColumn::transposeTimesFullColumn(const FColsptr fullCol) - { - return this->dot(fullCol); - } - template - inline void FullColumn::equalSelfPlusFullColumntimes(FColsptr fullCol, T factor) - { - this->equalSelfPlusFullVectortimes(fullCol, factor); - } - template - inline FColsptr FullColumn::cross(FColsptr fullCol) - { - auto a0 = this->at(0); - auto a1 = this->at(1); - auto a2 = this->at(2); - auto b0 = fullCol->at(0); - auto b1 = fullCol->at(1); - auto b2 = fullCol->at(2); - auto answer = std::make_shared>(3); - answer->atiput(0, a1 * b2 - (a2 * b1)); - answer->atiput(1, a2 * b0 - (a0 * b2)); - answer->atiput(2, a0 * b1 - (a1 * b0)); - return answer; - } - //template<> - //inline std::shared_ptr> FullColumn::simplified() - //{ - // auto n = this->size(); - // auto answer = std::make_shared>(n); - // for (int i = 0; i < n; i++) - // { - // auto func = this->at(i); - // answer->at(i) = func->simplified(func); - // } - // return answer; - //} - template - inline FColsptr FullColumn::simplified() - { - assert(false); - return FColsptr(); - } - template - inline std::ostream& FullColumn::printOn(std::ostream& s) const - { - s << "FullCol{"; - s << this->at(0); - for (int i = 1; i < this->size(); i++) - { - s << ", " << this->at(i); - } - s << "}"; - return s; - } + template class FullVector; } diff --git a/OndselSolver/FullColumn.ref.h b/OndselSolver/FullColumn.ref.h index 7673a9c..d622179 100644 --- a/OndselSolver/FullColumn.ref.h +++ b/OndselSolver/FullColumn.ref.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + namespace MbD { template class FullColumn; diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 5989ad5..6087540 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -13,68 +13,29 @@ #include "EulerParameters.h" namespace MbD { -// template -// -// inline std::shared_ptr> rotatex(T the) + FColsptr FullMatrixDouble::timesFullColumn(FColsptr fullCol) + { +// return this->timesFullColumn(fullCol.get()); + auto nrow = this->nrow(); + auto answer = std::make_shared>(nrow); + for (int i = 0; i < nrow; i++) + { + answer->at(i) = this->at(i)->timesFullColumn(fullCol); + } + return answer; + } +// FColsptr timesFullColumn(FullColumn* fullCol) // local // { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, 1.0); -// row0->atiput(1, 0.0); -// row0->atiput(2, 0.0); -// auto row1 = rotMat->at(1); -// row1->atiput(0, 0.0); -// row1->atiput(1, cthe); -// row1->atiput(2, -sthe); -// auto row2 = rotMat->at(2); -// row2->atiput(0, 0.0); -// row2->atiput(1, sthe); -// row2->atiput(2, cthe); -// return rotMat; +// //"a*b = a(i,j)b(j) sum j." +// auto nrow = this->nrow(); +// auto answer = std::make_shared>(nrow); +// for (int i = 0; i < nrow; i++) +// { +// answer->at(i) = this->at(i)->timesFullColumn(fullCol); +// } +// return answer; // } -// template -// inline std::shared_ptr> rotatey(T the) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, cthe); -// row0->atiput(1, 0.0); -// row0->atiput(2, sthe); -// auto row1 = rotMat->at(1); -// row1->atiput(0, 0.0); -// row1->atiput(1, 1.0); -// row1->atiput(2, 0.0); -// auto row2 = rotMat->at(2); -// row2->atiput(0, -sthe); -// row2->atiput(1, 0.0); -// row2->atiput(2, cthe); -// return rotMat; -// } -// template -// inline std::shared_ptr> rotatez(T the) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, cthe); -// row0->atiput(1, -sthe); -// row0->atiput(2, 0.0); -// auto row1 = rotMat->at(1); -// row1->atiput(0, sthe); -// row1->atiput(1, cthe); -// row1->atiput(2, 0.0); -// auto row2 = rotMat->at(2); -// row2->atiput(0, 0.0); -// row2->atiput(1, 0.0); -// row2->atiput(2, 1.0); -// return rotMat; -// } - inline std::shared_ptr rotatex(double the) + std::shared_ptr FullMatrixDouble::rotatex(double the) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -93,7 +54,7 @@ namespace MbD { row2->atiput(2, cthe); return rotMat; } - inline std::shared_ptr rotatey(double the) + std::shared_ptr FullMatrixDouble::rotatey(double the) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -112,7 +73,7 @@ namespace MbD { row2->atiput(2, cthe); return rotMat; } - inline std::shared_ptr rotatez(double the) + std::shared_ptr FullMatrixDouble::rotatez(double the) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -131,73 +92,7 @@ namespace MbD { row2->atiput(2, 1.0); return rotMat; } -// template -// inline std::shared_ptr> rotatexrotDot(T the, T thedot) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto sthedot = cthe * thedot; -// auto cthedot = -sthe * thedot; -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, 0.0); -// row0->atiput(1, 0.0); -// row0->atiput(2, 0.0); -// auto row1 = rotMat->at(1); -// row1->atiput(0, 0.0); -// row1->atiput(1, cthedot); -// row1->atiput(2, -sthedot); -// auto row2 = rotMat->at(2); -// row2->atiput(0, 0.0); -// row2->atiput(1, sthedot); -// row2->atiput(2, cthedot); -// return rotMat; -// } -// template -// inline std::shared_ptr> rotateyrotDot(T the, T thedot) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto sthedot = cthe * thedot; -// auto cthedot = -sthe * thedot; -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, cthedot); -// row0->atiput(1, 0.0); -// row0->atiput(2, sthedot); -// auto row1 = rotMat->at(1); -// row1->atiput(0, 0.0); -// row1->atiput(1, 0.0); -// row1->atiput(2, 0.0); -// auto row2 = rotMat->at(2); -// row2->atiput(0, -sthedot); -// row2->atiput(1, 0.0); -// row2->atiput(2, cthedot); -// return rotMat; -// } -// template -// inline std::shared_ptr> rotatezrotDot(T the, T thedot) -// { -// auto sthe = std::sin(the); -// auto cthe = std::cos(the); -// auto sthedot = cthe * thedot; -// auto cthedot = -sthe * thedot; -// auto rotMat = std::make_shared>(3, 3); -// auto row0 = rotMat->at(0); -// row0->atiput(0, cthedot); -// row0->atiput(1, -sthedot); -// row0->atiput(2, 0.0); -// auto row1 = rotMat->at(1); -// row1->atiput(0, sthedot); -// row1->atiput(1, cthedot); -// row1->atiput(2, 0.0); -// auto row2 = rotMat->at(2); -// row2->atiput(0, 0.0); -// row2->atiput(1, 0.0); -// row2->atiput(2, 0.0); -// return rotMat; -// } - inline std::shared_ptr rotatexrotDot(double the, double thedot) + std::shared_ptr FullMatrixDouble::rotatexrotDot(double the, double thedot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -218,7 +113,7 @@ namespace MbD { row2->atiput(2, cthedot); return rotMat; } - inline std::shared_ptr rotateyrotDot(double the, double thedot) + std::shared_ptr FullMatrixDouble::rotateyrotDot(double the, double thedot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -239,7 +134,7 @@ namespace MbD { row2->atiput(2, cthedot); return rotMat; } - inline std::shared_ptr rotatezrotDot(double the, double thedot) + std::shared_ptr FullMatrixDouble::rotatezrotDot(double the, double thedot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -260,8 +155,7 @@ namespace MbD { row2->atiput(2, 0.0); return rotMat; } - template - inline std::shared_ptr> rotatexrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr FullMatrixDouble::rotatexrotDotrotDDot(double the, double thedot, double theddot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -269,7 +163,7 @@ namespace MbD { auto cthedot = -sthe * thedot; auto stheddot = cthedot * thedot + (cthe * theddot); auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); + auto rotMat = std::make_shared(3, 3); auto row0 = rotMat->at(0); row0->atiput(0, 0.0); row0->atiput(1, 0.0); @@ -284,8 +178,7 @@ namespace MbD { row2->atiput(2, ctheddot); return rotMat; } - template - inline std::shared_ptr> rotateyrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr FullMatrixDouble::rotateyrotDotrotDDot(double the, double thedot, double theddot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -293,7 +186,7 @@ namespace MbD { auto cthedot = -sthe * thedot; auto stheddot = cthedot * thedot + (cthe * theddot); auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); + auto rotMat = std::make_shared(3, 3); auto row0 = rotMat->at(0); row0->atiput(0, ctheddot); row0->atiput(1, 0.0); @@ -308,8 +201,7 @@ namespace MbD { row2->atiput(2, ctheddot); return rotMat; } - template - inline std::shared_ptr> rotatezrotDotrotDDot(T the, T thedot, T theddot) + std::shared_ptr FullMatrixDouble::rotatezrotDotrotDDot(double the, double thedot, double theddot) { auto sthe = std::sin(the); auto cthe = std::cos(the); @@ -317,7 +209,7 @@ namespace MbD { auto cthedot = -sthe * thedot; auto stheddot = cthedot * thedot + (cthe * theddot); auto ctheddot = -(sthedot * thedot) - (sthe * theddot); - auto rotMat = std::make_shared>(3, 3); + auto rotMat = std::make_shared(3, 3); auto row0 = rotMat->at(0); row0->atiput(0, ctheddot); row0->atiput(1, -stheddot); @@ -332,27 +224,19 @@ namespace MbD { row2->atiput(2, 0.0); return rotMat; } - template - inline std::shared_ptr> FullMatrixTemplate::identitysptr(int n) - { - auto mat = std::make_shared>(n, n); - mat->identity(); - return mat; - } - inline std::shared_ptr FullMatrixDouble::identitysptr(int n) + std::shared_ptr FullMatrixDouble::identitysptr(int n) { auto mat = std::make_shared(n, n); mat->identity(); return mat; } - inline std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) + std::shared_ptr FullMatrixFullMatrixDouble::identitysptr(int n) { auto mat = std::make_shared(n, n); mat->identity(); return mat; } - template - inline std::shared_ptr> FullMatrixTemplate::tildeMatrix(FColDsptr col) + std::shared_ptr FullMatrixDouble::tildeMatrix(FColDsptr col) { //"tildeMatrix is skew symmetric matrix related to angular velocity and cross product." if (col->size() != 3) throw std::runtime_error("Column is not of dimension 3"); @@ -371,50 +255,47 @@ namespace MbD { tilde->atijput(2, 1, c0); return tilde; } - template<> - inline void FullMatrixTemplate::zeroSelf() + void FullMatrixDouble::zeroSelf() { for (int i = 0; i < this->size(); i++) { this->at(i)->zeroSelf(); } } - template - inline void FullMatrixTemplate::identity() { - assert(false); + void FullMatrixFullMatrixDouble::zeroSelf() + { + for (int i = 0; i < this->size(); i++) { + this->at(i)->zeroSelf(); + } } - inline void FullMatrixDouble::identity() { + void FullMatrixFullColumnDouble::zeroSelf() + { + for (int i = 0; i < this->size(); i++) { + this->at(i)->zeroSelf(); + } + } + void FullMatrixDouble::identity() { this->zeroSelf(); for (int i = 0; i < this->size(); i++) { this->at(i)->at(i) = 1.0; } } - inline void FullMatrixFullMatrixDouble::identity() { + void FullMatrixFullMatrixDouble::identity() { assert(false); // this->zeroSelf(); // for (int i = 0; i < this->size(); i++) { // this->at(i)->at(i) = 1.0; // } } - template - inline FColsptr FullMatrixTemplate::column(int j) { + // TODO: should there be a FullMatrixFullColumnDouble version of this? + FColsptr FullMatrixDouble::column(int j) { int n = (int)this->size(); - auto answer = std::make_shared>(n); + auto answer = std::make_shared>(n); for (int i = 0; i < n; i++) { answer->at(i) = this->at(i)->at(j); } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::timesFullMatrix(std::shared_ptr> fullMat) -// { -// int m = this->nrow(); -// auto answer = std::make_shared>(m); -// for (int i = 0; i < m; i++) { -// answer->at(i) = this->at(i)->timesFullMatrix(fullMat); -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::timesFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::timesFullMatrix(std::shared_ptr fullMat) { int m = this->nrow(); auto answer = std::make_shared(m); @@ -423,7 +304,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) { int nrow = this->nrow(); auto answer = std::make_shared(nrow); @@ -432,7 +313,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) { int nrow = this->nrow(); auto answer = std::make_shared(nrow); @@ -441,7 +322,7 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixDouble::times(double a) + std::shared_ptr FullMatrixDouble::times(double a) { int m = this->nrow(); auto answer = std::make_shared(m); @@ -451,11 +332,11 @@ namespace MbD { } return answer; } - inline std::shared_ptr FullMatrixFullMatrixDouble::times(double a) + std::shared_ptr FullMatrixFullMatrixDouble::times(double a) { assert(false); } - inline std::shared_ptr FullMatrixFullColumnDouble::times(double a) + std::shared_ptr FullMatrixFullColumnDouble::times(double a) { // int m = this->nrow(); // auto answer = std::make_shared(m); @@ -465,31 +346,11 @@ namespace MbD { // return answer; assert(false); } - template - inline std::shared_ptr> FullMatrixTemplate::times(T a) - { - assert(false); - } -// template -// inline std::shared_ptr> FullMatrixTemplate::transposeTimesFullMatrix(std::shared_ptr> fullMat) -// { -// return this->transpose()->timesFullMatrix(fullMat); -// } - inline std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) { return this->transpose()->timesFullMatrix(fullMat); } -// template -// inline std::shared_ptr> FullMatrixTemplate::plusFullMatrix(std::shared_ptr> fullMat) -// { -// int n = (int)this->size(); -// auto answer = std::make_shared>(n); -// for (int i = 0; i < n; i++) { -// answer->at(i) = this->at(i)->plusFullRow(fullMat->at(i)); -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::plusFullMatrix(std::shared_ptr fullMat) + std::shared_ptr FullMatrixDouble::plusFullMatrix(std::shared_ptr fullMat) { int n = (int)this->size(); auto answer = std::make_shared(n); @@ -498,31 +359,16 @@ namespace MbD { } return answer; } - template - inline std::shared_ptr> FullMatrixTemplate::minusFullMatrix(std::shared_ptr> fullMat) + std::shared_ptr FullMatrixDouble::minusFullMatrix(std::shared_ptr fullMat) { int n = (int)this->size(); - auto answer = std::make_shared>(n); + auto answer = std::make_shared(n); for (int i = 0; i < n; i++) { answer->at(i) = this->at(i)->minusFullRow(fullMat->at(i)); } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::transpose() -// { -// int nrow = this->nrow(); -// auto ncol = this->ncol(); -// auto answer = std::make_shared>(ncol, nrow); -// for (int i = 0; i < nrow; i++) { -// auto& row = this->at(i); -// for (int j = 0; j < ncol; j++) { -// answer->at(j)->at(i) = row->at(j); -// } -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::transpose() { + std::shared_ptr FullMatrixDouble::transpose() { int nrow = this->nrow(); auto ncol = this->ncol(); auto answer = std::make_shared(ncol, nrow); @@ -534,17 +380,11 @@ namespace MbD { } return answer; } -// template -// inline std::shared_ptr> FullMatrixTemplate::negated() -// { -// return this->times(-1.0); -// } - inline std::shared_ptr FullMatrixDouble::negated() + std::shared_ptr FullMatrixDouble::negated() { return this->times(-1.0); } - template - inline void FullMatrixTemplate::symLowerWithUpper() + void FullMatrixDouble::symLowerWithUpper() { int n = (int)this->size(); for (int i = 0; i < n; i++) { @@ -553,42 +393,45 @@ namespace MbD { } } } - template - inline void FullMatrixTemplate::atiput(int i, FRowsptr fullRow) + void FullMatrixFullColumnDouble::symLowerWithUpper() + { + int n = (int)this->size(); + for (int i = 0; i < n; i++) { + for (int j = i + 1; j < n; j++) { + this->at(j)->at(i) = this->at(i)->at(j); + } + } + } + void FullMatrixDouble::atiput(int i, FRowsptr fullRow) { this->at(i) = fullRow; } - template - inline void FullMatrixTemplate::atijput(int i, int j, T value) + void FullMatrixDouble::atijput(int i, int j, double value) { this->at(i)->atiput(j, value); } - template - inline void FullMatrixTemplate::atijputFullColumn(int i1, int j1, FColsptr fullCol) + void FullMatrixDouble::atijputFullColumn(int i1, int j1, FColsptr fullCol) { for (int ii = 0; ii < fullCol->size(); ii++) { this->at(i1 + ii)->at(j1) = fullCol->at(ii); } } - template - inline void FullMatrixTemplate::atijplusFullRow(int i, int j, FRowsptr fullRow) + void FullMatrixDouble::atijplusFullRow(int i, int j, FRowsptr fullRow) { this->at(i)->atiplusFullRow(j, fullRow); } - template - inline void FullMatrixTemplate::atijplusNumber(int i, int j, T value) + void FullMatrixDouble::atijplusNumber(int i, int j, double value) { auto rowi = this->at(i); rowi->at(j) += value; } - template - inline void FullMatrixTemplate::atijminusNumber(int i, int j, T value) + void FullMatrixDouble::atijminusNumber(int i, int j, double value) { auto rowi = this->at(i); rowi->at(j) -= value; } - inline double FullMatrixDouble::sumOfSquares() + double FullMatrixDouble::sumOfSquares() { double sum = 0.0; for (int i = 0; i < this->size(); i++) @@ -597,7 +440,7 @@ namespace MbD { } return sum; } - inline double FullMatrixFullMatrixDouble::sumOfSquares() + double FullMatrixFullMatrixDouble::sumOfSquares() { double sum = 0.0; for (int i = 0; i < this->size(); i++) @@ -606,30 +449,16 @@ namespace MbD { } return sum; } - - template - inline double FullMatrixTemplate::sumOfSquares() + double FullMatrixFullColumnDouble::sumOfSquares() { - assert(false); - return 0.0; + double sum = 0.0; + for (int i = 0; i < this->size(); i++) + { + sum += this->at(i)->sumOfSquares(); + } + return sum; } - template - inline void FullMatrixTemplate::zeroSelf() - { - assert(false); - } -// template -// inline std::shared_ptr> FullMatrixTemplate::copy() -// { -// auto m = (int)this->size(); -// auto answer = std::make_shared>(m); -// for (int i = 0; i < m; i++) -// { -// answer->at(i) = this->at(i)->copy(); -// } -// return answer; -// } - inline std::shared_ptr FullMatrixDouble::copy() + std::shared_ptr FullMatrixDouble::copy() { auto m = (int)this->size(); auto answer = std::make_shared(m); @@ -639,31 +468,27 @@ namespace MbD { } return answer; } - template - inline FullMatrixTemplate FullMatrixTemplate::operator+(const FullMatrixTemplate fullMat) + FullMatrixDouble FullMatrixDouble::operator+(const FullMatrixDouble fullMat) { int n = (int)this->size(); - auto answer = FullMatrixTemplate(n); + FullMatrixDouble answer(n); for (int i = 0; i < n; i++) { answer.at(i) = this->at(i)->plusFullRow(fullMat.at(i)); } return answer; } - template - inline FColsptr FullMatrixTemplate::transposeTimesFullColumn(FColsptr fullCol) + FColsptr FullMatrixDouble::transposeTimesFullColumn(FColsptr fullCol) { - auto sptr = std::make_shared>(*this); + auto sptr = std::make_shared(*this); return fullCol->transpose()->timesFullMatrix(sptr)->transpose(); } - template - inline void FullMatrixTemplate::magnifySelf(T factor) + void FullMatrixDouble::magnifySelf(double factor) { for (int i = 0; i < this->size(); i++) { this->at(i)->magnifySelf(factor); } } - template - inline std::ostream& FullMatrixTemplate::printOn(std::ostream& s) const + std::ostream& FullMatrixDouble::printOn(std::ostream& s) const { s << "FullMat[" << std::endl; for (int i = 0; i < this->size(); i++) @@ -673,16 +498,15 @@ namespace MbD { s << "]"; return s; } - template - inline std::shared_ptr> FullMatrixTemplate::asEulerParameters() + std::shared_ptr> FullMatrixDouble::asEulerParameters() { //"Given [A], compute Euler parameter." auto traceA = this->trace(); - T dum = 0.0; - T dumSq = 0.0; + double dum = 0.0; + double dumSq = 0.0; //auto qE = CREATE>::With(4); //Cannot use CREATE.h in subclasses of std::vector. Why? - auto qE = std::make_shared>(4); + auto qE = std::make_shared>(4); qE->initialize(); auto OneMinusTraceDivFour = (1.0 - traceA) / 4.0; for (int i = 0; i < 3; i++) @@ -694,7 +518,7 @@ namespace MbD { dumSq = (1.0 + traceA) / 4.0; dum = (dumSq > 0.0) ? std::sqrt(dumSq) : 0.0; qE->atiput(3, dum); - T max = 0.0; + double max = 0.0; int maxE = -1; for (int i = 0; i < 4; i++) { @@ -733,18 +557,16 @@ namespace MbD { qE->calc(); return qE; } - template - inline T FullMatrixTemplate::trace() + double FullMatrixDouble::trace() { - T trace = 0.0; + double trace = 0.0; for (int i = 0; i < this->size(); i++) { trace += this->at(i)->at(i); } return trace; } - template - inline double FullMatrixTemplate::maxMagnitude() + double FullMatrixDouble::maxMagnitude() { double max = 0.0; for (int i = 0; i < this->size(); i++) @@ -754,12 +576,31 @@ namespace MbD { } return max; } - template - inline FColsptr FullMatrixTemplate::bryantAngles() + double FullMatrixFullMatrixDouble::maxMagnitude() { - auto answer = std::make_shared>(3); + double max = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i)->maxMagnitude(); + if (max < element) max = element; + } + return max; + } + double FullMatrixFullColumnDouble::maxMagnitude() + { + double max = 0.0; + for (int i = 0; i < this->size(); i++) + { + double element = this->at(i)->maxMagnitude(); + if (max < element) max = element; + } + return max; + } + FColsptr FullMatrixDouble::bryantAngles() + { + auto answer = std::make_shared>(3); auto sthe1y = this->at(0)->at(2); - T the0x, the1y, the2z, cthe0x, sthe0x, y, x; + double the0x, the1y, the2z, cthe0x, sthe0x, y, x; if (std::abs(sthe1y) > 0.9999) { if (sthe1y > 0.0) { the0x = std::atan2(this->at(1)->at(0), this->at(1)->at(1)); @@ -791,8 +632,7 @@ namespace MbD { answer->atiput(2, the2z); return answer; } - template - inline bool FullMatrixTemplate::isDiagonal() + bool FullMatrixDouble::isDiagonal() { auto m = this->nrow(); auto n = this->ncol(); @@ -807,8 +647,7 @@ namespace MbD { } return true; } - template - inline bool FullMatrixTemplate::isDiagonalToWithin(double ratio) + bool FullMatrixDouble::isDiagonalToWithin(double ratio) { double maxMag = this->maxMagnitude(); auto tol = ratio * maxMag; @@ -828,39 +667,20 @@ namespace MbD { return false; } } - template - inline std::shared_ptr> FullMatrixTemplate::asDiagonalMatrix() + std::shared_ptr> FullMatrixDouble::asDiagonalMatrix() { int nrow = this->nrow(); - auto diagMat = std::make_shared>(nrow); + auto diagMat = std::make_shared>(nrow); for (int i = 0; i < nrow; i++) { diagMat->atiput(i, this->at(i)->at(i)); } return diagMat; } - template - inline void FullMatrixTemplate::conditionSelfWithTol(double tol) + void FullMatrixDouble::conditionSelfWithTol(double tol) { for (auto row : *this) { row->conditionSelfWithTol(tol); } } - template - inline FColsptr FullMatrixTemplate::timesFullColumn(FColsptr fullCol) - { - return this->timesFullColumn(fullCol.get()); - } - template - inline FColsptr FullMatrixTemplate::timesFullColumn(FullColumn* fullCol) - { - //"a*b = a(i,j)b(j) sum j." - auto nrow = this->nrow(); - auto answer = std::make_shared>(nrow); - for (int i = 0; i < nrow; i++) - { - answer->at(i) = this->at(i)->timesFullColumn(fullCol); - } - return answer; - } } diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 28a8eba..d0d53d1 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -17,103 +17,46 @@ #include "DiagonalMatrix.ref.h" #include "EulerParameters.ref.h" #include "RowTypeMatrix.h" -#include "FullRow.h" // exception to normal include pattern +#include "FullRow.h" // now that refs are resolved, go do the full systems +//#include "FullColumn.h" +//#include "DiagonalMatrix.h" +//#include "EulerParameters.h" namespace MbD { - template - class FullMatrixTemplate : public RowTypeMatrix> - { - public: - FullMatrixTemplate() = default; - explicit FullMatrixTemplate(int m) : RowTypeMatrix>(m) - { - } - FullMatrixTemplate(int m, int n) { - for (int i = 0; i < m; i++) { - auto row = std::make_shared>(n); - this->push_back(row); - } - } - FullMatrixTemplate(std::initializer_list> listOfRows) { - for (auto& row : listOfRows) - { - this->push_back(row); - } - } - FullMatrixTemplate(std::initializer_list> list2D) { - for (auto& rowList : list2D) - { - auto row = std::make_shared>(rowList); - this->push_back(row); - } - } -// static std::shared_ptr> rotatex(T angle); -// static std::shared_ptr> rotatey(T angle); -// static std::shared_ptr> rotatez(T angle); -// static std::shared_ptr> rotatexrotDot(T angle, T angledot); -// static std::shared_ptr> rotateyrotDot(T angle, T angledot); -// static std::shared_ptr> rotatezrotDot(T angle, T angledot); - static std::shared_ptr> rotatexrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> rotateyrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> rotatezrotDotrotDDot(T angle, T angleDot, T angleDDot); - static std::shared_ptr> identitysptr(int n); - static std::shared_ptr> tildeMatrix(FColDsptr col); - - virtual void identity(); - FColsptr column(int j); - FColsptr timesFullColumn(FColsptr fullCol); - FColsptr timesFullColumn(FullColumn* fullCol); - // std::shared_ptr> timesFullMatrix(std::shared_ptr> fullMat); - - virtual std::shared_ptr> timesTransposeFullMatrix(std::shared_ptr> fullMat); - - std::shared_ptr> times(T a); - // std::shared_ptr> transposeTimesFullMatrix(std::shared_ptr> fullMat); - // std::shared_ptr> plusFullMatrix(std::shared_ptr> fullMat); - std::shared_ptr> minusFullMatrix(std::shared_ptr> fullMat); - // std::shared_ptr> transpose(); -// std::shared_ptr> negated(); - void symLowerWithUpper(); - void atiput(int i, FRowsptr fullRow) override; - void atijput(int i, int j, T value); - void atijputFullColumn(int i, int j, FColsptr fullCol); - void atijplusFullRow(int i, int j, FRowsptr fullRow); - void atijplusNumber(int i, int j, T value); - void atijminusNumber(int i, int j, T value); - double sumOfSquares() override; - void zeroSelf() override; -// std::shared_ptr> copy(); - FullMatrixTemplate operator+(const FullMatrixTemplate fullMat); - FColsptr transposeTimesFullColumn(const FColsptr fullCol); - void magnifySelf(T factor); - std::shared_ptr> asEulerParameters(); - T trace(); - double maxMagnitude() override; - FColsptr bryantAngles(); - bool isDiagonal(); - bool isDiagonalToWithin(double ratio); - std::shared_ptr> asDiagonalMatrix(); - void conditionSelfWithTol(double tol); - - std::ostream& printOn(std::ostream& s) const override; - }; - // - // FULL MATRIX DOUBLE instantiation + // FULL MATRIX DOUBLE // - class FullMatrixDouble : public FullMatrixTemplate { + class FullMatrixDouble : public RowTypeMatrix> { public: - FullMatrixDouble() : FullMatrixTemplate() {}; - explicit FullMatrixDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; - FullMatrixDouble(std::initializer_list> list2D) : FullMatrixTemplate(list2D) {} - FullMatrixDouble(std::initializer_list> listOfRows) : FullMatrixTemplate(listOfRows) {}; + FullMatrixDouble() = default; + explicit FullMatrixDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } + FullMatrixDouble(std::initializer_list> listOfRows) { + for (auto& row : listOfRows) + { + this->push_back(row); + } + } + FullMatrixDouble(std::initializer_list> list2D) { + for (auto& rowList : list2D) + { + auto row = std::make_shared>(rowList); + this->push_back(row); + } + } std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); - void identity() override; + void identity(); static std::shared_ptr identitysptr(int n); - double sumOfSquares(); + double sumOfSquares() override; std::shared_ptr transposeTimesFullMatrix(std::shared_ptr fullMat); std::shared_ptr timesFullMatrix(std::shared_ptr fullMat); std::shared_ptr transpose(); @@ -125,37 +68,82 @@ namespace MbD { static std::shared_ptr rotatexrotDot(double angle, double angledot); static std::shared_ptr rotateyrotDot(double angle, double angledot); static std::shared_ptr rotatezrotDot(double angle, double angledot); - std::shared_ptr copy(); + static std::shared_ptr rotatexrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr rotateyrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr rotatezrotDotrotDDot(double angle, double angleDot, double angleDDot); + static std::shared_ptr tildeMatrix(FColDsptr col); + void zeroSelf() override; + FColsptr column(int j); + + void atiput(int i, FRowsptr fullRow); + void atijput(int i, int j, double value); + std::shared_ptr copy(); + double maxMagnitude() override; + FullMatrixDouble operator+(const FullMatrixDouble fullMat); + std::shared_ptr minusFullMatrix(std::shared_ptr fullMat); + FColsptr transposeTimesFullColumn(FColsptr fullCol); + void symLowerWithUpper(); + void atijputFullColumn(int i1, int j1, FColsptr fullCol); + void atijplusFullRow(int i, int j, FRowsptr fullRow); + void atijplusNumber(int i, int j, double value); + void atijminusNumber(int i, int j, double value); + void magnifySelf(double factor); + std::shared_ptr> asEulerParameters(); + FColsptr bryantAngles(); + double trace(); + bool isDiagonal(); + bool isDiagonalToWithin(double ratio); + std::shared_ptr> asDiagonalMatrix(); + void conditionSelfWithTol(double tol); + std::ostream& printOn(std::ostream& s) const override; + FColsptr timesFullColumn(FColsptr fullCol); + // FColsptr timesFullColumn(FullColumn* fullCol); }; // - // FULL MATRIX FULL MATRIX DOUBLE instantiation + // FULL MATRIX FULL MATRIX DOUBLE // - class FullMatrixFullMatrixDouble : public FullMatrixTemplate { + class FullMatrixFullMatrixDouble : public RowTypeMatrix> { public: - FullMatrixFullMatrixDouble() : FullMatrixTemplate() {}; - explicit FullMatrixFullMatrixDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixFullMatrixDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + FullMatrixFullMatrixDouble() = default; + explicit FullMatrixFullMatrixDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixFullMatrixDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } + double maxMagnitude() override; + void zeroSelf() override; std::shared_ptr times(double a); std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; - void identity() override; + void identity(); static std::shared_ptr identitysptr(int n); }; // - // FULL MATRIX FULL COLUMN DOUBLE instantiation + // FULL MATRIX FULL COLUMN DOUBLE // - class FullMatrixFullColumnDouble : public FullMatrixTemplate { + class FullMatrixFullColumnDouble : public RowTypeMatrix> { public: - FullMatrixFullColumnDouble() : FullMatrixTemplate() {}; - explicit FullMatrixFullColumnDouble(int m) : FullMatrixTemplate(m) {}; - FullMatrixFullColumnDouble(int m, int n) : FullMatrixTemplate(m, n) {}; + FullMatrixFullColumnDouble() = default; + explicit FullMatrixFullColumnDouble(int m) : RowTypeMatrix>(m) + { + } + FullMatrixFullColumnDouble(int m, int n) { + for (int i = 0; i < m; i++) { + auto row = std::make_shared>(n); + this->push_back(row); + } + } - std::shared_ptr times(double a); - std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + double maxMagnitude() override; + void zeroSelf() override; double sumOfSquares() override; - void identity() override; - static std::shared_ptr identitysptr(int n); + void symLowerWithUpper(); + std::shared_ptr times(double a); }; } diff --git a/OndselSolver/FullMatrix.ref.h b/OndselSolver/FullMatrix.ref.h index db820ec..a5c0f9e 100644 --- a/OndselSolver/FullMatrix.ref.h +++ b/OndselSolver/FullMatrix.ref.h @@ -1,6 +1,7 @@ #pragma once #include "FullColumn.ref.h" +#include namespace MbD { class FullMatrixDouble; diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index 6648076..2c3d2a9 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -7,65 +7,64 @@ ***************************************************************************/ #include "FullRow.h" -#include "FullMatrix.h" -using namespace MbD; - -template -std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) -{ - //"a*b = a(i)b(j)" - auto nrow = (int)this->size(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) +namespace MbD { + template + std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) { - answer->atiput(i, fullRow->times(this->at(i))); + //"a*b = a(i)b(j)" + auto nrow = (int)this->size(); + auto answer = std::make_shared(nrow); + for (int i = 0; i < nrow; i++) + { + answer->atiput(i, fullRow->times(this->at(i))); + } + return answer; } - return answer; -} -template -inline FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) -{ - //"a*bT = a(1,j)b(k,j)" - int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); - for (int k = 0; k < ncol; k++) { - answer->at(k) = this->dot(fullMat->at(k)); - } - return answer; -} - -template -inline FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat) -{ - //"a*bT = a(1,j)b(k,j)" - int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); - for (int k = 0; k < ncol; k++) { - answer->at(k) = this->dot(fullMat->at(k)); - } - return answer; -} - -template -inline FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) -{ - FRowsptr answer = fullMat->at(0)->times(this->at(0)); - for (int j = 1; j < (int) this->size(); j++) + template + FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) { - answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); + //"a*bT = a(1,j)b(k,j)" + int ncol = fullMat->nrow(); + auto answer = std::make_shared>(ncol); + for (int k = 0; k < ncol; k++) { + answer->at(k) = this->dot(fullMat->at(k)); + } + return answer; } - return answer; -} -template -inline FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) -{ - FRowsptr answer = fullMat->at(0)->times(this->at(0)); - for (int j = 1; j < (int) this->size(); j++) + template + FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat) { - answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); + //"a*bT = a(1,j)b(k,j)" + int ncol = fullMat->nrow(); + auto answer = std::make_shared>(ncol); + for (int k = 0; k < ncol; k++) { + answer->at(k) = this->dot(fullMat->at(k)); + } + return answer; + } + + template + FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) + { + FRowsptr answer = fullMat->at(0)->times(this->at(0)); + for (int j = 1; j < (int) this->size(); j++) + { + answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); + } + return answer; + } + + template + FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) + { + FRowsptr answer = fullMat->at(0)->times(this->at(0)); + for (int j = 1; j < (int) this->size(); j++) + { + answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); + } + return answer; } - return answer; } diff --git a/OndselSolver/Item.h b/OndselSolver/Item.h index dd1a6c1..57ea6f4 100644 --- a/OndselSolver/Item.h +++ b/OndselSolver/Item.h @@ -10,9 +10,13 @@ #include #include - +#include "FullColumn.ref.h" +#include "FullRow.ref.h" +#include "DiagonalMatrix.ref.h" +#include "FullMatrix.ref.h" #include "FullColumn.h" -// #include "FullMatrix.h" +#include "FullRow.h" +#include "FullMatrix.h" #include "DiagonalMatrix.h" #include "SparseMatrix.h" #include "enum.h" diff --git a/OndselSolver/MBDynItem.cpp b/OndselSolver/MBDynItem.cpp index 31a328d..aae8444 100644 --- a/OndselSolver/MBDynItem.cpp +++ b/OndselSolver/MBDynItem.cpp @@ -164,7 +164,7 @@ FMatDsptr MbD::MBDynItem::readOrientation(std::vector& args) auto ref = mbdynReferences()->at(refName); auto aAFf = readBasicOrientation(args); auto aAOF = ref->aAOf; - aAOf = toFMDsptr(aAOF->timesFullMatrix(aAFf)); + aAOf = aAOF->timesFullMatrix(aAFf); } else if (str.find("hinge") != std::string::npos) { args.erase(args.begin()); diff --git a/OndselSolver/MBDynMarker.cpp b/OndselSolver/MBDynMarker.cpp index 9c789a3..37fd175 100644 --- a/OndselSolver/MBDynMarker.cpp +++ b/OndselSolver/MBDynMarker.cpp @@ -21,7 +21,7 @@ void MbD::MBDynMarker::parseMBDyn(std::vector& args) auto rOmO = readPosition(args); auto aAOm = readOrientation(args); rPmP = aAOP->transposeTimesFullColumn(rOmO->minusFullColumn(rOPO)); - aAPm = toFMDsptr(aAOP->transposeTimesFullMatrix(aAOm)); + aAPm = aAOP->transposeTimesFullMatrix(aAOm); } else if (str.find("offset") != std::string::npos) { rPmP = readPosition(args); diff --git a/OndselSolver/MarkerFrame.cpp b/OndselSolver/MarkerFrame.cpp index 81c115e..72075d0 100644 --- a/OndselSolver/MarkerFrame.cpp +++ b/OndselSolver/MarkerFrame.cpp @@ -70,13 +70,13 @@ void MarkerFrame::calcPostDynCorrectorIteration() auto rOpO = partFrame->rOpO(); auto aAOp = partFrame->aAOp(); rOmO = rOpO->plusFullColumn(aAOp->timesFullColumn(rpmp)); - aAOm = toFMDsptr(aAOp->timesFullMatrix(aApm)); + aAOm = aAOp->timesFullMatrix(aApm); auto pAOppE = partFrame->pAOppE(); for (int i = 0; i < 4; i++) { auto& pAOppEi = pAOppE->at(i); prOmOpE->atijputFullColumn(0, i, pAOppEi->timesFullColumn(rpmp)); - pAOmpE->at(i) = toFMDsptr(pAOppEi->timesFullMatrix(aApm)); + pAOmpE->at(i) = pAOppEi->timesFullMatrix(aApm); } } diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index a5acf7a..56401e2 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -188,7 +188,7 @@ void MbD::MomentOfInertiaSolver::calcJoo() auto term22 = rPoPtilde->timesFullMatrix(rocmPtilde); auto term23 = term22->transpose(); auto term2 = term21->plusFullMatrix(term22)->plusFullMatrix(term23)->times(m); - aJoo = toFMDsptr(aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo)); + aJoo = aAPo->transposeTimesFullMatrix(term1->plusFullMatrix(term2))->timesFullMatrix(aAPo); aJoo->symLowerWithUpper(); aJoo->conditionSelfWithTol(aJoo->maxMagnitude() * 1.0e-6); } @@ -198,7 +198,7 @@ void MbD::MomentOfInertiaSolver::calcJpp() //"aJcmP = aJPP + mass*(rPcmPTilde*rPcmPTilde)" auto rPcmPtilde = FullMatrixDouble::tildeMatrix(rPcmP); - aJcmP = toFMDsptr(aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m))); + aJcmP = aJPP->plusFullMatrix(rPcmPtilde->timesFullMatrix(rPcmPtilde)->times(m)); aJcmP->symLowerWithUpper(); aJcmP->conditionSelfWithTol(aJcmP->maxMagnitude() * 1.0e-6); if (aJcmP->isDiagonal()) { @@ -249,7 +249,7 @@ FColDsptr MbD::MomentOfInertiaSolver::eigenvectorFor(double lam) //"[aJcmP] - lam[I]." double e0, e1, e2; - aJcmPcopy = toFMDsptr(aJcmP->copy()); + aJcmPcopy = aJcmP->copy(); colOrder = std::make_shared>(3); auto eigenvector = std::make_shared>(3); for (int i = 0; i < 3; i++) diff --git a/OndselSolver/Part.cpp b/OndselSolver/Part.cpp index 44e1ad0..701874c 100644 --- a/OndselSolver/Part.cpp +++ b/OndselSolver/Part.cpp @@ -462,7 +462,7 @@ void Part::calcmEdot() auto a4J = aJ->times(4.0); auto term1 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(aCdot)); auto term2 = term1->transpose(); - mEdot = toFMDsptr(term1->plusFullMatrix(term2)); + mEdot = term1->plusFullMatrix(term2); } void Part::calcpTpE() @@ -479,7 +479,7 @@ void Part::calcppTpEpE() auto& qEdot = partFrame->qEdot; auto pCpEtimesqEdot = EulerParameters::pCpEtimesColumn(qEdot); auto a4J = aJ->times(4.0); - ppTpEpE = toFMDsptr(pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot))); + ppTpEpE = pCpEtimesqEdot->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot)); } void Part::calcppTpEpEdot() @@ -491,13 +491,13 @@ void Part::calcppTpEpEdot() auto term1 = EulerParameters::pCTpEtimesColumn(a4J->timesFullColumn(aC->timesFullColumn(qEdot))); auto pCpEtimesqEdot = EulerParameters::pCpEtimesColumn(qEdot); auto term2 = aC->transposeTimesFullMatrix(a4J->timesFullMatrix(pCpEtimesqEdot)); - ppTpEpEdot = toFMDsptr(term1->plusFullMatrix(term2)->transpose()); + ppTpEpEdot = term1->plusFullMatrix(term2)->transpose(); } void Part::calcmE() { auto aC = partFrame->aC(); - mE = toFMDsptr(aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0)); + mE = aC->transposeTimesFullMatrix(aJ->timesFullMatrix(aC))->times(4.0); } void Part::fillAccICIterError(FColDsptr col) diff --git a/OndselSolver/RackPinConstraintIqcJc.cpp b/OndselSolver/RackPinConstraintIqcJc.cpp index 3b4cebc..06bc5f7 100644 --- a/OndselSolver/RackPinConstraintIqcJc.cpp +++ b/OndselSolver/RackPinConstraintIqcJc.cpp @@ -53,14 +53,14 @@ void MbD::RackPinConstraintIqcJc::calc_pGpXI() void MbD::RackPinConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = toFMDsptr(xIeJeIe->ppvaluepEIpEI() - ->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius))); + ppGpEIpEI = xIeJeIe->ppvaluepEIpEI() + ->plusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitchRadius)); } void MbD::RackPinConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = toFMDsptr(xIeJeIe->ppvaluepXIpEI() - ->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius))); + ppGpXIpEI = xIeJeIe->ppvaluepXIpEI() + ->plusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitchRadius)); } void MbD::RackPinConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/RackPinConstraintIqcJqc.cpp b/OndselSolver/RackPinConstraintIqcJqc.cpp index 144b81b..529855c 100644 --- a/OndselSolver/RackPinConstraintIqcJqc.cpp +++ b/OndselSolver/RackPinConstraintIqcJqc.cpp @@ -30,20 +30,20 @@ void MbD::RackPinConstraintIqcJqc::calc_pGpXJ() void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = toFMDsptr(xIeJeIe->ppvaluepEIpEJ() - ->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius))); + ppGpEIpEJ = xIeJeIe->ppvaluepEIpEJ() + ->plusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitchRadius)); } void MbD::RackPinConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = toFMDsptr(xIeJeIe->ppvaluepEIpXJ() - ->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius))); + ppGpEIpXJ = xIeJeIe->ppvaluepEIpXJ() + ->plusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitchRadius)); } void MbD::RackPinConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = toFMDsptr(xIeJeIe->ppvaluepEJpEJ() - ->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius))); + ppGpEJpEJ = xIeJeIe->ppvaluepEJpEJ() + ->plusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitchRadius)); } void MbD::RackPinConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/ScrewConstraintIqcJc.cpp b/OndselSolver/ScrewConstraintIqcJc.cpp index 9249c97..7cb3a1d 100644 --- a/OndselSolver/ScrewConstraintIqcJc.cpp +++ b/OndselSolver/ScrewConstraintIqcJc.cpp @@ -55,14 +55,14 @@ void MbD::ScrewConstraintIqcJc::calc_pGpXI() void MbD::ScrewConstraintIqcJc::calc_ppGpEIpEI() { - ppGpEIpEI = toFMDsptr(zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI) - ->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch))); + ppGpEIpEI = zIeJeIe->ppvaluepEIpEI()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpEI()->times(pitch)); } void MbD::ScrewConstraintIqcJc::calc_ppGpXIpEI() { - ppGpXIpEI = toFMDsptr(zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI) - ->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch))); + ppGpXIpEI = zIeJeIe->ppvaluepXIpEI()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepXIpEI()->times(pitch)); } void MbD::ScrewConstraintIqcJc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/ScrewConstraintIqcJqc.cpp b/OndselSolver/ScrewConstraintIqcJqc.cpp index 18c9ce2..c56c15d 100644 --- a/OndselSolver/ScrewConstraintIqcJqc.cpp +++ b/OndselSolver/ScrewConstraintIqcJqc.cpp @@ -32,20 +32,20 @@ void MbD::ScrewConstraintIqcJqc::calc_pGpXJ() void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpEJ() { - ppGpEIpEJ = toFMDsptr(zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI) - ->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch))); + ppGpEIpEJ = zIeJeIe->ppvaluepEIpEJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpEJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEIpXJ() { - ppGpEIpXJ = toFMDsptr(zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI) - ->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch))); + ppGpEIpXJ = zIeJeIe->ppvaluepEIpXJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEIpXJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calc_ppGpEJpEJ() { - ppGpEJpEJ = toFMDsptr(zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI) - ->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch))); + ppGpEJpEJ = zIeJeIe->ppvaluepEJpEJ()->times(2.0 * M_PI) + ->minusFullMatrix(thezIeJe->ppvaluepEJpEJ()->times(pitch)); } void MbD::ScrewConstraintIqcJqc::calcPostDynCorrectorIteration() diff --git a/OndselSolver/TranslationConstraintIqcJc.cpp b/OndselSolver/TranslationConstraintIqcJc.cpp index db2ce00..429655c 100644 --- a/OndselSolver/TranslationConstraintIqcJc.cpp +++ b/OndselSolver/TranslationConstraintIqcJc.cpp @@ -30,10 +30,10 @@ void TranslationConstraintIqcJc::calcPostDynCorrectorIteration() pGpXI = riIeqJeIeq->pvaluepXI(); pGpEI = (riIeqJeIeq->pvaluepEI())->plusFullRow(riIeqJeIeq->pvaluepEK()); ppGpXIpEI = riIeqJeIeq->ppvaluepXIpEK(); - ppGpEIpEI = toFMDsptr(riIeqJeIeq->ppvaluepEIpEI() + ppGpEIpEI = riIeqJeIeq->ppvaluepEIpEI() ->plusFullMatrix(riIeqJeIeq->ppvaluepEIpEK()) ->plusFullMatrix((riIeqJeIeq->ppvaluepEIpEK()-> - transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK())))); + transpose()->plusFullMatrix(riIeqJeIeq->ppvaluepEKpEK()))); } void TranslationConstraintIqcJc::useEquationNumbers() diff --git a/OndselSolver/TranslationConstraintIqcJqc.cpp b/OndselSolver/TranslationConstraintIqcJqc.cpp index 02377a4..5659e02 100644 --- a/OndselSolver/TranslationConstraintIqcJqc.cpp +++ b/OndselSolver/TranslationConstraintIqcJqc.cpp @@ -28,8 +28,8 @@ void TranslationConstraintIqcJqc::calcPostDynCorrectorIteration() TranslationConstraintIqcJc::calcPostDynCorrectorIteration(); pGpXJ = riIeJeIe->pvaluepXJ(); pGpEJ = riIeJeIe->pvaluepEJ(); - ppGpEIpXJ = toFMDsptr(riIeJeIe->ppvaluepXJpEK()->transpose()); - ppGpEIpEJ = toFMDsptr(riIeJeIe->ppvaluepEJpEK()->transpose()); + ppGpEIpXJ = riIeJeIe->ppvaluepXJpEK()->transpose(); + ppGpEIpEJ = riIeJeIe->ppvaluepEJpEK()->transpose(); ppGpEJpEJ = riIeJeIe->ppvaluepEJpEJ(); } From 796147aeda7b780afdfa309c557e29d7db9cb486 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 01:33:49 -0500 Subject: [PATCH 05/17] more instantiations --- OndselSolver/DiagonalMatrix.h | 3 ++- OndselSolver/EulerAngles.h | 1 + OndselSolver/EulerParameters.h | 2 +- OndselSolver/FullColumn.h | 6 +++++- OndselSolver/FullRow.h | 3 ++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index ac73c50..4cb9eef 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -13,7 +13,7 @@ #include "FullMatrix.ref.h" #include "DiagonalMatrix.ref.h" #include "Array.h" -//#include "FullColumn.h" +#include "FullColumn.h" //#include "FullRow.h" // #include "FullMatrix.h" @@ -45,5 +45,6 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; + template class DiagonalMatrix; } diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index ef3a678..d45c25d 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -35,5 +35,6 @@ namespace MbD { FMatDsptr aA; }; + template class EulerAngles>; } diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 2d93041..40bda2a 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -42,7 +42,6 @@ namespace MbD { this->initialize(); this->calc(); } - static std::shared_ptr ppApEpEtimesColumn(FColDsptr col); static FMatDsptr pCpEtimesColumn(FColDsptr col); static FMatDsptr pCTpEtimesColumn(FColDsptr col); @@ -60,4 +59,5 @@ namespace MbD { FMatDsptr aC; FColFMatDsptr pApE; }; + template class EulerParameters; } diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 9088a97..37e3d49 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -48,6 +48,10 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - template class FullVector; + // instantiate on purpose: + template class FullColumn; + template class FullColumn; +// template class FullColumn>; +// template class FullColumn>; } diff --git a/OndselSolver/FullRow.h b/OndselSolver/FullRow.h index 75d1935..0ca02f4 100644 --- a/OndselSolver/FullRow.h +++ b/OndselSolver/FullRow.h @@ -147,6 +147,7 @@ namespace MbD { } s << "}"; return s; - } + }; + // TODO: template class FullRow; } From f67e605f0d3d3ed1acc9f0cbf501a90ac48e898d Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 16:45:35 -0600 Subject: [PATCH 06/17] builds and links! --- OndselSolver/FullColumn.cpp | 12 --------- OndselSolver/FullColumn.h | 18 +++++++++++--- OndselSolver/FullMatrix.cpp | 18 +++++++------- OndselSolver/FullMatrix.h | 2 +- OndselSolver/FullRow.cpp | 49 ++++++++++++++++--------------------- OndselSolver/FullRow.h | 11 +++------ OndselSolver/SparseMatrix.h | 1 + 7 files changed, 51 insertions(+), 60 deletions(-) diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index 75af3f7..9dab0db 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -164,16 +164,4 @@ namespace MbD { assert(false); return FColsptr(); } - template - std::ostream& FullColumn::printOn(std::ostream& s) const - { - s << "FullCol{"; - s << this->at(0); - for (int i = 1; i < this->size(); i++) - { - s << ", " << this->at(i); - } - s << "}"; - return s; - } } \ No newline at end of file diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 37e3d49..9bd13c4 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -15,6 +15,7 @@ #include "FullColumn.ref.h" #include "FullRow.ref.h" #include "FullMatrix.ref.h" +//#include "Symbolic.h" namespace MbD { class Symbolic; @@ -48,10 +49,21 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - // instantiate on purpose: + // the following "printOn" needs to be in the header for unknown reasons linker + template + std::ostream& FullColumn::printOn(std::ostream& s) const + { + s << "FullCol{"; + s << this->at(0); + for (int i = 1; i < this->size(); i++) + { + s << ", " << this->at(i); + } + s << "}"; + return s; + } + // instantiate on purpose to make visible in library api: template class FullColumn; template class FullColumn; -// template class FullColumn>; -// template class FullColumn>; } diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 6087540..1a12d03 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -313,15 +313,15 @@ namespace MbD { } return answer; } - std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) - { - int nrow = this->nrow(); - auto answer = std::make_shared(nrow); - for (int i = 0; i < nrow; i++) { - answer->at(i) = this->at(i)->timesTransposeFullMatrixForFMFMDsptr(fullMat); - } - return answer; - } +// std::shared_ptr FullMatrixFullMatrixDouble::timesTransposeFullMatrix(std::shared_ptr fullMat) +// { +// int nrow = this->nrow(); +// auto answer = std::make_shared(nrow); +// for (int i = 0; i < nrow; i++) { +// answer->at(i) = this->at(i)->timesTransposeFullMatrixForFMFMDsptr(fullMat); +// } +// return answer; +// } std::shared_ptr FullMatrixDouble::times(double a) { int m = this->nrow(); diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index d0d53d1..2648732 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -119,7 +119,7 @@ namespace MbD { double maxMagnitude() override; void zeroSelf() override; std::shared_ptr times(double a); - std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); + // std::shared_ptr timesTransposeFullMatrix(std::shared_ptr fullMat); double sumOfSquares() override; void identity(); static std::shared_ptr identitysptr(int n); diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index 2c3d2a9..2716599 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -7,6 +7,7 @@ ***************************************************************************/ #include "FullRow.h" +#include "FullMatrix.h" namespace MbD { template @@ -22,45 +23,37 @@ namespace MbD { return answer; } - template - FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) + template<> + FRowsptr FullRow::timesTransposeFullMatrix(std::shared_ptr fullMat) { //"a*bT = a(1,j)b(k,j)" int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); + auto answer = std::make_shared>(ncol); for (int k = 0; k < ncol; k++) { answer->at(k) = this->dot(fullMat->at(k)); } return answer; } - template - FRowsptr FullRow::timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat) - { - //"a*bT = a(1,j)b(k,j)" - int ncol = fullMat->nrow(); - auto answer = std::make_shared>(ncol); - for (int k = 0; k < ncol; k++) { - answer->at(k) = this->dot(fullMat->at(k)); - } - return answer; - } +// TODO: can't get the following to work, but CLion says the routine that calls it in FullMatrixFullMatrixDouble is also +// never called. +// template<> +// FRowsptr> FullRow>::timesTransposeFullMatrixForFMFMDsptr( +// std::shared_ptr fullMat) +// { +// //"a*bT = a(1,j)b(k,j)" +// int ncol = fullMat->nrow(); +// auto answer = std::make_shared>>(ncol); +// for (int k = 0; k < ncol; k++) { +// answer->at(k) = this->dot(fullMat->at(k)); +// } +// return answer; +// } - template - FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) + template<> + FRowsptr FullRow::timesFullMatrix(std::shared_ptr fullMat) { - FRowsptr answer = fullMat->at(0)->times(this->at(0)); - for (int j = 1; j < (int) this->size(); j++) - { - answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); - } - return answer; - } - - template - FRowsptr FullRow::timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat) - { - FRowsptr answer = fullMat->at(0)->times(this->at(0)); + FRowsptr answer = fullMat->at(0)->times(this->at(0)); for (int j = 1; j < (int) this->size(); j++) { answer->equalSelfPlusFullRowTimes(fullMat->at(j), this->at(j)); diff --git a/OndselSolver/FullRow.h b/OndselSolver/FullRow.h index 0ca02f4..8d9ecca 100644 --- a/OndselSolver/FullRow.h +++ b/OndselSolver/FullRow.h @@ -37,13 +37,10 @@ namespace MbD { void atiplusFullRow(int j, FRowsptr fullRow); std::ostream& printOn(std::ostream& s) const override; - FRowsptr timesFullMatrix(std::shared_ptr fullMat); - FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); - - FRowsptr timesFullMatrixForFMFMDsptr(std::shared_ptr fullMat); - FRowsptr timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat); - // std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); + FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); + // FRowsptr> timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat); + FRowsptr timesFullMatrix(std::shared_ptr fullMat); }; template<> @@ -148,6 +145,6 @@ namespace MbD { s << "}"; return s; }; - // TODO: template class FullRow; + } diff --git a/OndselSolver/SparseMatrix.h b/OndselSolver/SparseMatrix.h index eea8d69..f07232f 100644 --- a/OndselSolver/SparseMatrix.h +++ b/OndselSolver/SparseMatrix.h @@ -13,6 +13,7 @@ #include "RowTypeMatrix.h" #include "SparseRow.h" #include "DiagonalMatrix.h" +#include "FullMatrix.h" namespace MbD { template From 997ecc0b2a1e79b8d365ef588c610b0cfb2b6110 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 17:47:33 -0600 Subject: [PATCH 07/17] Moved instantiations around. Removed a few warning. --- OndselSolver/DiagonalMatrix.cpp | 1 - OndselSolver/DiagonalMatrix.h | 2 +- OndselSolver/EulerAngles.cpp | 1 + OndselSolver/EulerAngles.h | 1 - OndselSolver/EulerParameters.cpp | 573 ++++++++++++++++--------------- OndselSolver/EulerParameters.h | 1 + OndselSolver/FullColumn.cpp | 6 +- OndselSolver/FullColumn.h | 6 +- OndselSolver/FullMatrix.h | 2 +- OndselSolver/FullVector.h | 12 +- 10 files changed, 303 insertions(+), 302 deletions(-) diff --git a/OndselSolver/DiagonalMatrix.cpp b/OndselSolver/DiagonalMatrix.cpp index b5b60da..e561c87 100644 --- a/OndselSolver/DiagonalMatrix.cpp +++ b/OndselSolver/DiagonalMatrix.cpp @@ -113,5 +113,4 @@ namespace MbD { s << "]"; return s; } - } diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index 4cb9eef..4abae1b 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -43,8 +43,8 @@ namespace MbD { double maxMagnitude() override; std::ostream& printOn(std::ostream& s) const override; - }; + template class DiagonalMatrix; } diff --git a/OndselSolver/EulerAngles.cpp b/OndselSolver/EulerAngles.cpp index d243282..00dd6ee 100644 --- a/OndselSolver/EulerAngles.cpp +++ b/OndselSolver/EulerAngles.cpp @@ -83,5 +83,6 @@ namespace MbD { rotOrder->at(1) = j; rotOrder->at(2) = k; } + template class EulerAngles>; } diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index d45c25d..ef3a678 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -35,6 +35,5 @@ namespace MbD { FMatDsptr aA; }; - template class EulerAngles>; } diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index 009e928..b26cd71 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -11,170 +11,170 @@ #include "FullRow.h" #include "FullMatrix.h" -using namespace MbD; -template<> -inline FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) -{ - double a2c0 = 2 * col->at(0); - double a2c1 = 2 * col->at(1); - double a2c2 = 2 * col->at(2); - double m2c0 = 0 - a2c0; - double m2c1 = 0 - a2c1; - double m2c2 = 0 - a2c2; - auto col00 = std::make_shared>(ListD{ a2c0, m2c1, m2c2 }); - auto col01 = std::make_shared>(ListD{ a2c1, a2c0, 0 }); - auto col02 = std::make_shared>(ListD{ a2c2, 0, a2c0 }); - auto col03 = std::make_shared>(ListD{ 0, m2c2, a2c1 }); - auto col11 = std::make_shared>(ListD{ m2c0, a2c1, m2c2 }); - auto col12 = std::make_shared>(ListD{ 0, a2c2, a2c1 }); - auto col13 = std::make_shared>(ListD{ a2c2, 0, m2c0 }); - auto col22 = std::make_shared>(ListD{ m2c0, m2c1, a2c2 }); - auto col23 = std::make_shared>(ListD{ m2c1, a2c0, 0 }); - auto col33 = std::make_shared>(ListD{ a2c0, a2c1, a2c2 }); - auto answer = std::make_shared(4, 4); - auto& row0 = answer->at(0); - row0->at(0) = col00; - row0->at(1) = col01; - row0->at(2) = col02; - row0->at(3) = col03; - auto& row1 = answer->at(1); - row1->at(0) = col01; - row1->at(1) = col11; - row1->at(2) = col12; - row1->at(3) = col13; - auto& row2 = answer->at(2); - row2->at(0) = col02; - row2->at(1) = col12; - row2->at(2) = col22; - row2->at(3) = col23; - auto& row3 = answer->at(3); - row3->at(0) = col03; - row3->at(1) = col13; - row3->at(2) = col23; - row3->at(3) = col33; - return answer; -} - -template<> -inline FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) -{ - //"col size = 4." - auto c0 = col->at(0); - auto c1 = col->at(1); - auto c2 = col->at(2); - auto mc0 = -c0; - auto mc1 = -c1; - auto mc2 = -c2; - auto mc3 = -col->at(3); - auto answer = std::make_shared(3, 4); - auto& row0 = answer->at(0); - auto& row1 = answer->at(1); - auto& row2 = answer->at(2); - row0->atiput(0, mc3); - row0->atiput(1, mc2); - row0->atiput(2, c1); - row0->atiput(3, c0); - row1->atiput(0, c2); - row1->atiput(1, mc3); - row1->atiput(2, mc0); - row1->atiput(3, c1); - row2->atiput(0, mc1); - row2->atiput(1, c0); - row2->atiput(2, mc3); - row2->atiput(3, c2); - return answer; -} - -template -inline FMatDsptr EulerParameters::pCTpEtimesColumn(FColDsptr col) -{ - //"col size = 3." - auto c0 = col->at(0); - auto c1 = col->at(1); - auto c2 = col->at(2); - auto mc0 = -c0; - auto mc1 = -c1; - auto mc2 = -c2; - auto answer = std::make_shared(4, 4); - auto& row0 = answer->at(0); - auto& row1 = answer->at(1); - auto& row2 = answer->at(2); - auto& row3 = answer->at(3); - row0->atiput(0, 0.0); - row0->atiput(1, c2); - row0->atiput(2, mc1); - row0->atiput(3, c0); - row1->atiput(0, mc2); - row1->atiput(1, 0.0); - row1->atiput(2, c0); - row1->atiput(3, c1); - row2->atiput(0, c1); - row2->atiput(1, mc0); - row2->atiput(2, 0.0); - row2->atiput(3, c2); - row3->atiput(0, mc0); - row3->atiput(1, mc1); - row3->atiput(2, mc2); - row3->atiput(3, 0.0); - return answer; -} - -template<> -inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) -{ - FRowDsptr a2m0 = mat->at(0)->times(2.0); - FRowDsptr a2m1 = mat->at(1)->times(2.0); - FRowDsptr a2m2 = mat->at(2)->times(2.0); - FRowDsptr m2m0 = a2m0->negated(); - FRowDsptr m2m1 = a2m1->negated(); - FRowDsptr m2m2 = a2m2->negated(); - FRowDsptr zero = std::make_shared>(3, 0.0); - auto mat00 = std::make_shared(ListFRD{ a2m0, m2m1, m2m2 }); - auto mat01 = std::make_shared(ListFRD{ a2m1, a2m0, zero }); - auto mat02 = std::make_shared(ListFRD{ a2m2, zero, a2m0 }); - auto mat03 = std::make_shared(ListFRD{ zero, m2m2, a2m1 }); - auto mat11 = std::make_shared(ListFRD{ m2m0, a2m1, m2m2 }); - auto mat12 = std::make_shared(ListFRD{ zero, a2m2, a2m1 }); - auto mat13 = std::make_shared(ListFRD{ a2m2, zero, m2m0 }); - auto mat22 = std::make_shared(ListFRD{ m2m0, m2m1, a2m2 }); - auto mat23 = std::make_shared(ListFRD{ m2m1, a2m0, zero }); - auto mat33 = std::make_shared(ListFRD{ a2m0, a2m1, a2m2 }); - auto answer = std::make_shared(4, 4); - auto& row0 = answer->at(0); - row0->at(0) = mat00; - row0->at(1) = mat01; - row0->at(2) = mat02; - row0->at(3) = mat03; - auto& row1 = answer->at(1); - row1->at(0) = mat01; - row1->at(1) = mat11; - row1->at(2) = mat12; - row1->at(3) = mat13; - auto& row2 = answer->at(2); - row2->at(0) = mat02; - row2->at(1) = mat12; - row2->at(2) = mat22; - row2->at(3) = mat23; - auto& row3 = answer->at(3); - row3->at(0) = mat03; - row3->at(1) = mat13; - row3->at(2) = mat23; - row3->at(3) = mat33; - return answer; -} - -template // this is ALWAYS double; see note below. -inline void EulerParameters::initialize() -{ - aA = FullMatrixDouble::identitysptr(3); - aB = std::make_shared(3, 4); - aC = std::make_shared(3, 4); - pApE = std::make_shared>(4); - for (int i = 0; i < 4; i++) +namespace MbD { + template<> + inline FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) { - pApE->at(i) = std::make_shared(3, 3); + double a2c0 = 2 * col->at(0); + double a2c1 = 2 * col->at(1); + double a2c2 = 2 * col->at(2); + double m2c0 = 0 - a2c0; + double m2c1 = 0 - a2c1; + double m2c2 = 0 - a2c2; + auto col00 = std::make_shared>(ListD{ a2c0, m2c1, m2c2 }); + auto col01 = std::make_shared>(ListD{ a2c1, a2c0, 0 }); + auto col02 = std::make_shared>(ListD{ a2c2, 0, a2c0 }); + auto col03 = std::make_shared>(ListD{ 0, m2c2, a2c1 }); + auto col11 = std::make_shared>(ListD{ m2c0, a2c1, m2c2 }); + auto col12 = std::make_shared>(ListD{ 0, a2c2, a2c1 }); + auto col13 = std::make_shared>(ListD{ a2c2, 0, m2c0 }); + auto col22 = std::make_shared>(ListD{ m2c0, m2c1, a2c2 }); + auto col23 = std::make_shared>(ListD{ m2c1, a2c0, 0 }); + auto col33 = std::make_shared>(ListD{ a2c0, a2c1, a2c2 }); + auto answer = std::make_shared(4, 4); + auto& row0 = answer->at(0); + row0->at(0) = col00; + row0->at(1) = col01; + row0->at(2) = col02; + row0->at(3) = col03; + auto& row1 = answer->at(1); + row1->at(0) = col01; + row1->at(1) = col11; + row1->at(2) = col12; + row1->at(3) = col13; + auto& row2 = answer->at(2); + row2->at(0) = col02; + row2->at(1) = col12; + row2->at(2) = col22; + row2->at(3) = col23; + auto& row3 = answer->at(3); + row3->at(0) = col03; + row3->at(1) = col13; + row3->at(2) = col23; + row3->at(3) = col33; + return answer; + } + + template<> + inline FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) + { + //"col size = 4." + auto c0 = col->at(0); + auto c1 = col->at(1); + auto c2 = col->at(2); + auto mc0 = -c0; + auto mc1 = -c1; + auto mc2 = -c2; + auto mc3 = -col->at(3); + auto answer = std::make_shared(3, 4); + auto& row0 = answer->at(0); + auto& row1 = answer->at(1); + auto& row2 = answer->at(2); + row0->atiput(0, mc3); + row0->atiput(1, mc2); + row0->atiput(2, c1); + row0->atiput(3, c0); + row1->atiput(0, c2); + row1->atiput(1, mc3); + row1->atiput(2, mc0); + row1->atiput(3, c1); + row2->atiput(0, mc1); + row2->atiput(1, c0); + row2->atiput(2, mc3); + row2->atiput(3, c2); + return answer; + } + + template + inline FMatDsptr EulerParameters::pCTpEtimesColumn(FColDsptr col) + { + //"col size = 3." + auto c0 = col->at(0); + auto c1 = col->at(1); + auto c2 = col->at(2); + auto mc0 = -c0; + auto mc1 = -c1; + auto mc2 = -c2; + auto answer = std::make_shared(4, 4); + auto& row0 = answer->at(0); + auto& row1 = answer->at(1); + auto& row2 = answer->at(2); + auto& row3 = answer->at(3); + row0->atiput(0, 0.0); + row0->atiput(1, c2); + row0->atiput(2, mc1); + row0->atiput(3, c0); + row1->atiput(0, mc2); + row1->atiput(1, 0.0); + row1->atiput(2, c0); + row1->atiput(3, c1); + row2->atiput(0, c1); + row2->atiput(1, mc0); + row2->atiput(2, 0.0); + row2->atiput(3, c2); + row3->atiput(0, mc0); + row3->atiput(1, mc1); + row3->atiput(2, mc2); + row3->atiput(3, 0.0); + return answer; + } + + template<> + inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) + { + FRowDsptr a2m0 = mat->at(0)->times(2.0); + FRowDsptr a2m1 = mat->at(1)->times(2.0); + FRowDsptr a2m2 = mat->at(2)->times(2.0); + FRowDsptr m2m0 = a2m0->negated(); + FRowDsptr m2m1 = a2m1->negated(); + FRowDsptr m2m2 = a2m2->negated(); + FRowDsptr zero = std::make_shared>(3, 0.0); + auto mat00 = std::make_shared(ListFRD{ a2m0, m2m1, m2m2 }); + auto mat01 = std::make_shared(ListFRD{ a2m1, a2m0, zero }); + auto mat02 = std::make_shared(ListFRD{ a2m2, zero, a2m0 }); + auto mat03 = std::make_shared(ListFRD{ zero, m2m2, a2m1 }); + auto mat11 = std::make_shared(ListFRD{ m2m0, a2m1, m2m2 }); + auto mat12 = std::make_shared(ListFRD{ zero, a2m2, a2m1 }); + auto mat13 = std::make_shared(ListFRD{ a2m2, zero, m2m0 }); + auto mat22 = std::make_shared(ListFRD{ m2m0, m2m1, a2m2 }); + auto mat23 = std::make_shared(ListFRD{ m2m1, a2m0, zero }); + auto mat33 = std::make_shared(ListFRD{ a2m0, a2m1, a2m2 }); + auto answer = std::make_shared(4, 4); + auto& row0 = answer->at(0); + row0->at(0) = mat00; + row0->at(1) = mat01; + row0->at(2) = mat02; + row0->at(3) = mat03; + auto& row1 = answer->at(1); + row1->at(0) = mat01; + row1->at(1) = mat11; + row1->at(2) = mat12; + row1->at(3) = mat13; + auto& row2 = answer->at(2); + row2->at(0) = mat02; + row2->at(1) = mat12; + row2->at(2) = mat22; + row2->at(3) = mat23; + auto& row3 = answer->at(3); + row3->at(0) = mat03; + row3->at(1) = mat13; + row3->at(2) = mat23; + row3->at(3) = mat33; + return answer; + } + + template // this is ALWAYS double; see note below. + inline void EulerParameters::initialize() + { + aA = FullMatrixDouble::identitysptr(3); + aB = std::make_shared(3, 4); + aC = std::make_shared(3, 4); + pApE = std::make_shared>(4); + for (int i = 0; i < 4; i++) + { + pApE->at(i) = std::make_shared(3, 3); + } } -} // the following can't be valid as FullMatrix instatiatiates , yet // this class needs to see the member functions of FullMatrix @@ -183,129 +183,130 @@ inline void EulerParameters::initialize() //{ //} -template -inline void EulerParameters::calc() -{ - this->calcABC(); - this->calcpApE(); -} -template<> -inline void EulerParameters::calcABC() -{ - double aE0 = this->at(0); - double aE1 = this->at(1); - double aE2 = this->at(2); - double aE3 = this->at(3); - double mE0 = -aE0; - double mE1 = -aE1; - double mE2 = -aE2; - FRowDsptr aBi; - aBi = aB->at(0); - aBi->at(0) = aE3; - aBi->at(1) = mE2; - aBi->at(2) = aE1; - aBi->at(3) = mE0; - aBi = aB->at(1); - aBi->at(0) = aE2; - aBi->at(1) = aE3; - aBi->at(2) = mE0; - aBi->at(3) = mE1; - aBi = aB->at(2); - aBi->at(0) = mE1; - aBi->at(1) = aE0; - aBi->at(2) = aE3; - aBi->at(3) = mE2; - FRowDsptr aCi; - aCi = aC->at(0); - aCi->at(0) = aE3; - aCi->at(1) = aE2; - aCi->at(2) = mE1; - aCi->at(3) = mE0; - aCi = aC->at(1); - aCi->at(0) = mE2; - aCi->at(1) = aE3; - aCi->at(2) = aE0; - aCi->at(3) = mE1; - aCi = aC->at(2); - aCi->at(0) = aE1; - aCi->at(1) = mE0; - aCi->at(2) = aE3; - aCi->at(3) = mE2; + template + inline void EulerParameters::calc() + { + this->calcABC(); + this->calcpApE(); + } + template<> + inline void EulerParameters::calcABC() + { + double aE0 = this->at(0); + double aE1 = this->at(1); + double aE2 = this->at(2); + double aE3 = this->at(3); + double mE0 = -aE0; + double mE1 = -aE1; + double mE2 = -aE2; + FRowDsptr aBi; + aBi = aB->at(0); + aBi->at(0) = aE3; + aBi->at(1) = mE2; + aBi->at(2) = aE1; + aBi->at(3) = mE0; + aBi = aB->at(1); + aBi->at(0) = aE2; + aBi->at(1) = aE3; + aBi->at(2) = mE0; + aBi->at(3) = mE1; + aBi = aB->at(2); + aBi->at(0) = mE1; + aBi->at(1) = aE0; + aBi->at(2) = aE3; + aBi->at(3) = mE2; + FRowDsptr aCi; + aCi = aC->at(0); + aCi->at(0) = aE3; + aCi->at(1) = aE2; + aCi->at(2) = mE1; + aCi->at(3) = mE0; + aCi = aC->at(1); + aCi->at(0) = mE2; + aCi->at(1) = aE3; + aCi->at(2) = aE0; + aCi->at(3) = mE1; + aCi = aC->at(2); + aCi->at(0) = aE1; + aCi->at(1) = mE0; + aCi->at(2) = aE3; + aCi->at(3) = mE2; - aA = aB->timesTransposeFullMatrix(aC); -} -template<> -inline void EulerParameters::calcpApE() -{ - double a2E0 = 2.0 * (this->at(0)); - double a2E1 = 2.0 * (this->at(1)); - double a2E2 = 2.0 * (this->at(2)); - double a2E3 = 2.0 * (this->at(3)); - double m2E0 = -a2E0; - double m2E1 = -a2E1; - double m2E2 = -a2E2; - double m2E3 = -a2E3; - FMatDsptr pApEk; - pApEk = pApE->at(0); - FRowDsptr pAipEk; - pAipEk = pApEk->at(0); - pAipEk->at(0) = a2E0; - pAipEk->at(1) = a2E1; - pAipEk->at(2) = a2E2; - pAipEk = pApEk->at(1); - pAipEk->at(0) = a2E1; - pAipEk->at(1) = m2E0; - pAipEk->at(2) = m2E3; - pAipEk = pApEk->at(2); - pAipEk->at(0) = a2E2; - pAipEk->at(1) = a2E3; - pAipEk->at(2) = m2E0; - // - pApEk = pApE->at(1); - pAipEk = pApEk->at(0); - pAipEk->at(0) = m2E1; - pAipEk->at(1) = a2E0; - pAipEk->at(2) = a2E3; - pAipEk = pApEk->at(1); - pAipEk->at(0) = a2E0; - pAipEk->at(1) = a2E1; - pAipEk->at(2) = a2E2; - pAipEk = pApEk->at(2); - pAipEk->at(0) = m2E3; - pAipEk->at(1) = a2E2; - pAipEk->at(2) = m2E1; - // - pApEk = pApE->at(2); - pAipEk = pApEk->at(0); - pAipEk->at(0) = m2E2; - pAipEk->at(1) = m2E3; - pAipEk->at(2) = a2E0; - pAipEk = pApEk->at(1); - pAipEk->at(0) = a2E3; - pAipEk->at(1) = m2E2; - pAipEk->at(2) = a2E1; - pAipEk = pApEk->at(2); - pAipEk->at(0) = a2E0; - pAipEk->at(1) = a2E1; - pAipEk->at(2) = a2E2; - // - pApEk = pApE->at(3); - pAipEk = pApEk->at(0); - pAipEk->at(0) = a2E3; - pAipEk->at(1) = m2E2; - pAipEk->at(2) = a2E1; - pAipEk = pApEk->at(1); - pAipEk->at(0) = a2E2; - pAipEk->at(1) = a2E3; - pAipEk->at(2) = m2E0; - pAipEk = pApEk->at(2); - pAipEk->at(0) = m2E1; - pAipEk->at(1) = a2E0; - pAipEk->at(2) = a2E3; -} -template -inline void EulerParameters::conditionSelf() -{ - EulerArray::conditionSelf(); - this->normalizeSelf(); + aA = aB->timesTransposeFullMatrix(aC); + } + template<> + inline void EulerParameters::calcpApE() + { + double a2E0 = 2.0 * (this->at(0)); + double a2E1 = 2.0 * (this->at(1)); + double a2E2 = 2.0 * (this->at(2)); + double a2E3 = 2.0 * (this->at(3)); + double m2E0 = -a2E0; + double m2E1 = -a2E1; + double m2E2 = -a2E2; + double m2E3 = -a2E3; + FMatDsptr pApEk; + pApEk = pApE->at(0); + FRowDsptr pAipEk; + pAipEk = pApEk->at(0); + pAipEk->at(0) = a2E0; + pAipEk->at(1) = a2E1; + pAipEk->at(2) = a2E2; + pAipEk = pApEk->at(1); + pAipEk->at(0) = a2E1; + pAipEk->at(1) = m2E0; + pAipEk->at(2) = m2E3; + pAipEk = pApEk->at(2); + pAipEk->at(0) = a2E2; + pAipEk->at(1) = a2E3; + pAipEk->at(2) = m2E0; + // + pApEk = pApE->at(1); + pAipEk = pApEk->at(0); + pAipEk->at(0) = m2E1; + pAipEk->at(1) = a2E0; + pAipEk->at(2) = a2E3; + pAipEk = pApEk->at(1); + pAipEk->at(0) = a2E0; + pAipEk->at(1) = a2E1; + pAipEk->at(2) = a2E2; + pAipEk = pApEk->at(2); + pAipEk->at(0) = m2E3; + pAipEk->at(1) = a2E2; + pAipEk->at(2) = m2E1; + // + pApEk = pApE->at(2); + pAipEk = pApEk->at(0); + pAipEk->at(0) = m2E2; + pAipEk->at(1) = m2E3; + pAipEk->at(2) = a2E0; + pAipEk = pApEk->at(1); + pAipEk->at(0) = a2E3; + pAipEk->at(1) = m2E2; + pAipEk->at(2) = a2E1; + pAipEk = pApEk->at(2); + pAipEk->at(0) = a2E0; + pAipEk->at(1) = a2E1; + pAipEk->at(2) = a2E2; + // + pApEk = pApE->at(3); + pAipEk = pApEk->at(0); + pAipEk->at(0) = a2E3; + pAipEk->at(1) = m2E2; + pAipEk->at(2) = a2E1; + pAipEk = pApEk->at(1); + pAipEk->at(0) = a2E2; + pAipEk->at(1) = a2E3; + pAipEk->at(2) = m2E0; + pAipEk = pApEk->at(2); + pAipEk->at(0) = m2E1; + pAipEk->at(1) = a2E0; + pAipEk->at(2) = a2E3; + } + template + inline void EulerParameters::conditionSelf() + { + EulerArray::conditionSelf(); + this->normalizeSelf(); + } } diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 40bda2a..1dc1c8b 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -59,5 +59,6 @@ namespace MbD { FMatDsptr aC; FColFMatDsptr pApE; }; + template class EulerParameters; } diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index 9dab0db..479a66f 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -161,7 +161,11 @@ namespace MbD { template FColsptr FullColumn::simplified() { - assert(false); +// assert(false); return FColsptr(); } + // instantiate on purpose to make visible in library api: + template class FullColumn; + template class FullColumn; + } \ No newline at end of file diff --git a/OndselSolver/FullColumn.h b/OndselSolver/FullColumn.h index 9bd13c4..a015278 100644 --- a/OndselSolver/FullColumn.h +++ b/OndselSolver/FullColumn.h @@ -55,15 +55,11 @@ namespace MbD { { s << "FullCol{"; s << this->at(0); - for (int i = 1; i < this->size(); i++) + for (int i = 1; i < int(this->size()); i++) { s << ", " << this->at(i); } s << "}"; return s; } - // instantiate on purpose to make visible in library api: - template class FullColumn; - template class FullColumn; } - diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 2648732..468dc3e 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -75,7 +75,7 @@ namespace MbD { void zeroSelf() override; FColsptr column(int j); - void atiput(int i, FRowsptr fullRow); + void atiput(int i, FRowsptr fullRow) override; void atijput(int i, int j, double value); std::shared_ptr copy(); double maxMagnitude() override; diff --git a/OndselSolver/FullVector.h b/OndselSolver/FullVector.h index 228145b..60b2b3f 100644 --- a/OndselSolver/FullVector.h +++ b/OndselSolver/FullVector.h @@ -66,7 +66,7 @@ namespace MbD { inline double FullVector::sumOfSquares() { double sum = 0.0; - for (int i = 0; i < this->size(); i++) + for (int i = 0; i < (int)this->size(); i++) { double element = this->at(i); sum += element * element; @@ -87,7 +87,7 @@ namespace MbD { template<> inline void FullVector::zeroSelf() { - for (int i = 0; i < this->size(); i++) { + for (int i = 0; i < (int)this->size(); i++) { this->at(i) = 0.0; } } @@ -126,7 +126,7 @@ namespace MbD { inline double FullVector::maxMagnitude() { double max = 0.0; - for (int i = 0; i < this->size(); i++) + for (int i = 0; i < (int)this->size(); i++) { double element = this->at(i); if (element < 0.0) element = -element; @@ -168,7 +168,7 @@ namespace MbD { template<> inline void FullVector::conditionSelfWithTol(double tol) { - for (int i = 0; i < this->size(); i++) + for (int i = 0; i < (int)this->size(); i++) { double element = this->at(i); if (element < 0.0) element = -element; @@ -176,7 +176,7 @@ namespace MbD { } } template - inline void FullVector::conditionSelfWithTol(double tol) + inline void FullVector::conditionSelfWithTol(double __attribute__((unused))tol) { assert(false); return; @@ -186,7 +186,7 @@ namespace MbD { { s << "FullVec{"; s << this->at(0); - for (int i = 1; i < this->size(); i++) + for (int i = 1; i < (int)this->size(); i++) { s << ", " << this->at(i); } From 5af8a391065078a54e06cd989655f6a6a0168ab6 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 17:57:08 -0600 Subject: [PATCH 08/17] Windows can't do __attribute__((unused)) --- OndselSolver/FullVector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OndselSolver/FullVector.h b/OndselSolver/FullVector.h index 60b2b3f..53b3d4c 100644 --- a/OndselSolver/FullVector.h +++ b/OndselSolver/FullVector.h @@ -176,7 +176,7 @@ namespace MbD { } } template - inline void FullVector::conditionSelfWithTol(double __attribute__((unused))tol) + inline void FullVector::conditionSelfWithTol(double tol) { assert(false); return; From 0c18245bcff0418d99e18551b6100b6f1394447b Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Sun, 5 Nov 2023 18:16:35 -0600 Subject: [PATCH 09/17] adding bogus returns after assert(false) --- OndselSolver/FullColumn.cpp | 2 ++ OndselSolver/FullMatrix.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OndselSolver/FullColumn.cpp b/OndselSolver/FullColumn.cpp index 479a66f..b173b08 100644 --- a/OndselSolver/FullColumn.cpp +++ b/OndselSolver/FullColumn.cpp @@ -47,6 +47,8 @@ namespace MbD { FColsptr FullColumn::times(T a) { assert(false); + auto answer = std::make_shared>(); + return answer; } template FColsptr FullColumn::negated() diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 1a12d03..7296c7f 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -334,17 +334,15 @@ namespace MbD { } std::shared_ptr FullMatrixFullMatrixDouble::times(double a) { + // TODO: correct action? assert(false); + return std::make_shared(); } std::shared_ptr FullMatrixFullColumnDouble::times(double a) { -// int m = this->nrow(); -// auto answer = std::make_shared(m); -// for (int i = 0; i < m; i++) { -// answer->at(i) = this->at(i)->times(a); -// } -// return answer; + // TODO: correct action? assert(false); + return std::make_shared(); } std::shared_ptr FullMatrixDouble::transposeTimesFullMatrix(std::shared_ptr fullMat) { From 5946204b149a6b125b2b7f4082639e724fec7071 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Mon, 6 Nov 2023 13:44:55 -0600 Subject: [PATCH 10/17] Reverted CMakeLists.txt --- CMakeLists.txt | 627 ++++++++++++++++++++++++------------------------- 1 file changed, 312 insertions(+), 315 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95c5fab..c7ce907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,301 +5,19 @@ project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibo set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(ONDSELSOLVER_HEADERS - OndselSolver/AbsConstraint.h - OndselSolver/Abs.h - OndselSolver/AccICKineNewtonRaphson.h - OndselSolver/AccICNewtonRaphson.h - OndselSolver/AccKineNewtonRaphson.h - OndselSolver/AccNewtonRaphson.h - OndselSolver/AngleJoint.h - OndselSolver/AngleZIecJec.h - OndselSolver/AngleZIeqcJec.h - OndselSolver/AngleZIeqcJeqc.h - OndselSolver/AnyGeneralSpline.h - OndselSolver/AnyPosICNewtonRaphson.h - OndselSolver/APIExport.h - OndselSolver/ArcSine.h - OndselSolver/ArcTan2.h - OndselSolver/ArcTan.h - OndselSolver/Array.h - OndselSolver/ASMTAnimationParameters.h - OndselSolver/ASMTAssembly.h - OndselSolver/ASMTConstantGravity.h - OndselSolver/ASMTConstraintSet.h - OndselSolver/ASMTCylindricalJoint.h - OndselSolver/ASMTExtrusion.h - OndselSolver/ASMTFixedJoint.h - OndselSolver/ASMTForceTorque.h - OndselSolver/ASMTGeneralMotion.h - OndselSolver/ASMTItem.h - OndselSolver/ASMTItemIJ.h - OndselSolver/ASMTJoint.h - OndselSolver/ASMTKinematicIJ.h - OndselSolver/ASMTMarker.h - OndselSolver/ASMTMotion.h - OndselSolver/ASMTNoRotationJoint.h - OndselSolver/ASMTPart.h - OndselSolver/ASMTPointInLineJoint.h - OndselSolver/ASMTPointInPlaneJoint.h - OndselSolver/ASMTPrincipalMassMarker.h - OndselSolver/ASMTRefCurve.h - OndselSolver/ASMTRefItem.h - OndselSolver/ASMTRefPoint.h - OndselSolver/ASMTRefSurface.h - OndselSolver/ASMTRevoluteJoint.h - OndselSolver/ASMTRotationalMotion.h - OndselSolver/ASMTSimulationParameters.h - OndselSolver/ASMTSpatialContainer.h - OndselSolver/ASMTSpatialItem.h - OndselSolver/ASMTSphericalJoint.h - OndselSolver/ASMTTime.h - OndselSolver/ASMTTranslationalJoint.h - OndselSolver/ASMTTranslationalMotion.h - OndselSolver/ASMTUniversalJoint.h - OndselSolver/AtPointConstraintIJ.h - OndselSolver/AtPointConstraintIqcJc.h - OndselSolver/AtPointConstraintIqcJqc.h - OndselSolver/AtPointConstraintIqctJqc.h - OndselSolver/AtPointJoint.h - OndselSolver/BasicIntegrator.h - OndselSolver/BasicQuasiIntegrator.h - OndselSolver/BasicUserFunction.h - OndselSolver/CADSystem.h - OndselSolver/CartesianFrame.h - OndselSolver/CompoundJoint.h - OndselSolver/ConstantGravity.h - OndselSolver/Constant.h - OndselSolver/ConstantVelocityJoint.h - OndselSolver/Constraint.h - OndselSolver/ConstraintIJ.h - OndselSolver/ConstVelConstraintIJ.h - OndselSolver/ConstVelConstraintIqcJc.h - OndselSolver/ConstVelConstraintIqcJqc.h - OndselSolver/corecrt_math_defines.h - OndselSolver/Cosine.h - OndselSolver/CREATE.h - OndselSolver/CylindricalJoint.h - OndselSolver/CylSphJoint.h - OndselSolver/DiagonalMatrix.h - OndselSolver/DifferenceOperator.h - OndselSolver/DifferentiatedGeneralSpline.h - OndselSolver/DirectionCosineConstraintIJ.h - OndselSolver/DirectionCosineConstraintIqcJc.h - OndselSolver/DirectionCosineConstraintIqcJqc.h - OndselSolver/DirectionCosineConstraintIqctJqc.h - OndselSolver/DirectionCosineIecJec.h - OndselSolver/DirectionCosineIeqcJec.h - OndselSolver/DirectionCosineIeqcJeqc.h - OndselSolver/DirectionCosineIeqctJeqc.h - OndselSolver/DiscontinuityError.h - OndselSolver/DispCompIecJecIe.h - OndselSolver/DispCompIecJecKec.h - OndselSolver/DispCompIecJecKeqc.h - OndselSolver/DispCompIecJecO.h - OndselSolver/DispCompIeqcJecIe.h - OndselSolver/DispCompIeqcJecKeqc.h - OndselSolver/DispCompIeqcJecO.h - OndselSolver/DispCompIeqcJeqcIe.h - OndselSolver/DispCompIeqcJeqcKeqc.h - OndselSolver/DispCompIeqcJeqcKeqct.h - OndselSolver/DispCompIeqcJeqcO.h - OndselSolver/DispCompIeqctJeqcIe.h - OndselSolver/DispCompIeqctJeqcKeqct.h - OndselSolver/DispCompIeqctJeqcO.h - OndselSolver/DistanceConstraintIJ.h - OndselSolver/DistanceConstraintIqcJc.h - OndselSolver/DistanceConstraintIqcJqc.h - OndselSolver/DistanceConstraintIqctJqc.h - OndselSolver/DistancexyConstraintIJ.h - OndselSolver/DistancexyConstraintIqcJc.h - OndselSolver/DistancexyConstraintIqcJqc.h - OndselSolver/DistIecJec.h - OndselSolver/DistIeqcJec.h - OndselSolver/DistIeqcJeqc.h - OndselSolver/DistIeqctJeqc.h - OndselSolver/DistxyIecJec.h - OndselSolver/DistxyIeqcJec.h - OndselSolver/DistxyIeqcJeqc.h - OndselSolver/DistxyIeqctJeqc.h - OndselSolver/EigenDecomposition.h - OndselSolver/EndFramec.h - OndselSolver/EndFrameqc.h - OndselSolver/EndFrameqct2.h - OndselSolver/EndFrameqct.h - OndselSolver/enum.h - OndselSolver/EulerAnglesDDot.h - OndselSolver/EulerAnglesDot.h - OndselSolver/EulerAngles.h - OndselSolver/EulerAngleszxzDDot.h - OndselSolver/EulerAngleszxzDot.h - OndselSolver/EulerAngleszxz.h - OndselSolver/EulerArray.h - OndselSolver/EulerConstraint.h - OndselSolver/EulerParametersDDot.h - OndselSolver/EulerParametersDot.h - OndselSolver/EulerParameters.h - OndselSolver/Exponential.h - OndselSolver/ExpressionX.h - OndselSolver/ExternalSystem.h - OndselSolver/FixedJoint.h - OndselSolver/ForceTorqueData.h - OndselSolver/ForceTorqueItem.h - OndselSolver/FullColumn.h - OndselSolver/FullMatrix.h - OndselSolver/FullMotion.h - OndselSolver/FullRow.h - OndselSolver/FullVector.h - OndselSolver/FunctionFromData.h - OndselSolver/Function.h - OndselSolver/FunctionWithManyArgs.h - OndselSolver/FunctionXcParameter.h - OndselSolver/FunctionX.h - OndselSolver/FunctionXY.h - OndselSolver/GearConstraintIJ.h - OndselSolver/GearConstraintIqcJc.h - OndselSolver/GearConstraintIqcJqc.h - OndselSolver/GearJoint.h - OndselSolver/GEFullMatFullPv.h - OndselSolver/GEFullMat.h - OndselSolver/GEFullMatParPv.h - OndselSolver/GeneralSpline.h - OndselSolver/GESpMatFullPv.h - OndselSolver/GESpMatFullPvPosIC.h - OndselSolver/GESpMat.h - OndselSolver/GESpMatParPv.h - OndselSolver/GESpMatParPvMarkoFast.h - OndselSolver/GESpMatParPvMarko.h - OndselSolver/GESpMatParPvPrecise.h - OndselSolver/ICKineIntegrator.h - OndselSolver/IndependentVariable.h - OndselSolver/InLineJoint.h - OndselSolver/InPlaneJoint.h - OndselSolver/Integrator.h - OndselSolver/IntegratorInterface.h - OndselSolver/Item.h - OndselSolver/Joint.h - OndselSolver/KineIntegrator.h - OndselSolver/KinematicIeJe.h - OndselSolver/LDUFullMat.h - OndselSolver/LDUFullMatParPv.h - OndselSolver/LDUSpMat.h - OndselSolver/LDUSpMatParPv.h - OndselSolver/LDUSpMatParPvMarko.h - OndselSolver/LDUSpMatParPvPrecise.h - OndselSolver/LinearMultiStepMethod.h - OndselSolver/LineInPlaneJoint.h - OndselSolver/Ln.h - OndselSolver/Log10.h - OndselSolver/LogN.h - OndselSolver/MarkerFrame.h - OndselSolver/MatrixDecomposition.h - OndselSolver/MatrixGaussElimination.h - OndselSolver/MatrixLDU.h - OndselSolver/MatrixSolver.h - OndselSolver/MaximumIterationError.h - OndselSolver/MbdMath.h - OndselSolver/MBDynBlock.h - OndselSolver/MBDynBody.h - OndselSolver/MBDynControlData.h - OndselSolver/MBDynData.h - OndselSolver/MBDynElement.h - OndselSolver/MBDynInitialValue.h - OndselSolver/MBDynItem.h - OndselSolver/MBDynJoint.h - OndselSolver/MBDynMarker.h - OndselSolver/MBDynNode.h - OndselSolver/MBDynReference.h - OndselSolver/MBDynStructural.h - OndselSolver/MBDynSystem.h - OndselSolver/MomentOfInertiaSolver.h - OndselSolver/Negative.h - OndselSolver/NewtonRaphsonError.h - OndselSolver/NewtonRaphson.h - OndselSolver/NoRotationJoint.h - OndselSolver/NotKinematicError.h - OndselSolver/Numeric.h - OndselSolver/OndselSolver.h - OndselSolver/OrbitAnglezIecJec.h - OndselSolver/OrbitAnglezIeqcJec.h - OndselSolver/OrbitAnglezIeqcJeqc.h - OndselSolver/Orientation.h - OndselSolver/ParallelAxesJoint.h - OndselSolver/PartFrame.h - OndselSolver/Part.h - OndselSolver/PerpendicularJoint.h - OndselSolver/PlanarJoint.h - OndselSolver/PointInLineJoint.h - OndselSolver/PointInPlaneJoint.h - OndselSolver/PosICKineNewtonRaphson.h - OndselSolver/PosICNewtonRaphson.h - OndselSolver/PosKineNewtonRaphson.h - OndselSolver/PosNewtonRaphson.h - OndselSolver/PosVelAccData.h - OndselSolver/Power.h - OndselSolver/PrescribedMotion.h - OndselSolver/Product.h - OndselSolver/QuasiIntegrator.h - OndselSolver/RackPinConstraintIJ.h - OndselSolver/RackPinConstraintIqcJc.h - OndselSolver/RackPinConstraintIqcJqc.h - OndselSolver/RackPinJoint.h - OndselSolver/Reciprocal.h - OndselSolver/RedundantConstraint.h - OndselSolver/resource.h - OndselSolver/RevCylJoint.h - OndselSolver/RevoluteJoint.h - OndselSolver/RowTypeMatrix.h - OndselSolver/ScalarNewtonRaphson.h - OndselSolver/ScrewConstraintIJ.h - OndselSolver/ScrewConstraintIqcJc.h - OndselSolver/ScrewConstraintIqcJqc.h - OndselSolver/ScrewJoint.h - OndselSolver/SimulationStoppingError.h - OndselSolver/Sine.h - OndselSolver/SingularMatrixError.h - OndselSolver/Solver.h - OndselSolver/SparseColumn.h - OndselSolver/SparseMatrix.h - OndselSolver/SparseRow.h - OndselSolver/SparseVector.h - OndselSolver/SphericalJoint.h - OndselSolver/SphSphJoint.h - OndselSolver/StableBackwardDifference.h - OndselSolver/StateData.h - OndselSolver/Sum.h - OndselSolver/Symbolic.h - OndselSolver/SymbolicParser.h - OndselSolver/SyntaxError.h - OndselSolver/System.h - OndselSolver/SystemNewtonRaphson.h - OndselSolver/SystemSolver.h - OndselSolver/Time.h - OndselSolver/TooManyTriesError.h - OndselSolver/TooSmallStepSizeError.h - OndselSolver/TranslationalJoint.h - OndselSolver/TranslationConstraintIJ.h - OndselSolver/TranslationConstraintIqcJc.h - OndselSolver/TranslationConstraintIqcJqc.h - OndselSolver/TranslationConstraintIqctJqc.h - OndselSolver/Translation.h - OndselSolver/Units.h - OndselSolver/UniversalJoint.h - OndselSolver/UserFunction.h - OndselSolver/Variable.h - OndselSolver/VectorNewtonRaphson.h - OndselSolver/VelICKineSolver.h - OndselSolver/VelICSolver.h - OndselSolver/VelKineSolver.h - OndselSolver/VelSolver.h - OndselSolver/ZRotation.h - OndselSolver/ZTranslation.h -) +include(GNUInstallDirs) -set(ONDSELSOLVER_EXPORT +add_library(OndselSolver STATIC) + +set(ONDSELSOLVER_SRC + OndselSolver/Array.cpp + OndselSolver/FullVector.cpp + OndselSolver/RowTypeMatrix.cpp + OndselSolver/FullColumn.cpp OndselSolver/FullMatrix.cpp - OndselSolver/AbsConstraint.cpp + OndselSolver/FullRow.cpp OndselSolver/Abs.cpp + OndselSolver/AbsConstraint.cpp OndselSolver/AccICKineNewtonRaphson.cpp OndselSolver/AccICNewtonRaphson.cpp OndselSolver/AccKineNewtonRaphson.cpp @@ -311,9 +29,8 @@ set(ONDSELSOLVER_EXPORT OndselSolver/AnyGeneralSpline.cpp OndselSolver/AnyPosICNewtonRaphson.cpp OndselSolver/ArcSine.cpp - OndselSolver/ArcTan2.cpp OndselSolver/ArcTan.cpp - OndselSolver/Array.cpp + OndselSolver/ArcTan2.cpp OndselSolver/ASMTAnimationParameters.cpp OndselSolver/ASMTAssembly.cpp OndselSolver/ASMTConstantGravity.cpp @@ -415,8 +132,8 @@ set(ONDSELSOLVER_EXPORT OndselSolver/EigenDecomposition.cpp OndselSolver/EndFramec.cpp OndselSolver/EndFrameqc.cpp - OndselSolver/EndFrameqct2.cpp OndselSolver/EndFrameqct.cpp + OndselSolver/EndFrameqct2.cpp OndselSolver/EulerAngles.cpp OndselSolver/EulerAnglesDDot.cpp OndselSolver/EulerAnglesDot.cpp @@ -434,15 +151,12 @@ set(ONDSELSOLVER_EXPORT OndselSolver/FixedJoint.cpp OndselSolver/ForceTorqueData.cpp OndselSolver/ForceTorqueItem.cpp - OndselSolver/FullColumn.cpp OndselSolver/FullMotion.cpp - OndselSolver/FullRow.cpp - OndselSolver/FullVector.cpp OndselSolver/Function.cpp OndselSolver/FunctionFromData.cpp OndselSolver/FunctionWithManyArgs.cpp - OndselSolver/FunctionXcParameter.cpp OndselSolver/FunctionX.cpp + OndselSolver/FunctionXcParameter.cpp OndselSolver/FunctionXY.cpp OndselSolver/GearConstraintIJ.cpp OndselSolver/GearConstraintIqcJc.cpp @@ -507,7 +221,6 @@ set(ONDSELSOLVER_EXPORT OndselSolver/NoRotationJoint.cpp OndselSolver/NotKinematicError.cpp OndselSolver/Numeric.cpp - OndselSolver/OndselSolver.cpp OndselSolver/OrbitAnglezIecJec.cpp OndselSolver/OrbitAnglezIeqcJec.cpp OndselSolver/OrbitAnglezIeqcJeqc.cpp @@ -536,7 +249,6 @@ set(ONDSELSOLVER_EXPORT OndselSolver/RedundantConstraint.cpp OndselSolver/RevCylJoint.cpp OndselSolver/RevoluteJoint.cpp - OndselSolver/RowTypeMatrix.cpp OndselSolver/ScalarNewtonRaphson.cpp OndselSolver/ScrewConstraintIJ.cpp OndselSolver/ScrewConstraintIqcJc.cpp @@ -564,12 +276,12 @@ set(ONDSELSOLVER_EXPORT OndselSolver/Time.cpp OndselSolver/TooManyTriesError.cpp OndselSolver/TooSmallStepSizeError.cpp + OndselSolver/Translation.cpp OndselSolver/TranslationalJoint.cpp OndselSolver/TranslationConstraintIJ.cpp OndselSolver/TranslationConstraintIqcJc.cpp OndselSolver/TranslationConstraintIqcJqc.cpp OndselSolver/TranslationConstraintIqctJqc.cpp - OndselSolver/Translation.cpp OndselSolver/Units.cpp OndselSolver/UniversalJoint.cpp OndselSolver/UserFunction.cpp @@ -583,25 +295,310 @@ set(ONDSELSOLVER_EXPORT OndselSolver/ZTranslation.cpp ) -add_library(OndselSolver "") - -target_sources(OndselSolver - PRIVATE - ${ONDSELSOLVER_EXPORT} - PUBLIC - ${ONDSELSOLVER_HEADERS} +set(ONDSELSOLVER_HEADERS + OndselSolver/Array.h + OndselSolver/FullVector.h + OndselSolver/RowTypeMatrix.h + OndselSolver/FullRow.h + OndselSolver/FullColumn.h + OndselSolver/FullMatrix.h + OndselSolver/Abs.h + OndselSolver/AbsConstraint.h + OndselSolver/AccICKineNewtonRaphson.h + OndselSolver/AccICNewtonRaphson.h + OndselSolver/AccKineNewtonRaphson.h + OndselSolver/AccNewtonRaphson.h + OndselSolver/AngleJoint.h + OndselSolver/AngleZIecJec.h + OndselSolver/AngleZIeqcJec.h + OndselSolver/AngleZIeqcJeqc.h + OndselSolver/AnyGeneralSpline.h + OndselSolver/AnyPosICNewtonRaphson.h + OndselSolver/APIExport.h + OndselSolver/ArcSine.h + OndselSolver/ArcTan.h + OndselSolver/ArcTan2.h + OndselSolver/ASMTAnimationParameters.h + OndselSolver/ASMTAssembly.h + OndselSolver/ASMTConstantGravity.h + OndselSolver/ASMTConstraintSet.h + OndselSolver/ASMTCylindricalJoint.h + OndselSolver/ASMTExtrusion.h + OndselSolver/ASMTFixedJoint.h + OndselSolver/ASMTForceTorque.h + OndselSolver/ASMTGeneralMotion.h + OndselSolver/ASMTItem.h + OndselSolver/ASMTItemIJ.h + OndselSolver/ASMTJoint.h + OndselSolver/ASMTKinematicIJ.h + OndselSolver/ASMTMarker.h + OndselSolver/ASMTMotion.h + OndselSolver/ASMTNoRotationJoint.h + OndselSolver/ASMTPart.h + OndselSolver/ASMTPointInLineJoint.h + OndselSolver/ASMTPointInPlaneJoint.h + OndselSolver/ASMTPrincipalMassMarker.h + OndselSolver/ASMTRefCurve.h + OndselSolver/ASMTRefItem.h + OndselSolver/ASMTRefPoint.h + OndselSolver/ASMTRefSurface.h + OndselSolver/ASMTRevoluteJoint.h + OndselSolver/ASMTRotationalMotion.h + OndselSolver/ASMTSimulationParameters.h + OndselSolver/ASMTSpatialContainer.h + OndselSolver/ASMTSpatialItem.h + OndselSolver/ASMTSphericalJoint.h + OndselSolver/ASMTTime.h + OndselSolver/ASMTTranslationalJoint.h + OndselSolver/ASMTTranslationalMotion.h + OndselSolver/ASMTUniversalJoint.h + OndselSolver/AtPointConstraintIJ.h + OndselSolver/AtPointConstraintIqcJc.h + OndselSolver/AtPointConstraintIqcJqc.h + OndselSolver/AtPointConstraintIqctJqc.h + OndselSolver/AtPointJoint.h + OndselSolver/BasicIntegrator.h + OndselSolver/BasicQuasiIntegrator.h + OndselSolver/BasicUserFunction.h + OndselSolver/CADSystem.h + OndselSolver/CartesianFrame.h + OndselSolver/CompoundJoint.h + OndselSolver/Constant.h + OndselSolver/ConstantGravity.h + OndselSolver/ConstantVelocityJoint.h + OndselSolver/Constraint.h + OndselSolver/ConstraintIJ.h + OndselSolver/ConstVelConstraintIJ.h + OndselSolver/ConstVelConstraintIqcJc.h + OndselSolver/ConstVelConstraintIqcJqc.h + OndselSolver/corecrt_math_defines.h + OndselSolver/Cosine.h + OndselSolver/CREATE.h + OndselSolver/CylindricalJoint.h + OndselSolver/CylSphJoint.h + OndselSolver/DiagonalMatrix.h + OndselSolver/DifferenceOperator.h + OndselSolver/DifferentiatedGeneralSpline.h + OndselSolver/DirectionCosineConstraintIJ.h + OndselSolver/DirectionCosineConstraintIqcJc.h + OndselSolver/DirectionCosineConstraintIqcJqc.h + OndselSolver/DirectionCosineConstraintIqctJqc.h + OndselSolver/DirectionCosineIecJec.h + OndselSolver/DirectionCosineIeqcJec.h + OndselSolver/DirectionCosineIeqcJeqc.h + OndselSolver/DirectionCosineIeqctJeqc.h + OndselSolver/DiscontinuityError.h + OndselSolver/DispCompIecJecIe.h + OndselSolver/DispCompIecJecKec.h + OndselSolver/DispCompIecJecKeqc.h + OndselSolver/DispCompIecJecO.h + OndselSolver/DispCompIeqcJecIe.h + OndselSolver/DispCompIeqcJecKeqc.h + OndselSolver/DispCompIeqcJecO.h + OndselSolver/DispCompIeqcJeqcIe.h + OndselSolver/DispCompIeqcJeqcKeqc.h + OndselSolver/DispCompIeqcJeqcKeqct.h + OndselSolver/DispCompIeqcJeqcO.h + OndselSolver/DispCompIeqctJeqcIe.h + OndselSolver/DispCompIeqctJeqcKeqct.h + OndselSolver/DispCompIeqctJeqcO.h + OndselSolver/DistanceConstraintIJ.h + OndselSolver/DistanceConstraintIqcJc.h + OndselSolver/DistanceConstraintIqcJqc.h + OndselSolver/DistanceConstraintIqctJqc.h + OndselSolver/DistancexyConstraintIJ.h + OndselSolver/DistancexyConstraintIqcJc.h + OndselSolver/DistancexyConstraintIqcJqc.h + OndselSolver/DistIecJec.h + OndselSolver/DistIeqcJec.h + OndselSolver/DistIeqcJeqc.h + OndselSolver/DistIeqctJeqc.h + OndselSolver/DistxyIecJec.h + OndselSolver/DistxyIeqcJec.h + OndselSolver/DistxyIeqcJeqc.h + OndselSolver/DistxyIeqctJeqc.h + OndselSolver/EigenDecomposition.h + OndselSolver/EndFramec.h + OndselSolver/EndFrameqc.h + OndselSolver/EndFrameqct.h + OndselSolver/EndFrameqct2.h + OndselSolver/enum.h + OndselSolver/EulerAngles.h + OndselSolver/EulerAnglesDDot.h + OndselSolver/EulerAnglesDot.h + OndselSolver/EulerAngleszxz.h + OndselSolver/EulerAngleszxzDDot.h + OndselSolver/EulerAngleszxzDot.h + OndselSolver/EulerArray.h + OndselSolver/EulerConstraint.h + OndselSolver/EulerParameters.h + OndselSolver/EulerParametersDDot.h + OndselSolver/EulerParametersDot.h + OndselSolver/Exponential.h + OndselSolver/ExpressionX.h + OndselSolver/ExternalSystem.h + OndselSolver/FixedJoint.h + OndselSolver/ForceTorqueData.h + OndselSolver/ForceTorqueItem.h + OndselSolver/FullMotion.h + OndselSolver/FullRow.h + OndselSolver/Function.h + OndselSolver/FunctionFromData.h + OndselSolver/FunctionWithManyArgs.h + OndselSolver/FunctionX.h + OndselSolver/FunctionXcParameter.h + OndselSolver/FunctionXY.h + OndselSolver/GearConstraintIJ.h + OndselSolver/GearConstraintIqcJc.h + OndselSolver/GearConstraintIqcJqc.h + OndselSolver/GearJoint.h + OndselSolver/GEFullMat.h + OndselSolver/GEFullMatFullPv.h + OndselSolver/GEFullMatParPv.h + OndselSolver/GeneralSpline.h + OndselSolver/GESpMat.h + OndselSolver/GESpMatFullPv.h + OndselSolver/GESpMatFullPvPosIC.h + OndselSolver/GESpMatParPv.h + OndselSolver/GESpMatParPvMarko.h + OndselSolver/GESpMatParPvMarkoFast.h + OndselSolver/GESpMatParPvPrecise.h + OndselSolver/ICKineIntegrator.h + OndselSolver/IndependentVariable.h + OndselSolver/InLineJoint.h + OndselSolver/InPlaneJoint.h + OndselSolver/Integrator.h + OndselSolver/IntegratorInterface.h + OndselSolver/Item.h + OndselSolver/Joint.h + OndselSolver/KineIntegrator.h + OndselSolver/KinematicIeJe.h + OndselSolver/LDUFullMat.h + OndselSolver/LDUFullMatParPv.h + OndselSolver/LDUSpMat.h + OndselSolver/LDUSpMatParPv.h + OndselSolver/LDUSpMatParPvMarko.h + OndselSolver/LDUSpMatParPvPrecise.h + OndselSolver/LinearMultiStepMethod.h + OndselSolver/LineInPlaneJoint.h + OndselSolver/Ln.h + OndselSolver/Log10.h + OndselSolver/LogN.h + OndselSolver/MarkerFrame.h + OndselSolver/MatrixDecomposition.h + OndselSolver/MatrixGaussElimination.h + OndselSolver/MatrixLDU.h + OndselSolver/MatrixSolver.h + OndselSolver/MaximumIterationError.h + OndselSolver/MbdMath.h + OndselSolver/MBDynBlock.h + OndselSolver/MBDynBody.h + OndselSolver/MBDynControlData.h + OndselSolver/MBDynData.h + OndselSolver/MBDynElement.h + OndselSolver/MBDynInitialValue.h + OndselSolver/MBDynItem.h + OndselSolver/MBDynJoint.h + OndselSolver/MBDynMarker.h + OndselSolver/MBDynNode.h + OndselSolver/MBDynReference.h + OndselSolver/MBDynStructural.h + OndselSolver/MBDynSystem.h + OndselSolver/MomentOfInertiaSolver.h + OndselSolver/Negative.h + OndselSolver/NewtonRaphson.h + OndselSolver/NewtonRaphsonError.h + OndselSolver/NoRotationJoint.h + OndselSolver/NotKinematicError.h + OndselSolver/Numeric.h + OndselSolver/OrbitAnglezIecJec.h + OndselSolver/OrbitAnglezIeqcJec.h + OndselSolver/OrbitAnglezIeqcJeqc.h + OndselSolver/Orientation.h + OndselSolver/ParallelAxesJoint.h + OndselSolver/Part.h + OndselSolver/PartFrame.h + OndselSolver/PerpendicularJoint.h + OndselSolver/PlanarJoint.h + OndselSolver/PointInLineJoint.h + OndselSolver/PointInPlaneJoint.h + OndselSolver/PosICKineNewtonRaphson.h + OndselSolver/PosICNewtonRaphson.h + OndselSolver/PosKineNewtonRaphson.h + OndselSolver/PosNewtonRaphson.h + OndselSolver/PosVelAccData.h + OndselSolver/Power.h + OndselSolver/PrescribedMotion.h + OndselSolver/Product.h + OndselSolver/QuasiIntegrator.h + OndselSolver/RackPinConstraintIJ.h + OndselSolver/RackPinConstraintIqcJc.h + OndselSolver/RackPinConstraintIqcJqc.h + OndselSolver/RackPinJoint.h + OndselSolver/Reciprocal.h + OndselSolver/RedundantConstraint.h + OndselSolver/resource.h + OndselSolver/RevCylJoint.h + OndselSolver/RevoluteJoint.h + OndselSolver/ScalarNewtonRaphson.h + OndselSolver/ScrewConstraintIJ.h + OndselSolver/ScrewConstraintIqcJc.h + OndselSolver/ScrewConstraintIqcJqc.h + OndselSolver/ScrewJoint.h + OndselSolver/SimulationStoppingError.h + OndselSolver/Sine.h + OndselSolver/SingularMatrixError.h + OndselSolver/Solver.h + OndselSolver/SparseColumn.h + OndselSolver/SparseMatrix.h + OndselSolver/SparseRow.h + OndselSolver/SparseVector.h + OndselSolver/SphericalJoint.h + OndselSolver/SphSphJoint.h + OndselSolver/StableBackwardDifference.h + OndselSolver/StateData.h + OndselSolver/Sum.h + OndselSolver/Symbolic.h + OndselSolver/SymbolicParser.h + OndselSolver/SyntaxError.h + OndselSolver/System.h + OndselSolver/SystemNewtonRaphson.h + OndselSolver/SystemSolver.h + OndselSolver/Time.h + OndselSolver/TooManyTriesError.h + OndselSolver/TooSmallStepSizeError.h + OndselSolver/Translation.h + OndselSolver/TranslationalJoint.h + OndselSolver/TranslationConstraintIJ.h + OndselSolver/TranslationConstraintIqcJc.h + OndselSolver/TranslationConstraintIqcJqc.h + OndselSolver/TranslationConstraintIqctJqc.h + OndselSolver/Units.h + OndselSolver/UniversalJoint.h + OndselSolver/UserFunction.h + OndselSolver/Variable.h + OndselSolver/VectorNewtonRaphson.h + OndselSolver/VelICKineSolver.h + OndselSolver/VelICSolver.h + OndselSolver/VelKineSolver.h + OndselSolver/VelSolver.h + OndselSolver/ZRotation.h + OndselSolver/ZTranslation.h ) -#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_EXPORT}) -#target_sources(OndselSolver PRIVATE ${ONDSELSOLVER_HEADERS}) +target_sources(OndselSolver PRIVATE + "${ONDSELSOLVER_SRC}" + "${ONDSELSOLVER_HEADERS}") + +set_target_properties(OndselSolver + PROPERTIES VERSION ${PROJECT_VERSION} + SOVERSION 1 + PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}" +) configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) install(TARGETS OndselSolver LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) - -# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) - install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) - From 84ec3cf5e10fe452457dcc25f38dd14d9b5f39d2 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Mon, 6 Nov 2023 14:43:29 -0600 Subject: [PATCH 11/17] added target_include_directories --- CMakeLists.txt | 592 +------------------------------------------------ 1 file changed, 4 insertions(+), 588 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7ce907..ee3c9b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,594 +7,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) include(GNUInstallDirs) -add_library(OndselSolver STATIC) - -set(ONDSELSOLVER_SRC - OndselSolver/Array.cpp - OndselSolver/FullVector.cpp - OndselSolver/RowTypeMatrix.cpp - OndselSolver/FullColumn.cpp - OndselSolver/FullMatrix.cpp - OndselSolver/FullRow.cpp - OndselSolver/Abs.cpp - OndselSolver/AbsConstraint.cpp - OndselSolver/AccICKineNewtonRaphson.cpp - OndselSolver/AccICNewtonRaphson.cpp - OndselSolver/AccKineNewtonRaphson.cpp - OndselSolver/AccNewtonRaphson.cpp - OndselSolver/AngleJoint.cpp - OndselSolver/AngleZIecJec.cpp - OndselSolver/AngleZIeqcJec.cpp - OndselSolver/AngleZIeqcJeqc.cpp - OndselSolver/AnyGeneralSpline.cpp - OndselSolver/AnyPosICNewtonRaphson.cpp - OndselSolver/ArcSine.cpp - OndselSolver/ArcTan.cpp - OndselSolver/ArcTan2.cpp - OndselSolver/ASMTAnimationParameters.cpp - OndselSolver/ASMTAssembly.cpp - OndselSolver/ASMTConstantGravity.cpp - OndselSolver/ASMTConstraintSet.cpp - OndselSolver/ASMTCylindricalJoint.cpp - OndselSolver/ASMTExtrusion.cpp - OndselSolver/ASMTFixedJoint.cpp - OndselSolver/ASMTForceTorque.cpp - OndselSolver/ASMTGeneralMotion.cpp - OndselSolver/ASMTItem.cpp - OndselSolver/ASMTItemIJ.cpp - OndselSolver/ASMTJoint.cpp - OndselSolver/ASMTKinematicIJ.cpp - OndselSolver/ASMTMarker.cpp - OndselSolver/ASMTMotion.cpp - OndselSolver/ASMTNoRotationJoint.cpp - OndselSolver/ASMTPart.cpp - OndselSolver/ASMTPointInLineJoint.cpp - OndselSolver/ASMTPointInPlaneJoint.cpp - OndselSolver/ASMTPrincipalMassMarker.cpp - OndselSolver/ASMTRefCurve.cpp - OndselSolver/ASMTRefItem.cpp - OndselSolver/ASMTRefPoint.cpp - OndselSolver/ASMTRefSurface.cpp - OndselSolver/ASMTRevoluteJoint.cpp - OndselSolver/ASMTRotationalMotion.cpp - OndselSolver/ASMTSimulationParameters.cpp - OndselSolver/ASMTSpatialContainer.cpp - OndselSolver/ASMTSpatialItem.cpp - OndselSolver/ASMTSphericalJoint.cpp - OndselSolver/ASMTTime.cpp - OndselSolver/ASMTTranslationalJoint.cpp - OndselSolver/ASMTTranslationalMotion.cpp - OndselSolver/ASMTUniversalJoint.cpp - OndselSolver/AtPointConstraintIJ.cpp - OndselSolver/AtPointConstraintIqcJc.cpp - OndselSolver/AtPointConstraintIqcJqc.cpp - OndselSolver/AtPointConstraintIqctJqc.cpp - OndselSolver/AtPointJoint.cpp - OndselSolver/BasicIntegrator.cpp - OndselSolver/BasicQuasiIntegrator.cpp - OndselSolver/BasicUserFunction.cpp - OndselSolver/CADSystem.cpp - OndselSolver/CartesianFrame.cpp - OndselSolver/CompoundJoint.cpp - OndselSolver/Constant.cpp - OndselSolver/ConstantGravity.cpp - OndselSolver/ConstantVelocityJoint.cpp - OndselSolver/Constraint.cpp - OndselSolver/ConstraintIJ.cpp - OndselSolver/ConstVelConstraintIJ.cpp - OndselSolver/ConstVelConstraintIqcJc.cpp - OndselSolver/ConstVelConstraintIqcJqc.cpp - OndselSolver/Cosine.cpp - OndselSolver/CREATE.cpp - OndselSolver/CylindricalJoint.cpp - OndselSolver/CylSphJoint.cpp - OndselSolver/DiagonalMatrix.cpp - OndselSolver/DifferenceOperator.cpp - OndselSolver/DifferentiatedGeneralSpline.cpp - OndselSolver/DirectionCosineConstraintIJ.cpp - OndselSolver/DirectionCosineConstraintIqcJc.cpp - OndselSolver/DirectionCosineConstraintIqcJqc.cpp - OndselSolver/DirectionCosineConstraintIqctJqc.cpp - OndselSolver/DirectionCosineIecJec.cpp - OndselSolver/DirectionCosineIeqcJec.cpp - OndselSolver/DirectionCosineIeqcJeqc.cpp - OndselSolver/DirectionCosineIeqctJeqc.cpp - OndselSolver/DiscontinuityError.cpp - OndselSolver/DispCompIecJecIe.cpp - OndselSolver/DispCompIecJecKec.cpp - OndselSolver/DispCompIecJecKeqc.cpp - OndselSolver/DispCompIecJecO.cpp - OndselSolver/DispCompIeqcJecIe.cpp - OndselSolver/DispCompIeqcJecKeqc.cpp - OndselSolver/DispCompIeqcJecO.cpp - OndselSolver/DispCompIeqcJeqcIe.cpp - OndselSolver/DispCompIeqcJeqcKeqc.cpp - OndselSolver/DispCompIeqcJeqcKeqct.cpp - OndselSolver/DispCompIeqcJeqcO.cpp - OndselSolver/DispCompIeqctJeqcIe.cpp - OndselSolver/DispCompIeqctJeqcKeqct.cpp - OndselSolver/DispCompIeqctJeqcO.cpp - OndselSolver/DistanceConstraintIJ.cpp - OndselSolver/DistanceConstraintIqcJc.cpp - OndselSolver/DistanceConstraintIqcJqc.cpp - OndselSolver/DistanceConstraintIqctJqc.cpp - OndselSolver/DistancexyConstraintIJ.cpp - OndselSolver/DistancexyConstraintIqcJc.cpp - OndselSolver/DistancexyConstraintIqcJqc.cpp - OndselSolver/DistIecJec.cpp - OndselSolver/DistIeqcJec.cpp - OndselSolver/DistIeqcJeqc.cpp - OndselSolver/DistIeqctJeqc.cpp - OndselSolver/DistxyIecJec.cpp - OndselSolver/DistxyIeqcJec.cpp - OndselSolver/DistxyIeqcJeqc.cpp - OndselSolver/DistxyIeqctJeqc.cpp - OndselSolver/EigenDecomposition.cpp - OndselSolver/EndFramec.cpp - OndselSolver/EndFrameqc.cpp - OndselSolver/EndFrameqct.cpp - OndselSolver/EndFrameqct2.cpp - OndselSolver/EulerAngles.cpp - OndselSolver/EulerAnglesDDot.cpp - OndselSolver/EulerAnglesDot.cpp - OndselSolver/EulerAngleszxz.cpp - OndselSolver/EulerAngleszxzDDot.cpp - OndselSolver/EulerAngleszxzDot.cpp - OndselSolver/EulerArray.cpp - OndselSolver/EulerConstraint.cpp - OndselSolver/EulerParameters.cpp - OndselSolver/EulerParametersDDot.cpp - OndselSolver/EulerParametersDot.cpp - OndselSolver/Exponential.cpp - OndselSolver/ExpressionX.cpp - OndselSolver/ExternalSystem.cpp - OndselSolver/FixedJoint.cpp - OndselSolver/ForceTorqueData.cpp - OndselSolver/ForceTorqueItem.cpp - OndselSolver/FullMotion.cpp - OndselSolver/Function.cpp - OndselSolver/FunctionFromData.cpp - OndselSolver/FunctionWithManyArgs.cpp - OndselSolver/FunctionX.cpp - OndselSolver/FunctionXcParameter.cpp - OndselSolver/FunctionXY.cpp - OndselSolver/GearConstraintIJ.cpp - OndselSolver/GearConstraintIqcJc.cpp - OndselSolver/GearConstraintIqcJqc.cpp - OndselSolver/GearJoint.cpp - OndselSolver/GEFullMat.cpp - OndselSolver/GEFullMatFullPv.cpp - OndselSolver/GEFullMatParPv.cpp - OndselSolver/GeneralSpline.cpp - OndselSolver/GESpMat.cpp - OndselSolver/GESpMatFullPv.cpp - OndselSolver/GESpMatFullPvPosIC.cpp - OndselSolver/GESpMatParPv.cpp - OndselSolver/GESpMatParPvMarko.cpp - OndselSolver/GESpMatParPvMarkoFast.cpp - OndselSolver/GESpMatParPvPrecise.cpp - OndselSolver/ICKineIntegrator.cpp - OndselSolver/IndependentVariable.cpp - OndselSolver/InLineJoint.cpp - OndselSolver/InPlaneJoint.cpp - OndselSolver/Integrator.cpp - OndselSolver/IntegratorInterface.cpp - OndselSolver/Item.cpp - OndselSolver/Joint.cpp - OndselSolver/KineIntegrator.cpp - OndselSolver/KinematicIeJe.cpp - OndselSolver/LDUFullMat.cpp - OndselSolver/LDUFullMatParPv.cpp - OndselSolver/LDUSpMat.cpp - OndselSolver/LDUSpMatParPv.cpp - OndselSolver/LDUSpMatParPvMarko.cpp - OndselSolver/LDUSpMatParPvPrecise.cpp - OndselSolver/LinearMultiStepMethod.cpp - OndselSolver/LineInPlaneJoint.cpp - OndselSolver/Ln.cpp - OndselSolver/Log10.cpp - OndselSolver/LogN.cpp - OndselSolver/MarkerFrame.cpp - OndselSolver/MatrixDecomposition.cpp - OndselSolver/MatrixGaussElimination.cpp - OndselSolver/MatrixLDU.cpp - OndselSolver/MatrixSolver.cpp - OndselSolver/MaximumIterationError.cpp - OndselSolver/MbdMath.cpp - OndselSolver/MBDynBlock.cpp - OndselSolver/MBDynBody.cpp - OndselSolver/MBDynControlData.cpp - OndselSolver/MBDynData.cpp - OndselSolver/MBDynElement.cpp - OndselSolver/MBDynInitialValue.cpp - OndselSolver/MBDynItem.cpp - OndselSolver/MBDynJoint.cpp - OndselSolver/MBDynMarker.cpp - OndselSolver/MBDynNode.cpp - OndselSolver/MBDynReference.cpp - OndselSolver/MBDynStructural.cpp - OndselSolver/MBDynSystem.cpp - OndselSolver/MomentOfInertiaSolver.cpp - OndselSolver/Negative.cpp - OndselSolver/NewtonRaphson.cpp - OndselSolver/NewtonRaphsonError.cpp - OndselSolver/NoRotationJoint.cpp - OndselSolver/NotKinematicError.cpp - OndselSolver/Numeric.cpp - OndselSolver/OrbitAnglezIecJec.cpp - OndselSolver/OrbitAnglezIeqcJec.cpp - OndselSolver/OrbitAnglezIeqcJeqc.cpp - OndselSolver/Orientation.cpp - OndselSolver/ParallelAxesJoint.cpp - OndselSolver/Part.cpp - OndselSolver/PartFrame.cpp - OndselSolver/PerpendicularJoint.cpp - OndselSolver/PlanarJoint.cpp - OndselSolver/PointInLineJoint.cpp - OndselSolver/PointInPlaneJoint.cpp - OndselSolver/PosICKineNewtonRaphson.cpp - OndselSolver/PosICNewtonRaphson.cpp - OndselSolver/PosKineNewtonRaphson.cpp - OndselSolver/PosNewtonRaphson.cpp - OndselSolver/PosVelAccData.cpp - OndselSolver/Power.cpp - OndselSolver/PrescribedMotion.cpp - OndselSolver/Product.cpp - OndselSolver/QuasiIntegrator.cpp - OndselSolver/RackPinConstraintIJ.cpp - OndselSolver/RackPinConstraintIqcJc.cpp - OndselSolver/RackPinConstraintIqcJqc.cpp - OndselSolver/RackPinJoint.cpp - OndselSolver/Reciprocal.cpp - OndselSolver/RedundantConstraint.cpp - OndselSolver/RevCylJoint.cpp - OndselSolver/RevoluteJoint.cpp - OndselSolver/ScalarNewtonRaphson.cpp - OndselSolver/ScrewConstraintIJ.cpp - OndselSolver/ScrewConstraintIqcJc.cpp - OndselSolver/ScrewConstraintIqcJqc.cpp - OndselSolver/ScrewJoint.cpp - OndselSolver/SimulationStoppingError.cpp - OndselSolver/Sine.cpp - OndselSolver/SingularMatrixError.cpp - OndselSolver/Solver.cpp - OndselSolver/SparseColumn.cpp - OndselSolver/SparseMatrix.cpp - OndselSolver/SparseRow.cpp - OndselSolver/SparseVector.cpp - OndselSolver/SphericalJoint.cpp - OndselSolver/SphSphJoint.cpp - OndselSolver/StableBackwardDifference.cpp - OndselSolver/StateData.cpp - OndselSolver/Sum.cpp - OndselSolver/Symbolic.cpp - OndselSolver/SymbolicParser.cpp - OndselSolver/SyntaxError.cpp - OndselSolver/System.cpp - OndselSolver/SystemNewtonRaphson.cpp - OndselSolver/SystemSolver.cpp - OndselSolver/Time.cpp - OndselSolver/TooManyTriesError.cpp - OndselSolver/TooSmallStepSizeError.cpp - OndselSolver/Translation.cpp - OndselSolver/TranslationalJoint.cpp - OndselSolver/TranslationConstraintIJ.cpp - OndselSolver/TranslationConstraintIqcJc.cpp - OndselSolver/TranslationConstraintIqcJqc.cpp - OndselSolver/TranslationConstraintIqctJqc.cpp - OndselSolver/Units.cpp - OndselSolver/UniversalJoint.cpp - OndselSolver/UserFunction.cpp - OndselSolver/Variable.cpp - OndselSolver/VectorNewtonRaphson.cpp - OndselSolver/VelICKineSolver.cpp - OndselSolver/VelICSolver.cpp - OndselSolver/VelKineSolver.cpp - OndselSolver/VelSolver.cpp - OndselSolver/ZRotation.cpp - OndselSolver/ZTranslation.cpp -) - -set(ONDSELSOLVER_HEADERS - OndselSolver/Array.h - OndselSolver/FullVector.h - OndselSolver/RowTypeMatrix.h - OndselSolver/FullRow.h - OndselSolver/FullColumn.h - OndselSolver/FullMatrix.h - OndselSolver/Abs.h - OndselSolver/AbsConstraint.h - OndselSolver/AccICKineNewtonRaphson.h - OndselSolver/AccICNewtonRaphson.h - OndselSolver/AccKineNewtonRaphson.h - OndselSolver/AccNewtonRaphson.h - OndselSolver/AngleJoint.h - OndselSolver/AngleZIecJec.h - OndselSolver/AngleZIeqcJec.h - OndselSolver/AngleZIeqcJeqc.h - OndselSolver/AnyGeneralSpline.h - OndselSolver/AnyPosICNewtonRaphson.h - OndselSolver/APIExport.h - OndselSolver/ArcSine.h - OndselSolver/ArcTan.h - OndselSolver/ArcTan2.h - OndselSolver/ASMTAnimationParameters.h - OndselSolver/ASMTAssembly.h - OndselSolver/ASMTConstantGravity.h - OndselSolver/ASMTConstraintSet.h - OndselSolver/ASMTCylindricalJoint.h - OndselSolver/ASMTExtrusion.h - OndselSolver/ASMTFixedJoint.h - OndselSolver/ASMTForceTorque.h - OndselSolver/ASMTGeneralMotion.h - OndselSolver/ASMTItem.h - OndselSolver/ASMTItemIJ.h - OndselSolver/ASMTJoint.h - OndselSolver/ASMTKinematicIJ.h - OndselSolver/ASMTMarker.h - OndselSolver/ASMTMotion.h - OndselSolver/ASMTNoRotationJoint.h - OndselSolver/ASMTPart.h - OndselSolver/ASMTPointInLineJoint.h - OndselSolver/ASMTPointInPlaneJoint.h - OndselSolver/ASMTPrincipalMassMarker.h - OndselSolver/ASMTRefCurve.h - OndselSolver/ASMTRefItem.h - OndselSolver/ASMTRefPoint.h - OndselSolver/ASMTRefSurface.h - OndselSolver/ASMTRevoluteJoint.h - OndselSolver/ASMTRotationalMotion.h - OndselSolver/ASMTSimulationParameters.h - OndselSolver/ASMTSpatialContainer.h - OndselSolver/ASMTSpatialItem.h - OndselSolver/ASMTSphericalJoint.h - OndselSolver/ASMTTime.h - OndselSolver/ASMTTranslationalJoint.h - OndselSolver/ASMTTranslationalMotion.h - OndselSolver/ASMTUniversalJoint.h - OndselSolver/AtPointConstraintIJ.h - OndselSolver/AtPointConstraintIqcJc.h - OndselSolver/AtPointConstraintIqcJqc.h - OndselSolver/AtPointConstraintIqctJqc.h - OndselSolver/AtPointJoint.h - OndselSolver/BasicIntegrator.h - OndselSolver/BasicQuasiIntegrator.h - OndselSolver/BasicUserFunction.h - OndselSolver/CADSystem.h - OndselSolver/CartesianFrame.h - OndselSolver/CompoundJoint.h - OndselSolver/Constant.h - OndselSolver/ConstantGravity.h - OndselSolver/ConstantVelocityJoint.h - OndselSolver/Constraint.h - OndselSolver/ConstraintIJ.h - OndselSolver/ConstVelConstraintIJ.h - OndselSolver/ConstVelConstraintIqcJc.h - OndselSolver/ConstVelConstraintIqcJqc.h - OndselSolver/corecrt_math_defines.h - OndselSolver/Cosine.h - OndselSolver/CREATE.h - OndselSolver/CylindricalJoint.h - OndselSolver/CylSphJoint.h - OndselSolver/DiagonalMatrix.h - OndselSolver/DifferenceOperator.h - OndselSolver/DifferentiatedGeneralSpline.h - OndselSolver/DirectionCosineConstraintIJ.h - OndselSolver/DirectionCosineConstraintIqcJc.h - OndselSolver/DirectionCosineConstraintIqcJqc.h - OndselSolver/DirectionCosineConstraintIqctJqc.h - OndselSolver/DirectionCosineIecJec.h - OndselSolver/DirectionCosineIeqcJec.h - OndselSolver/DirectionCosineIeqcJeqc.h - OndselSolver/DirectionCosineIeqctJeqc.h - OndselSolver/DiscontinuityError.h - OndselSolver/DispCompIecJecIe.h - OndselSolver/DispCompIecJecKec.h - OndselSolver/DispCompIecJecKeqc.h - OndselSolver/DispCompIecJecO.h - OndselSolver/DispCompIeqcJecIe.h - OndselSolver/DispCompIeqcJecKeqc.h - OndselSolver/DispCompIeqcJecO.h - OndselSolver/DispCompIeqcJeqcIe.h - OndselSolver/DispCompIeqcJeqcKeqc.h - OndselSolver/DispCompIeqcJeqcKeqct.h - OndselSolver/DispCompIeqcJeqcO.h - OndselSolver/DispCompIeqctJeqcIe.h - OndselSolver/DispCompIeqctJeqcKeqct.h - OndselSolver/DispCompIeqctJeqcO.h - OndselSolver/DistanceConstraintIJ.h - OndselSolver/DistanceConstraintIqcJc.h - OndselSolver/DistanceConstraintIqcJqc.h - OndselSolver/DistanceConstraintIqctJqc.h - OndselSolver/DistancexyConstraintIJ.h - OndselSolver/DistancexyConstraintIqcJc.h - OndselSolver/DistancexyConstraintIqcJqc.h - OndselSolver/DistIecJec.h - OndselSolver/DistIeqcJec.h - OndselSolver/DistIeqcJeqc.h - OndselSolver/DistIeqctJeqc.h - OndselSolver/DistxyIecJec.h - OndselSolver/DistxyIeqcJec.h - OndselSolver/DistxyIeqcJeqc.h - OndselSolver/DistxyIeqctJeqc.h - OndselSolver/EigenDecomposition.h - OndselSolver/EndFramec.h - OndselSolver/EndFrameqc.h - OndselSolver/EndFrameqct.h - OndselSolver/EndFrameqct2.h - OndselSolver/enum.h - OndselSolver/EulerAngles.h - OndselSolver/EulerAnglesDDot.h - OndselSolver/EulerAnglesDot.h - OndselSolver/EulerAngleszxz.h - OndselSolver/EulerAngleszxzDDot.h - OndselSolver/EulerAngleszxzDot.h - OndselSolver/EulerArray.h - OndselSolver/EulerConstraint.h - OndselSolver/EulerParameters.h - OndselSolver/EulerParametersDDot.h - OndselSolver/EulerParametersDot.h - OndselSolver/Exponential.h - OndselSolver/ExpressionX.h - OndselSolver/ExternalSystem.h - OndselSolver/FixedJoint.h - OndselSolver/ForceTorqueData.h - OndselSolver/ForceTorqueItem.h - OndselSolver/FullMotion.h - OndselSolver/FullRow.h - OndselSolver/Function.h - OndselSolver/FunctionFromData.h - OndselSolver/FunctionWithManyArgs.h - OndselSolver/FunctionX.h - OndselSolver/FunctionXcParameter.h - OndselSolver/FunctionXY.h - OndselSolver/GearConstraintIJ.h - OndselSolver/GearConstraintIqcJc.h - OndselSolver/GearConstraintIqcJqc.h - OndselSolver/GearJoint.h - OndselSolver/GEFullMat.h - OndselSolver/GEFullMatFullPv.h - OndselSolver/GEFullMatParPv.h - OndselSolver/GeneralSpline.h - OndselSolver/GESpMat.h - OndselSolver/GESpMatFullPv.h - OndselSolver/GESpMatFullPvPosIC.h - OndselSolver/GESpMatParPv.h - OndselSolver/GESpMatParPvMarko.h - OndselSolver/GESpMatParPvMarkoFast.h - OndselSolver/GESpMatParPvPrecise.h - OndselSolver/ICKineIntegrator.h - OndselSolver/IndependentVariable.h - OndselSolver/InLineJoint.h - OndselSolver/InPlaneJoint.h - OndselSolver/Integrator.h - OndselSolver/IntegratorInterface.h - OndselSolver/Item.h - OndselSolver/Joint.h - OndselSolver/KineIntegrator.h - OndselSolver/KinematicIeJe.h - OndselSolver/LDUFullMat.h - OndselSolver/LDUFullMatParPv.h - OndselSolver/LDUSpMat.h - OndselSolver/LDUSpMatParPv.h - OndselSolver/LDUSpMatParPvMarko.h - OndselSolver/LDUSpMatParPvPrecise.h - OndselSolver/LinearMultiStepMethod.h - OndselSolver/LineInPlaneJoint.h - OndselSolver/Ln.h - OndselSolver/Log10.h - OndselSolver/LogN.h - OndselSolver/MarkerFrame.h - OndselSolver/MatrixDecomposition.h - OndselSolver/MatrixGaussElimination.h - OndselSolver/MatrixLDU.h - OndselSolver/MatrixSolver.h - OndselSolver/MaximumIterationError.h - OndselSolver/MbdMath.h - OndselSolver/MBDynBlock.h - OndselSolver/MBDynBody.h - OndselSolver/MBDynControlData.h - OndselSolver/MBDynData.h - OndselSolver/MBDynElement.h - OndselSolver/MBDynInitialValue.h - OndselSolver/MBDynItem.h - OndselSolver/MBDynJoint.h - OndselSolver/MBDynMarker.h - OndselSolver/MBDynNode.h - OndselSolver/MBDynReference.h - OndselSolver/MBDynStructural.h - OndselSolver/MBDynSystem.h - OndselSolver/MomentOfInertiaSolver.h - OndselSolver/Negative.h - OndselSolver/NewtonRaphson.h - OndselSolver/NewtonRaphsonError.h - OndselSolver/NoRotationJoint.h - OndselSolver/NotKinematicError.h - OndselSolver/Numeric.h - OndselSolver/OrbitAnglezIecJec.h - OndselSolver/OrbitAnglezIeqcJec.h - OndselSolver/OrbitAnglezIeqcJeqc.h - OndselSolver/Orientation.h - OndselSolver/ParallelAxesJoint.h - OndselSolver/Part.h - OndselSolver/PartFrame.h - OndselSolver/PerpendicularJoint.h - OndselSolver/PlanarJoint.h - OndselSolver/PointInLineJoint.h - OndselSolver/PointInPlaneJoint.h - OndselSolver/PosICKineNewtonRaphson.h - OndselSolver/PosICNewtonRaphson.h - OndselSolver/PosKineNewtonRaphson.h - OndselSolver/PosNewtonRaphson.h - OndselSolver/PosVelAccData.h - OndselSolver/Power.h - OndselSolver/PrescribedMotion.h - OndselSolver/Product.h - OndselSolver/QuasiIntegrator.h - OndselSolver/RackPinConstraintIJ.h - OndselSolver/RackPinConstraintIqcJc.h - OndselSolver/RackPinConstraintIqcJqc.h - OndselSolver/RackPinJoint.h - OndselSolver/Reciprocal.h - OndselSolver/RedundantConstraint.h - OndselSolver/resource.h - OndselSolver/RevCylJoint.h - OndselSolver/RevoluteJoint.h - OndselSolver/ScalarNewtonRaphson.h - OndselSolver/ScrewConstraintIJ.h - OndselSolver/ScrewConstraintIqcJc.h - OndselSolver/ScrewConstraintIqcJqc.h - OndselSolver/ScrewJoint.h - OndselSolver/SimulationStoppingError.h - OndselSolver/Sine.h - OndselSolver/SingularMatrixError.h - OndselSolver/Solver.h - OndselSolver/SparseColumn.h - OndselSolver/SparseMatrix.h - OndselSolver/SparseRow.h - OndselSolver/SparseVector.h - OndselSolver/SphericalJoint.h - OndselSolver/SphSphJoint.h - OndselSolver/StableBackwardDifference.h - OndselSolver/StateData.h - OndselSolver/Sum.h - OndselSolver/Symbolic.h - OndselSolver/SymbolicParser.h - OndselSolver/SyntaxError.h - OndselSolver/System.h - OndselSolver/SystemNewtonRaphson.h - OndselSolver/SystemSolver.h - OndselSolver/Time.h - OndselSolver/TooManyTriesError.h - OndselSolver/TooSmallStepSizeError.h - OndselSolver/Translation.h - OndselSolver/TranslationalJoint.h - OndselSolver/TranslationConstraintIJ.h - OndselSolver/TranslationConstraintIqcJc.h - OndselSolver/TranslationConstraintIqcJqc.h - OndselSolver/TranslationConstraintIqctJqc.h - OndselSolver/Units.h - OndselSolver/UniversalJoint.h - OndselSolver/UserFunction.h - OndselSolver/Variable.h - OndselSolver/VectorNewtonRaphson.h - OndselSolver/VelICKineSolver.h - OndselSolver/VelICSolver.h - OndselSolver/VelKineSolver.h - OndselSolver/VelSolver.h - OndselSolver/ZRotation.h - OndselSolver/ZTranslation.h -) - -target_sources(OndselSolver PRIVATE - "${ONDSELSOLVER_SRC}" - "${ONDSELSOLVER_HEADERS}") - -set_target_properties(OndselSolver - PROPERTIES VERSION ${PROJECT_VERSION} - SOVERSION 1 - PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}" -) +file(GLOB ONDSELSOLVER_SOURCES "OndselSolver/*.cpp") +file(GLOB ONDSELSOLVER_HEADERS "OndselSolver/*.h") +add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) +target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) install(TARGETS OndselSolver From 87bd168b507f37298b0cb9f3de57a5ab64f9cc18 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Mon, 6 Nov 2023 16:31:57 -0600 Subject: [PATCH 12/17] works locally, but imagine it breaks elsewhere --- CMakeLists.txt | 17 ++------ OndselSolver/CMakeLists.txt | 22 ++++++++++ OndselSolver/EulerAngles.h | 4 +- OndselSolver/MBDynNode.cpp | 47 +++++++++++----------- {OndselSolver => testapp}/00backhoe.asmt | 0 testapp/CMakeLists.txt | 10 +++++ {OndselSolver => testapp}/OndselSolver.cpp | 42 +++++++++---------- {OndselSolver => testapp}/OndselSolver.h | 0 {OndselSolver => testapp}/assembly.asmt | 0 {OndselSolver => testapp}/circular.asmt | 0 {OndselSolver => testapp}/cirpendu.asmt | 0 {OndselSolver => testapp}/engine1.asmt | 0 {OndselSolver => testapp}/fourbar.asmt | 0 {OndselSolver => testapp}/fourbot.asmt | 0 {OndselSolver => testapp}/gyro.asmt | 0 {OndselSolver => testapp}/piston.asmt | 0 {OndselSolver => testapp}/robot.asmt | 0 {OndselSolver => testapp}/wobpump.asmt | 0 18 files changed, 83 insertions(+), 59 deletions(-) create mode 100644 OndselSolver/CMakeLists.txt rename {OndselSolver => testapp}/00backhoe.asmt (100%) create mode 100644 testapp/CMakeLists.txt rename {OndselSolver => testapp}/OndselSolver.cpp (59%) rename {OndselSolver => testapp}/OndselSolver.h (100%) rename {OndselSolver => testapp}/assembly.asmt (100%) rename {OndselSolver => testapp}/circular.asmt (100%) rename {OndselSolver => testapp}/cirpendu.asmt (100%) rename {OndselSolver => testapp}/engine1.asmt (100%) rename {OndselSolver => testapp}/fourbar.asmt (100%) rename {OndselSolver => testapp}/fourbot.asmt (100%) rename {OndselSolver => testapp}/gyro.asmt (100%) rename {OndselSolver => testapp}/piston.asmt (100%) rename {OndselSolver => testapp}/robot.asmt (100%) rename {OndselSolver => testapp}/wobpump.asmt (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee3c9b8..0533690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,9 @@ cmake_minimum_required(VERSION 3.16) -project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -include(GNUInstallDirs) - -file(GLOB ONDSELSOLVER_SOURCES "OndselSolver/*.cpp") -file(GLOB ONDSELSOLVER_HEADERS "OndselSolver/*.h") -add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) -target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) - -configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) -install(TARGETS OndselSolver - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) -install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) +add_subdirectory(OndselSolver) +add_subdirectory(testapp) diff --git a/OndselSolver/CMakeLists.txt b/OndselSolver/CMakeLists.txt new file mode 100644 index 0000000..73738f7 --- /dev/null +++ b/OndselSolver/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.16) + +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +include(GNUInstallDirs) + +file(GLOB ONDSELSOLVER_SOURCES "*.cpp") +file(GLOB ONDSELSOLVER_HEADERS "*.h") +add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) +target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}) + +#target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) + +#configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) +#install(TARGETS OndselSolver +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) +#install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc +# DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index ef3a678..1a8fa81 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -33,7 +33,9 @@ namespace MbD { std::shared_ptr> rotOrder; FColFMatDsptr cA; FMatDsptr aA; - }; +// // NOTE: do NOT instantiate EulerAngles as a whole as differentiateWRT breaks +// template <> +// void EulerAngles::setRotOrder(int, int, int); } diff --git a/OndselSolver/MBDynNode.cpp b/OndselSolver/MBDynNode.cpp index 675f5fa..49f114a 100644 --- a/OndselSolver/MBDynNode.cpp +++ b/OndselSolver/MBDynNode.cpp @@ -20,28 +20,29 @@ void MbD::MBDynNode::outputLine(int i, std::ostream& os) auto x = asmtPart->xs->at(i); auto y = asmtPart->ys->at(i); auto z = asmtPart->zs->at(i); - auto bryantAngles = std::make_shared>(); - bryantAngles->setRotOrder(1, 2, 3); - bryantAngles->at(0) = asmtPart->bryxs->at(i); - bryantAngles->at(1) = asmtPart->bryys->at(i); - bryantAngles->at(2) = asmtPart->bryzs->at(i); - bryantAngles->calc(); - auto aA = bryantAngles->aA; - auto vx = asmtPart->vxs->at(i); - auto vy = asmtPart->vys->at(i); - auto vz = asmtPart->vzs->at(i); - auto omex = asmtPart->omexs->at(i); - auto omey = asmtPart->omeys->at(i); - auto omez = asmtPart->omezs->at(i); - os << id << " "; - os << x << " " << y << " " << z << " "; - auto row = aA->at(0); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - row = aA->at(1); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - row = aA->at(2); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - os << vx << " " << vy << " " << vz << " "; - os << omex << " " << omey << " " << omez << " "; + // TODO: undo the breaking I just did on purpose +// auto bryantAngles = std::make_shared>(); +// bryantAngles->setRotOrder(1, 2, 3); +// bryantAngles->at(0) = asmtPart->bryxs->at(i); +// bryantAngles->at(1) = asmtPart->bryys->at(i); +// bryantAngles->at(2) = asmtPart->bryzs->at(i); +// bryantAngles->calc(); +// auto aA = bryantAngles->aA; +// auto vx = asmtPart->vxs->at(i); +// auto vy = asmtPart->vys->at(i); +// auto vz = asmtPart->vzs->at(i); +// auto omex = asmtPart->omexs->at(i); +// auto omey = asmtPart->omeys->at(i); +// auto omez = asmtPart->omezs->at(i); +// os << id << " "; +// os << x << " " << y << " " << z << " "; +// auto row = aA->at(0); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// row = aA->at(1); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// row = aA->at(2); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// os << vx << " " << vy << " " << vz << " "; +// os << omex << " " << omey << " " << omez << " "; os << std::endl; } diff --git a/OndselSolver/00backhoe.asmt b/testapp/00backhoe.asmt similarity index 100% rename from OndselSolver/00backhoe.asmt rename to testapp/00backhoe.asmt diff --git a/testapp/CMakeLists.txt b/testapp/CMakeLists.txt new file mode 100644 index 0000000..f75fd3d --- /dev/null +++ b/testapp/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.16) + +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +add_executable(testapp OndselSolver.cpp) +target_link_libraries(testapp OndselSolver) +target_include_directories(testapp PUBLIC "../OndselSolver") diff --git a/OndselSolver/OndselSolver.cpp b/testapp/OndselSolver.cpp similarity index 59% rename from OndselSolver/OndselSolver.cpp rename to testapp/OndselSolver.cpp index 9b88d4f..0e6e2b3 100644 --- a/OndselSolver/OndselSolver.cpp +++ b/testapp/OndselSolver.cpp @@ -13,33 +13,33 @@ *********************************************************************/ #include -#include "CADSystem.h" -#include "CREATE.h" -#include "GESpMatParPvPrecise.h" -#include "ASMTAssembly.h" -#include "MBDynSystem.h" -#include "MomentOfInertiaSolver.h" +#include "../OndselSolver/CADSystem.h" +#include "../OndselSolver/CREATE.h" +#include "../OndselSolver/GESpMatParPvPrecise.h" +#include "../OndselSolver/ASMTAssembly.h" +#include "../OndselSolver/MBDynSystem.h" +#include "../OndselSolver/MomentOfInertiaSolver.h" using namespace MbD; void runSpMat(); int main() { - ASMTAssembly::readWriteFile("piston.asmt"); - MBDynSystem::runFile("MBDynCase.mbd"); //To be completed - MBDynSystem::runFile("crank_slider.mbd"); //To be completed - //ASMTAssembly::runSinglePendulumSuperSimplified(); //Mass is missing - //ASMTAssembly::runSinglePendulumSuperSimplified2(); //DOF has infinite acceleration due to zero mass and inertias - ASMTAssembly::runSinglePendulumSimplified(); - ASMTAssembly::runSinglePendulum(); - ASMTAssembly::runFile("piston.asmt"); - ASMTAssembly::runFile("00backhoe.asmt"); - //ASMTAssembly::runFile("circular.asmt"); //Needs checking - //ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine. - //ASMTAssembly::runFile("engine1.asmt"); //Needs checking - ASMTAssembly::runFile("fourbar.asmt"); - //ASMTAssembly::runFile("fourbot.asmt"); //Very large but works - ASMTAssembly::runFile("wobpump.asmt"); +// // ASMTAssembly::readWriteFile("piston.asmt"); +// MBDynSystem::runFile("MBDynCase.mbd"); //To be completed +// MBDynSystem::runFile("crank_slider.mbd"); //To be completed +// //ASMTAssembly::runSinglePendulumSuperSimplified(); //Mass is missing +// //ASMTAssembly::runSinglePendulumSuperSimplified2(); //DOF has infinite acceleration due to zero mass and inertias +// ASMTAssembly::runSinglePendulumSimplified(); +// ASMTAssembly::runSinglePendulum(); +// ASMTAssembly::runFile("piston.asmt"); +// ASMTAssembly::runFile("00backhoe.asmt"); +// //ASMTAssembly::runFile("circular.asmt"); //Needs checking +// //ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine. +// //ASMTAssembly::runFile("engine1.asmt"); //Needs checking +// ASMTAssembly::runFile("fourbar.asmt"); +// //ASMTAssembly::runFile("fourbot.asmt"); //Very large but works +// ASMTAssembly::runFile("wobpump.asmt"); auto cadSystem = std::make_shared(); cadSystem->runOndselSinglePendulum(); diff --git a/OndselSolver/OndselSolver.h b/testapp/OndselSolver.h similarity index 100% rename from OndselSolver/OndselSolver.h rename to testapp/OndselSolver.h diff --git a/OndselSolver/assembly.asmt b/testapp/assembly.asmt similarity index 100% rename from OndselSolver/assembly.asmt rename to testapp/assembly.asmt diff --git a/OndselSolver/circular.asmt b/testapp/circular.asmt similarity index 100% rename from OndselSolver/circular.asmt rename to testapp/circular.asmt diff --git a/OndselSolver/cirpendu.asmt b/testapp/cirpendu.asmt similarity index 100% rename from OndselSolver/cirpendu.asmt rename to testapp/cirpendu.asmt diff --git a/OndselSolver/engine1.asmt b/testapp/engine1.asmt similarity index 100% rename from OndselSolver/engine1.asmt rename to testapp/engine1.asmt diff --git a/OndselSolver/fourbar.asmt b/testapp/fourbar.asmt similarity index 100% rename from OndselSolver/fourbar.asmt rename to testapp/fourbar.asmt diff --git a/OndselSolver/fourbot.asmt b/testapp/fourbot.asmt similarity index 100% rename from OndselSolver/fourbot.asmt rename to testapp/fourbot.asmt diff --git a/OndselSolver/gyro.asmt b/testapp/gyro.asmt similarity index 100% rename from OndselSolver/gyro.asmt rename to testapp/gyro.asmt diff --git a/OndselSolver/piston.asmt b/testapp/piston.asmt similarity index 100% rename from OndselSolver/piston.asmt rename to testapp/piston.asmt diff --git a/OndselSolver/robot.asmt b/testapp/robot.asmt similarity index 100% rename from OndselSolver/robot.asmt rename to testapp/robot.asmt diff --git a/OndselSolver/wobpump.asmt b/testapp/wobpump.asmt similarity index 100% rename from OndselSolver/wobpump.asmt rename to testapp/wobpump.asmt From c406ad8b006ef25006c1c816b4a6deef977bc301 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Mon, 6 Nov 2023 19:44:07 -0600 Subject: [PATCH 13/17] DiagonalMatrix is now double only also. --- OndselSolver/ASMTAssembly.cpp | 6 +- OndselSolver/ASMTPrincipalMassMarker.cpp | 4 +- OndselSolver/ASMTPrincipalMassMarker.h | 2 +- OndselSolver/AnyPosICNewtonRaphson.cpp | 2 +- OndselSolver/CADSystem.cpp | 26 +- OndselSolver/CMakeLists.txt | 2 + OndselSolver/DiagonalMatrix.cpp | 42 +- OndselSolver/DiagonalMatrix.h | 21 +- OndselSolver/DiagonalMatrix.ref.h | 6 +- OndselSolver/EndFrameqct.cpp | 645 +++++++++++------------ OndselSolver/EndFrameqct.h | 1 - OndselSolver/EndFrameqct2.cpp | 2 +- OndselSolver/EulerAngles.cpp | 21 +- OndselSolver/EulerAngles.h | 7 +- OndselSolver/EulerParameters.cpp | 22 +- OndselSolver/EulerParameters.h | 2 - OndselSolver/FullMatrix.cpp | 4 +- OndselSolver/FullMatrix.h | 2 +- OndselSolver/MBDynNode.cpp | 47 +- OndselSolver/MomentOfInertiaSolver.cpp | 8 +- OndselSolver/Part.cpp | 26 +- OndselSolver/Part.h | 8 +- OndselSolver/VelICSolver.cpp | 2 +- 23 files changed, 421 insertions(+), 487 deletions(-) diff --git a/OndselSolver/ASMTAssembly.cpp b/OndselSolver/ASMTAssembly.cpp index dc830b9..793f647 100644 --- a/OndselSolver/ASMTAssembly.cpp +++ b/OndselSolver/ASMTAssembly.cpp @@ -262,7 +262,7 @@ void MbD::ASMTAssembly::runSinglePendulum() auto massMarker = std::make_shared(); massMarker->setMass(0.0); massMarker->setDensity(0.0); - auto aJ = std::make_shared>(ListD{ 0, 0, 0 }); + auto aJ = std::make_shared(ListD{ 0, 0, 0 }); massMarker->setMomentOfInertias(aJ); pos3D = std::make_shared>(ListD{ 0, 0, 0 }); massMarker->setPosition3D(pos3D); @@ -307,7 +307,7 @@ void MbD::ASMTAssembly::runSinglePendulum() massMarker = std::make_shared(); massMarker->setMass(0.2); massMarker->setDensity(10.0); - aJ = std::make_shared>(ListD{ 8.3333333333333e-4, 0.016833333333333, 0.017333333333333 }); + aJ = std::make_shared(ListD{ 8.3333333333333e-4, 0.016833333333333, 0.017333333333333 }); massMarker->setMomentOfInertias(aJ); pos3D = std::make_shared>(ListD{ 0.5, 0.1, 0.05 }); massMarker->setPosition3D(pos3D); @@ -995,7 +995,7 @@ void MbD::ASMTAssembly::initprincipalMassMarker() principalMassMarker = std::make_shared(); principalMassMarker->mass = 0.0; principalMassMarker->density = 0.0; - principalMassMarker->momentOfInertias = std::make_shared>(3, 0); + principalMassMarker->momentOfInertias = std::make_shared(3, 0); //principalMassMarker->position3D = std::make_shared>(3, 0); //principalMassMarker->rotationMatrix = FullMatrixDouble>::identitysptr(3); } diff --git a/OndselSolver/ASMTPrincipalMassMarker.cpp b/OndselSolver/ASMTPrincipalMassMarker.cpp index 5b813b3..eaabb3f 100644 --- a/OndselSolver/ASMTPrincipalMassMarker.cpp +++ b/OndselSolver/ASMTPrincipalMassMarker.cpp @@ -39,7 +39,7 @@ void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector& lines) lines.erase(lines.begin()); assert(lines[0] == (leadingTabs + "MomentOfInertias")); lines.erase(lines.begin()); - momentOfInertias = std::make_shared>(3); + momentOfInertias = std::make_shared(3); auto row = readRowOfDoubles(lines[0]); lines.erase(lines.begin()); for (int i = 0; i < 3; i++) @@ -70,7 +70,7 @@ void MbD::ASMTPrincipalMassMarker::setMomentOfInertias(DiagMatDsptr mat) // Overloads to simplify syntax. void MbD::ASMTPrincipalMassMarker::setMomentOfInertias(double a, double b, double c) { - momentOfInertias = std::make_shared>(ListD{ a, b, c }); + momentOfInertias = std::make_shared(ListD{ a, b, c }); } void MbD::ASMTPrincipalMassMarker::storeOnLevel(std::ofstream& os, int level) diff --git a/OndselSolver/ASMTPrincipalMassMarker.h b/OndselSolver/ASMTPrincipalMassMarker.h index 2e5740d..bd02ab0 100644 --- a/OndselSolver/ASMTPrincipalMassMarker.h +++ b/OndselSolver/ASMTPrincipalMassMarker.h @@ -26,7 +26,7 @@ namespace MbD { double mass = 0.0; double density = 0.0; - DiagMatDsptr momentOfInertias = std::make_shared>(ListD{ 0.,0.,0. }); + DiagMatDsptr momentOfInertias = std::make_shared(ListD{ 0.,0.,0. }); }; } diff --git a/OndselSolver/AnyPosICNewtonRaphson.cpp b/OndselSolver/AnyPosICNewtonRaphson.cpp index 824a0e1..7e4fd46 100644 --- a/OndselSolver/AnyPosICNewtonRaphson.cpp +++ b/OndselSolver/AnyPosICNewtonRaphson.cpp @@ -32,7 +32,7 @@ void AnyPosICNewtonRaphson::initializeGlobally() void AnyPosICNewtonRaphson::createVectorsAndMatrices() { qsuOld = std::make_shared>(nqsu); - qsuWeights = std::make_shared>(nqsu); + qsuWeights = std::make_shared(nqsu); SystemNewtonRaphson::createVectorsAndMatrices(); } diff --git a/OndselSolver/CADSystem.cpp b/OndselSolver/CADSystem.cpp index 900eb83..9737bba 100644 --- a/OndselSolver/CADSystem.cpp +++ b/OndselSolver/CADSystem.cpp @@ -87,7 +87,7 @@ void CADSystem::runOndselSinglePendulum() auto assembly1 = CREATE::With("/Assembly1"); std::cout << "assembly1->name " << assembly1->name << std::endl; assembly1->m = 0.0; - assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); + assembly1->aJ = std::make_shared(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); aAap = std::make_shared(ListListD{ { 1, 0, 0 }, @@ -130,7 +130,7 @@ void CADSystem::runOndselSinglePendulum() auto crankPart1 = CREATE::With("/Assembly1/Part1"); std::cout << "crankPart1->name " << crankPart1->name << std::endl; crankPart1->m = 1.0; - crankPart1->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + crankPart1->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.4, 0.0, -0.05 }); aAap = std::make_shared(ListListD{ { 1, 0, 0 }, @@ -222,7 +222,7 @@ void CADSystem::runOndselDoublePendulum() auto assembly1 = CREATE::With("/Assembly1"); std::cout << "assembly1->name " << assembly1->name << std::endl; assembly1->m = 0.0; - assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); + assembly1->aJ = std::make_shared(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); aAap = std::make_shared(ListListD{ { 1, 0, 0 }, @@ -265,7 +265,7 @@ void CADSystem::runOndselDoublePendulum() auto crankPart1 = CREATE::With("/Assembly1/Part1"); std::cout << "crankPart1->name " << crankPart1->name << std::endl; crankPart1->m = 1.0; - crankPart1->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + crankPart1->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.4, 0.0, -0.05 }); aAap = std::make_shared(ListListD{ { 1, 0, 0 }, @@ -307,7 +307,7 @@ void CADSystem::runOndselDoublePendulum() auto conrodPart2 = CREATE::With("/Assembly1/Part2"); std::cout << "conrodPart2->name " << conrodPart2->name << std::endl; conrodPart2->m = 1.0; - conrodPart2->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + conrodPart2->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.15, 0.1, 0.05 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 1.0, 0.0 }); auto eulerParameters = CREATE>::With(ListD{ 0.0, 0.0, 1.0, 0.0 }); @@ -396,7 +396,7 @@ void CADSystem::runOndselPiston() auto assembly1 = CREATE::With("/Assembly1"); std::cout << "assembly1->name " << assembly1->name << std::endl; assembly1->m = 0.0; - assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); + assembly1->aJ = std::make_shared(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); qE = std::make_shared>(ListD{ 0, 0, 0, 1 }); assembly1->setqX(qX); @@ -441,7 +441,7 @@ void CADSystem::runOndselPiston() auto crankPart1 = CREATE::With("/Assembly1/Part1"); std::cout << "crankPart1->name " << crankPart1->name << std::endl; crankPart1->m = 1.0; - crankPart1->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + crankPart1->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.4, 0.0, -0.05 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 0.0, 1.0 }); crankPart1->setqX(qX); @@ -483,7 +483,7 @@ void CADSystem::runOndselPiston() auto conrodPart2 = CREATE::With("/Assembly1/Part2"); std::cout << "conrodPart2->name " << conrodPart2->name << std::endl; conrodPart2->m = 1.0; - conrodPart2->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + conrodPart2->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ 0.15, 0.1, 0.05 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 1.0, 0.0 }); conrodPart2->setqX(qX); @@ -525,7 +525,7 @@ void CADSystem::runOndselPiston() auto pistonPart3 = CREATE::With("/Assembly1/Part3"); std::cout << "pistonPart3->name " << pistonPart3->name << std::endl; pistonPart3->m = 1.0; - pistonPart3->aJ = std::make_shared>(ListD{ 1, 1, 1 }); + pistonPart3->aJ = std::make_shared(ListD{ 1, 1, 1 }); qX = std::make_shared>(ListD{ -0.0, 1.5, 0.0 }); qE = std::make_shared>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 }); pistonPart3->setqX(qX); @@ -633,7 +633,7 @@ void CADSystem::runPiston() auto assembly1 = CREATE::With("/Assembly1"); std::cout << "assembly1->name " << assembly1->name << std::endl; assembly1->m = 0.0; - assembly1->aJ = std::make_shared>(ListD{ 0, 0, 0 }); + assembly1->aJ = std::make_shared(ListD{ 0, 0, 0 }); qX = std::make_shared>(ListD{ 0, 0, 0 }); qE = std::make_shared>(ListD{ 0, 0, 0, 1 }); assembly1->setqX(qX); @@ -678,7 +678,7 @@ void CADSystem::runPiston() auto crankPart1 = CREATE::With("/Assembly1/Part1"); std::cout << "crankPart1->name " << crankPart1->name << std::endl; crankPart1->m = 0.045210530089461; - crankPart1->aJ = std::make_shared>(ListD{ 1.7381980042084e-4, 0.003511159968501, 0.0036154518487535 }); + crankPart1->aJ = std::make_shared(ListD{ 1.7381980042084e-4, 0.003511159968501, 0.0036154518487535 }); qX = std::make_shared>(ListD{ 0.38423368514246, 2.6661567755108e-17, -0.048029210642807 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 0.0, 1.0 }); crankPart1->setqX(qX); @@ -720,7 +720,7 @@ void CADSystem::runPiston() auto conrodPart2 = CREATE::With("/Assembly1/Part2"); std::cout << "conrodPart2->name " << conrodPart2->name << std::endl; conrodPart2->m = 0.067815795134192; - conrodPart2->aJ = std::make_shared>(ListD{ 2.6072970063126e-4, 0.011784982468533, 0.011941420288912 }); + conrodPart2->aJ = std::make_shared(ListD{ 2.6072970063126e-4, 0.011784982468533, 0.011941420288912 }); qX = std::make_shared>(ListD{ 0.38423368514246, 0.49215295678475, 0.048029210642807 }); qE = std::make_shared>(ListD{ 0.0, 0.0, 0.89871703427292, 0.43852900965351 }); conrodPart2->setqX(qX); @@ -762,7 +762,7 @@ void CADSystem::runPiston() auto pistonPart3 = CREATE::With("/Assembly1/Part3"); std::cout << "pistonPart3->name " << pistonPart3->name << std::endl; pistonPart3->m = 1.730132083368; - pistonPart3->aJ = std::make_shared>(ListD{ 0.19449049546716, 0.23028116340971, 0.23028116340971 }); + pistonPart3->aJ = std::make_shared(ListD{ 0.19449049546716, 0.23028116340971, 0.23028116340971 }); qX = std::make_shared>(ListD{ -1.283972762056e-18, 1.4645980199976, -4.7652385308244e-17 }); qE = std::make_shared>(ListD{ 0.70710678118655, 0.70710678118655, 0.0, 0.0 }); pistonPart3->setqX(qX); diff --git a/OndselSolver/CMakeLists.txt b/OndselSolver/CMakeLists.txt index 73738f7..a5ad462 100644 --- a/OndselSolver/CMakeLists.txt +++ b/OndselSolver/CMakeLists.txt @@ -5,6 +5,8 @@ project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-4") + include(GNUInstallDirs) file(GLOB ONDSELSOLVER_SOURCES "*.cpp") diff --git a/OndselSolver/DiagonalMatrix.cpp b/OndselSolver/DiagonalMatrix.cpp index e561c87..c03cfc9 100644 --- a/OndselSolver/DiagonalMatrix.cpp +++ b/OndselSolver/DiagonalMatrix.cpp @@ -11,45 +11,36 @@ namespace MbD { - template<> - inline DiagMatDsptr DiagonalMatrix::times(double factor) + DiagMatDsptr DiagonalMatrix::times(double factor) { auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); + auto answer = std::make_shared(nrow); for (int i = 0; i < nrow; i++) { answer->at(i) = this->at(i) * factor; } return answer; } - template - inline void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr> diagMat) + void DiagonalMatrix::atiputDiagonalMatrix(int i, std::shared_ptr diagMat) { for (int ii = 0; ii < diagMat->size(); ii++) { this->at(i + ii) = diagMat->at(ii); } } - template - inline DiagMatsptr DiagonalMatrix::times(T factor) - { - assert(false); - } - template - inline FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) + FColsptr DiagonalMatrix::timesFullColumn(FColsptr fullCol) { //"a*b = a(i,j)b(j) sum j." auto nrow = (int)this->size(); - auto answer = std::make_shared>(nrow); + auto answer = std::make_shared>(nrow); for (int i = 0; i < nrow; i++) { answer->at(i) = this->at(i) * fullCol->at(i); } return answer; } - template - inline FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) + FMatDsptr DiagonalMatrix::timesFullMatrix(FMatDsptr fullMat) { auto nrow = (int)this->size(); auto answer = std::make_shared(nrow); @@ -59,8 +50,7 @@ namespace MbD { } return answer; } - template<> - inline double DiagonalMatrix::sumOfSquares() + double DiagonalMatrix::sumOfSquares() { double sum = 0.0; for (int i = 0; i < this->size(); i++) @@ -70,21 +60,18 @@ namespace MbD { } return sum; } - template - inline int DiagonalMatrix::numberOfElements() + int DiagonalMatrix::numberOfElements() { auto n = (int)this->size(); return n * n; } - template<> - inline void DiagonalMatrix::zeroSelf() + void DiagonalMatrix::zeroSelf() { for (int i = 0; i < this->size(); i++) { this->at(i) = 0.0; } } - template<> - inline double DiagonalMatrix::maxMagnitude() + double DiagonalMatrix::maxMagnitude() { double max = 0.0; for (int i = 0; i < this->size(); i++) @@ -95,14 +82,7 @@ namespace MbD { } return max; } - template - inline double DiagonalMatrix::maxMagnitude() - { - assert(false); - return 0.0; - } - template - inline std::ostream& DiagonalMatrix::printOn(std::ostream& s) const + std::ostream& DiagonalMatrix::printOn(std::ostream& s) const { s << "DiagMat["; s << this->at(0); diff --git a/OndselSolver/DiagonalMatrix.h b/OndselSolver/DiagonalMatrix.h index 4abae1b..000ade8 100644 --- a/OndselSolver/DiagonalMatrix.h +++ b/OndselSolver/DiagonalMatrix.h @@ -14,22 +14,19 @@ #include "DiagonalMatrix.ref.h" #include "Array.h" #include "FullColumn.h" -//#include "FullRow.h" -// #include "FullMatrix.h" namespace MbD { - template - class DiagonalMatrix : public Array + class DiagonalMatrix : public Array { // public: - DiagonalMatrix() : Array() {} - DiagonalMatrix(int count) : Array(count) {} - DiagonalMatrix(int count, const T& value) : Array(count, value) {} - DiagonalMatrix(std::initializer_list list) : Array{ list } {} - void atiputDiagonalMatrix(int i, std::shared_ptr> diagMat); - DiagMatsptr times(T factor); - FColsptr timesFullColumn(FColsptr fullCol); + DiagonalMatrix() : Array() {} + explicit DiagonalMatrix(int count) : Array(count) {} + DiagonalMatrix(int count, const double& value) : Array(count, value) {} + DiagonalMatrix(std::initializer_list list) : Array{ list } {} + void atiputDiagonalMatrix(int i, std::shared_ptr diagMat); + DiagMatDsptr times(double factor); + FColsptr timesFullColumn(FColsptr fullCol); FMatDsptr timesFullMatrix(FMatDsptr fullMat); int nrow() { return (int)this->size(); @@ -44,7 +41,5 @@ namespace MbD { std::ostream& printOn(std::ostream& s) const override; }; - - template class DiagonalMatrix; } diff --git a/OndselSolver/DiagonalMatrix.ref.h b/OndselSolver/DiagonalMatrix.ref.h index ea01948..15127de 100644 --- a/OndselSolver/DiagonalMatrix.ref.h +++ b/OndselSolver/DiagonalMatrix.ref.h @@ -3,9 +3,7 @@ #include namespace MbD { - template class DiagonalMatrix; - template - using DiagMatsptr = std::shared_ptr>; - using DiagMatDsptr = std::shared_ptr>; + using DiagMatsptr = std::shared_ptr; + using DiagMatDsptr = std::shared_ptr; } \ No newline at end of file diff --git a/OndselSolver/EndFrameqct.cpp b/OndselSolver/EndFrameqct.cpp index dfc7848..b0eb3f1 100644 --- a/OndselSolver/EndFrameqct.cpp +++ b/OndselSolver/EndFrameqct.cpp @@ -9,7 +9,6 @@ #include "EndFrameqct.h" #include "MarkerFrame.h" #include "System.h" -#include "Symbolic.h" #include "Time.h" #include "EulerParameters.h" #include "CREATE.h" @@ -17,347 +16,309 @@ #include "EulerAngleszxzDot.h" #include "EulerAngleszxzDDot.h" -using namespace MbD; +namespace MbD { + template class EulerParameters; -EndFrameqct::EndFrameqct() { + EndFrameqct::EndFrameqct() { + } + + EndFrameqct::EndFrameqct(const char *str) : EndFrameqc(str) { + } + + void EndFrameqct::initialize() { + EndFrameqc::initialize(); + rmem = std::make_shared>(3); + prmempt = std::make_shared>(3); + pprmemptpt = std::make_shared>(3); + aAme = FullMatrixDouble::identitysptr(3); + pAmept = std::make_shared(3, 3); + ppAmeptpt = std::make_shared(3, 3); + pprOeOpEpt = std::make_shared(3, 4); + pprOeOptpt = std::make_shared>(3); + ppAOepEpt = std::make_shared>(4); + ppAOeptpt = std::make_shared(3, 3); + } + + void EndFrameqct::initializeLocally() { + if (!rmemBlks) { + rmem->zeroSelf(); + prmempt->zeroSelf(); + pprmemptpt->zeroSelf(); + } + if (!phiThePsiBlks) { + aAme->identity(); + pAmept->zeroSelf(); + ppAmeptpt->zeroSelf(); + } + } + + void EndFrameqct::initializeGlobally() { + if (rmemBlks) { + initprmemptBlks(); + initpprmemptptBlks(); + } + if (phiThePsiBlks) { + initpPhiThePsiptBlks(); + initppPhiThePsiptptBlks(); + } + } + + void EndFrameqct::initprmemptBlks() { + auto &mbdTime = this->root()->time; + prmemptBlks = std::make_shared>(3); + for (int i = 0; i < 3; i++) { + auto &disp = rmemBlks->at(i); + auto var = disp->differentiateWRT(mbdTime); + auto vel = var->simplified(var); + prmemptBlks->at(i) = vel; + } + } + + void EndFrameqct::initpprmemptptBlks() { + auto &mbdTime = this->root()->time; + pprmemptptBlks = std::make_shared>(3); + for (int i = 0; i < 3; i++) { + auto &vel = prmemptBlks->at(i); + auto var = vel->differentiateWRT(mbdTime); + auto acc = var->simplified(var); + pprmemptptBlks->at(i) = acc; + } + } + + void EndFrameqct::initpPhiThePsiptBlks() { + auto &mbdTime = this->root()->time; + pPhiThePsiptBlks = std::make_shared>(3); + for (int i = 0; i < 3; i++) { + auto &angle = phiThePsiBlks->at(i); + auto var = angle->differentiateWRT(mbdTime); + //std::cout << "var " << *var << std::endl; + auto vel = var->simplified(var); + //std::cout << "vel " << *vel << std::endl; + pPhiThePsiptBlks->at(i) = vel; + } + } + + void EndFrameqct::initppPhiThePsiptptBlks() { + auto &mbdTime = this->root()->time; + ppPhiThePsiptptBlks = std::make_shared>(3); + for (int i = 0; i < 3; i++) { + auto &angleVel = pPhiThePsiptBlks->at(i); + auto var = angleVel->differentiateWRT(mbdTime); + auto angleAcc = var->simplified(var); + ppPhiThePsiptptBlks->at(i) = angleAcc; + } + } + + void EndFrameqct::postInput() { + this->evalrmem(); + this->evalAme(); + Item::postInput(); + } + + void EndFrameqct::calcPostDynCorrectorIteration() { + auto &rOmO = markerFrame->rOmO; + auto &aAOm = markerFrame->aAOm; + rOeO = rOmO->plusFullColumn(aAOm->timesFullColumn(rmem)); + auto &prOmOpE = markerFrame->prOmOpE; + auto &pAOmpE = markerFrame->pAOmpE; + for (int i = 0; i < 3; i++) { + auto &prOmOpEi = prOmOpE->at(i); + auto &prOeOpEi = prOeOpE->at(i); + for (int j = 0; j < 4; j++) { + auto prOeOpEij = prOmOpEi->at(j) + pAOmpE->at(j)->at(i)->timesFullColumn(rmem); + prOeOpEi->at(j) = prOeOpEij; + } + } + auto rpep = markerFrame->rpmp->plusFullColumn(markerFrame->aApm->timesFullColumn(rmem)); + pprOeOpEpE = EulerParameters::ppApEpEtimesColumn(rpep); + aAOe = aAOm->timesFullMatrix(aAme); + for (int i = 0; i < 4; i++) { + pAOepE->at(i) = pAOmpE->at(i)->timesFullMatrix(aAme); + } + auto aApe = markerFrame->aApm->timesFullMatrix(aAme); + ppAOepEpE = EulerParameters::ppApEpEtimesMatrix(aApe); + } + + void EndFrameqct::prePosIC() { + time = this->root()->mbdTimeValue(); + this->evalrmem(); + this->evalAme(); + EndFrameqc::prePosIC(); + } + + void EndFrameqct::evalrmem() { + if (rmemBlks) { + for (int i = 0; i < 3; i++) { + auto &expression = rmemBlks->at(i); + double value = expression->getValue(); + rmem->at(i) = value; + } + } + } + + void EndFrameqct::evalAme() { + if (phiThePsiBlks) { + auto phiThePsi = CREATE>::With(); + for (int i = 0; i < 3; i++) { + auto &expression = phiThePsiBlks->at(i); + auto value = expression->getValue(); + phiThePsi->at(i) = value; + } + phiThePsi->calc(); + aAme = phiThePsi->aA; + } + } + + void EndFrameqct::preVelIC() { + time = this->root()->mbdTimeValue(); + this->evalrmem(); + this->evalAme(); + Item::preVelIC(); + this->evalprmempt(); + this->evalpAmept(); + auto &aAOm = markerFrame->aAOm; + prOeOpt = aAOm->timesFullColumn(prmempt); + pAOept = aAOm->timesFullMatrix(pAmept); + } + + void EndFrameqct::postVelIC() { + auto &pAOmpE = markerFrame->pAOmpE; + for (int i = 0; i < 3; i++) { + auto &pprOeOpEpti = pprOeOpEpt->at(i); + for (int j = 0; j < 4; j++) { + auto pprOeOpEptij = pAOmpE->at(j)->at(i)->dot(prmempt); + pprOeOpEpti->atiput(j, pprOeOpEptij); + } + } + for (int i = 0; i < 4; i++) { + ppAOepEpt->atiput(i, pAOmpE->at(i)->timesFullMatrix(pAmept)); + } + } + + FColDsptr EndFrameqct::pAjOept(int j) { + return pAOept->column(j); + } + + FMatDsptr EndFrameqct::ppAjOepETpt(int jj) { + auto answer = std::make_shared(4, 3); + for (int i = 0; i < 4; i++) { + auto &answeri = answer->at(i); + auto &ppAOepEipt = ppAOepEpt->at(i); + for (int j = 0; j < 3; j++) { + auto &answerij = ppAOepEipt->at(j)->at(jj); + answeri->atiput(j, answerij); + } + } + return answer; + } + + FColDsptr EndFrameqct::ppAjOeptpt(int j) { + return ppAOeptpt->column(j); + } + + double EndFrameqct::priOeOpt(int i) { + return prOeOpt->at(i); + } + + FRowDsptr EndFrameqct::ppriOeOpEpt(int i) { + return pprOeOpEpt->at(i); + } + + double EndFrameqct::ppriOeOptpt(int i) { + return pprOeOptpt->at(i); + } + + void EndFrameqct::evalprmempt() { + if (rmemBlks) { + for (int i = 0; i < 3; i++) { + auto &derivative = prmemptBlks->at(i); + auto value = derivative->getValue(); + prmempt->at(i) = value; + } + } + } + + void EndFrameqct::evalpAmept() { + if (phiThePsiBlks) { + auto phiThePsi = CREATE>::With(); + auto phiThePsiDot = CREATE>::With(); + phiThePsiDot->phiThePsi = phiThePsi; + for (int i = 0; i < 3; i++) { + auto &expression = phiThePsiBlks->at(i); + auto &derivative = pPhiThePsiptBlks->at(i); + auto value = expression->getValue(); + auto valueDot = derivative->getValue(); + phiThePsi->at(i) = value; + phiThePsiDot->at(i) = valueDot; + } + phiThePsi->calc(); + phiThePsiDot->calc(); + pAmept = phiThePsiDot->aAdot; + } + } + + void EndFrameqct::evalpprmemptpt() { + if (rmemBlks) { + for (int i = 0; i < 3; i++) { + auto &secondDerivative = pprmemptptBlks->at(i); + auto value = secondDerivative->getValue(); + pprmemptpt->atiput(i, value); + } + } + } + + void EndFrameqct::evalppAmeptpt() { + if (phiThePsiBlks) { + auto phiThePsi = CREATE>::With(); + auto phiThePsiDot = CREATE>::With(); + phiThePsiDot->phiThePsi = phiThePsi; + auto phiThePsiDDot = CREATE>::With(); + phiThePsiDDot->phiThePsiDot = phiThePsiDot; + for (int i = 0; i < 3; i++) { + auto &expression = phiThePsiBlks->at(i); + auto &derivative = pPhiThePsiptBlks->at(i); + auto &secondDerivative = ppPhiThePsiptptBlks->at(i); + auto value = expression->getValue(); + auto valueDot = derivative->getValue(); + auto valueDDot = secondDerivative->getValue(); + phiThePsi->atiput(i, value); + phiThePsiDot->atiput(i, valueDot); + phiThePsiDDot->atiput(i, valueDDot); + } + phiThePsi->calc(); + phiThePsiDot->calc(); + phiThePsiDDot->calc(); + ppAmeptpt = phiThePsiDDot->aAddot; + } + } + + FColDsptr EndFrameqct::rmeO() { + return markerFrame->aAOm->timesFullColumn(rmem); + } + + FColDsptr EndFrameqct::rpep() { + auto &rpmp = markerFrame->rpmp; + auto &aApm = markerFrame->aApm; + auto rpep = rpmp->plusFullColumn(aApm->timesFullColumn(rmem)); + return rpep; + } + + void EndFrameqct::preAccIC() { + time = this->root()->mbdTimeValue(); + this->evalrmem(); + this->evalAme(); + Item::preVelIC(); + this->evalprmempt(); + this->evalpAmept(); + auto &aAOm = markerFrame->aAOm; + prOeOpt = aAOm->timesFullColumn(prmempt); + pAOept = aAOm->timesFullMatrix(pAmept); + Item::preAccIC(); + this->evalpprmemptpt(); + this->evalppAmeptpt(); + aAOm = markerFrame->aAOm; + pprOeOptpt = aAOm->timesFullColumn(pprmemptpt); + ppAOeptpt = aAOm->timesFullMatrix(ppAmeptpt); + } } -EndFrameqct::EndFrameqct(const char* str) : EndFrameqc(str) { -} - -void EndFrameqct::initialize() -{ - EndFrameqc::initialize(); - rmem = std::make_shared>(3); - prmempt = std::make_shared>(3); - pprmemptpt = std::make_shared>(3); - aAme = FullMatrixDouble::identitysptr(3); - pAmept = std::make_shared(3, 3); - ppAmeptpt = std::make_shared(3, 3); - pprOeOpEpt = std::make_shared(3, 4); - pprOeOptpt = std::make_shared>(3); - ppAOepEpt = std::make_shared>(4); - ppAOeptpt = std::make_shared(3, 3); -} - -void EndFrameqct::initializeLocally() -{ - if (!rmemBlks) { - rmem->zeroSelf(); - prmempt->zeroSelf(); - pprmemptpt->zeroSelf(); - } - if (!phiThePsiBlks) { - aAme->identity(); - pAmept->zeroSelf(); - ppAmeptpt->zeroSelf(); - } -} - -void EndFrameqct::initializeGlobally() -{ - if (rmemBlks) { - initprmemptBlks(); - initpprmemptptBlks(); - } - if (phiThePsiBlks) { - initpPhiThePsiptBlks(); - initppPhiThePsiptptBlks(); - } -} - -void EndFrameqct::initprmemptBlks() -{ - auto& mbdTime = this->root()->time; - prmemptBlks = std::make_shared< FullColumn>(3); - for (int i = 0; i < 3; i++) { - auto& disp = rmemBlks->at(i); - auto var = disp->differentiateWRT(mbdTime); - auto vel = var->simplified(var); - prmemptBlks->at(i) = vel; - } -} - -void EndFrameqct::initpprmemptptBlks() -{ - auto& mbdTime = this->root()->time; - pprmemptptBlks = std::make_shared< FullColumn>(3); - for (int i = 0; i < 3; i++) { - auto& vel = prmemptBlks->at(i); - auto var = vel->differentiateWRT(mbdTime); - auto acc = var->simplified(var); - pprmemptptBlks->at(i) = acc; - } -} - -void EndFrameqct::initpPhiThePsiptBlks() -{ - auto& mbdTime = this->root()->time; - pPhiThePsiptBlks = std::make_shared< FullColumn>(3); - for (int i = 0; i < 3; i++) { - auto& angle = phiThePsiBlks->at(i); - auto var = angle->differentiateWRT(mbdTime); - //std::cout << "var " << *var << std::endl; - auto vel = var->simplified(var); - //std::cout << "vel " << *vel << std::endl; - pPhiThePsiptBlks->at(i) = vel; - } -} - -void EndFrameqct::initppPhiThePsiptptBlks() -{ - auto& mbdTime = this->root()->time; - ppPhiThePsiptptBlks = std::make_shared< FullColumn>(3); - for (int i = 0; i < 3; i++) { - auto& angleVel = pPhiThePsiptBlks->at(i); - auto var = angleVel->differentiateWRT(mbdTime); - auto angleAcc = var->simplified(var); - ppPhiThePsiptptBlks->at(i) = angleAcc; - } -} - -void EndFrameqct::postInput() -{ - this->evalrmem(); - this->evalAme(); - Item::postInput(); -} - -void EndFrameqct::calcPostDynCorrectorIteration() -{ - auto& rOmO = markerFrame->rOmO; - auto& aAOm = markerFrame->aAOm; - rOeO = rOmO->plusFullColumn(aAOm->timesFullColumn(rmem)); - auto& prOmOpE = markerFrame->prOmOpE; - auto& pAOmpE = markerFrame->pAOmpE; - for (int i = 0; i < 3; i++) - { - auto& prOmOpEi = prOmOpE->at(i); - auto& prOeOpEi = prOeOpE->at(i); - for (int j = 0; j < 4; j++) - { - auto prOeOpEij = prOmOpEi->at(j) + pAOmpE->at(j)->at(i)->timesFullColumn(rmem); - prOeOpEi->at(j) = prOeOpEij; - } - } - auto rpep = markerFrame->rpmp->plusFullColumn(markerFrame->aApm->timesFullColumn(rmem)); - pprOeOpEpE = EulerParameters::ppApEpEtimesColumn(rpep); - aAOe = aAOm->timesFullMatrix(aAme); - for (int i = 0; i < 4; i++) - { - pAOepE->at(i) = pAOmpE->at(i)->timesFullMatrix(aAme); - } - auto aApe = markerFrame->aApm->timesFullMatrix(aAme); - ppAOepEpE = EulerParameters::ppApEpEtimesMatrix(aApe); -} - -void EndFrameqct::prePosIC() -{ - time = this->root()->mbdTimeValue(); - this->evalrmem(); - this->evalAme(); - EndFrameqc::prePosIC(); -} - -void EndFrameqct::evalrmem() -{ - if (rmemBlks) { - for (int i = 0; i < 3; i++) - { - auto& expression = rmemBlks->at(i); - double value = expression->getValue(); - rmem->at(i) = value; - } - } -} - -void EndFrameqct::evalAme() -{ - if (phiThePsiBlks) { - auto phiThePsi = CREATE>::With(); - for (int i = 0; i < 3; i++) - { - auto& expression = phiThePsiBlks->at(i); - auto value = expression->getValue(); - phiThePsi->at(i) = value; - } - phiThePsi->calc(); - aAme = phiThePsi->aA; - } -} - -void EndFrameqct::preVelIC() -{ - time = this->root()->mbdTimeValue(); - this->evalrmem(); - this->evalAme(); - Item::preVelIC(); - this->evalprmempt(); - this->evalpAmept(); - auto& aAOm = markerFrame->aAOm; - prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = aAOm->timesFullMatrix(pAmept); -} - -void EndFrameqct::postVelIC() -{ - auto& pAOmpE = markerFrame->pAOmpE; - for (int i = 0; i < 3; i++) - { - auto& pprOeOpEpti = pprOeOpEpt->at(i); - for (int j = 0; j < 4; j++) - { - auto pprOeOpEptij = pAOmpE->at(j)->at(i)->dot(prmempt); - pprOeOpEpti->atiput(j, pprOeOpEptij); - } - } - for (int i = 0; i < 4; i++) - { - ppAOepEpt->atiput(i, pAOmpE->at(i)->timesFullMatrix(pAmept)); - } -} - -FColDsptr EndFrameqct::pAjOept(int j) -{ - return pAOept->column(j); -} - -FMatDsptr EndFrameqct::ppAjOepETpt(int jj) -{ - auto answer = std::make_shared(4, 3); - for (int i = 0; i < 4; i++) - { - auto& answeri = answer->at(i); - auto& ppAOepEipt = ppAOepEpt->at(i); - for (int j = 0; j < 3; j++) - { - auto& answerij = ppAOepEipt->at(j)->at(jj); - answeri->atiput(j, answerij); - } - } - return answer; -} - -FColDsptr EndFrameqct::ppAjOeptpt(int j) -{ - return ppAOeptpt->column(j); -} - -double EndFrameqct::priOeOpt(int i) -{ - return prOeOpt->at(i); -} - -FRowDsptr EndFrameqct::ppriOeOpEpt(int i) -{ - return pprOeOpEpt->at(i); -} - -double EndFrameqct::ppriOeOptpt(int i) -{ - return pprOeOptpt->at(i); -} - -void EndFrameqct::evalprmempt() -{ - if (rmemBlks) { - for (int i = 0; i < 3; i++) - { - auto& derivative = prmemptBlks->at(i); - auto value = derivative->getValue(); - prmempt->at(i) = value; - } - } -} - -void EndFrameqct::evalpAmept() -{ - if (phiThePsiBlks) { - auto phiThePsi = CREATE>::With(); - auto phiThePsiDot = CREATE>::With(); - phiThePsiDot->phiThePsi = phiThePsi; - for (int i = 0; i < 3; i++) - { - auto& expression = phiThePsiBlks->at(i); - auto& derivative = pPhiThePsiptBlks->at(i); - auto value = expression->getValue(); - auto valueDot = derivative->getValue(); - phiThePsi->at(i) = value; - phiThePsiDot->at(i) = valueDot; - } - phiThePsi->calc(); - phiThePsiDot->calc(); - pAmept = phiThePsiDot->aAdot; - } -} - -void EndFrameqct::evalpprmemptpt() -{ - if (rmemBlks) { - for (int i = 0; i < 3; i++) - { - auto& secondDerivative = pprmemptptBlks->at(i); - auto value = secondDerivative->getValue(); - pprmemptpt->atiput(i, value); - } - } -} - -void EndFrameqct::evalppAmeptpt() -{ - if (phiThePsiBlks) { - auto phiThePsi = CREATE>::With(); - auto phiThePsiDot = CREATE>::With(); - phiThePsiDot->phiThePsi = phiThePsi; - auto phiThePsiDDot = CREATE>::With(); - phiThePsiDDot->phiThePsiDot = phiThePsiDot; - for (int i = 0; i < 3; i++) - { - auto& expression = phiThePsiBlks->at(i); - auto& derivative = pPhiThePsiptBlks->at(i); - auto& secondDerivative = ppPhiThePsiptptBlks->at(i); - auto value = expression->getValue(); - auto valueDot = derivative->getValue(); - auto valueDDot = secondDerivative->getValue(); - phiThePsi->atiput(i, value); - phiThePsiDot->atiput(i, valueDot); - phiThePsiDDot->atiput(i, valueDDot); - } - phiThePsi->calc(); - phiThePsiDot->calc(); - phiThePsiDDot->calc(); - ppAmeptpt = phiThePsiDDot->aAddot; - } -} - -FColDsptr EndFrameqct::rmeO() -{ - return markerFrame->aAOm->timesFullColumn(rmem); -} - -FColDsptr EndFrameqct::rpep() -{ - auto& rpmp = markerFrame->rpmp; - auto& aApm = markerFrame->aApm; - auto rpep = rpmp->plusFullColumn(aApm->timesFullColumn(rmem)); - return rpep; -} - -void EndFrameqct::preAccIC() -{ - time = this->root()->mbdTimeValue(); - this->evalrmem(); - this->evalAme(); - Item::preVelIC(); - this->evalprmempt(); - this->evalpAmept(); - auto& aAOm = markerFrame->aAOm; - prOeOpt = aAOm->timesFullColumn(prmempt); - pAOept = aAOm->timesFullMatrix(pAmept); - Item::preAccIC(); - this->evalpprmemptpt(); - this->evalppAmeptpt(); - aAOm = markerFrame->aAOm; - pprOeOptpt = aAOm->timesFullColumn(pprmemptpt); - ppAOeptpt = aAOm->timesFullMatrix(ppAmeptpt); -} diff --git a/OndselSolver/EndFrameqct.h b/OndselSolver/EndFrameqct.h index aa6125d..bd06d7e 100644 --- a/OndselSolver/EndFrameqct.h +++ b/OndselSolver/EndFrameqct.h @@ -58,7 +58,6 @@ namespace MbD { FMatDsptr aAme, pAmept, ppAmeptpt, pAOept, ppAOeptpt; FMatDsptr pprOeOpEpt; FColFMatDsptr ppAOepEpt; - }; } diff --git a/OndselSolver/EndFrameqct2.cpp b/OndselSolver/EndFrameqct2.cpp index fc8512f..b2f0ce4 100644 --- a/OndselSolver/EndFrameqct2.cpp +++ b/OndselSolver/EndFrameqct2.cpp @@ -29,7 +29,7 @@ void EndFrameqct2::initpPhiThePsiptBlks() { auto& mbdTime = this->root()->time; auto eulerAngles = std::static_pointer_cast>(phiThePsiBlks); - pPhiThePsiptBlks = eulerAngles->differentiateWRT(mbdTime); + pPhiThePsiptBlks = differentiateWRT(*eulerAngles, mbdTime); } void EndFrameqct2::initppPhiThePsiptptBlks() diff --git a/OndselSolver/EulerAngles.cpp b/OndselSolver/EulerAngles.cpp index 00dd6ee..a33456d 100644 --- a/OndselSolver/EulerAngles.cpp +++ b/OndselSolver/EulerAngles.cpp @@ -66,16 +66,6 @@ namespace MbD { assert(false); } template - inline std::shared_ptr> EulerAngles::differentiateWRT(T var) - { - auto derivatives = std::make_shared>(); - std::transform(this->begin(), this->end(), derivatives->begin(), - [var](T term) { return term->differentiateWRT(var); } - ); - derivatives->aEulerAngles = this; - return derivatives; - } - template inline void EulerAngles::setRotOrder(int i, int j, int k) { rotOrder = std::make_shared>(3); @@ -83,6 +73,15 @@ namespace MbD { rotOrder->at(1) = j; rotOrder->at(2) = k; } - template class EulerAngles>; + // type-specific helper functions + std::shared_ptr>> differentiateWRT(EulerAngles>& ref, std::shared_ptr var) + { + auto derivatives = std::make_shared>>(); + std::transform(ref.begin(), ref.end(), derivatives->begin(), + [var](std::shared_ptr term) { return term->differentiateWRT(var); } + ); + derivatives->aEulerAngles = &ref; + return derivatives; + } } diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index 1a8fa81..48bceae 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -27,15 +27,14 @@ namespace MbD { EulerAngles(std::initializer_list list) : EulerArray{ list } {} void initialize() override; void calc() override; - std::shared_ptr> differentiateWRT(T var); void setRotOrder(int i, int j, int k); std::shared_ptr> rotOrder; FColFMatDsptr cA; FMatDsptr aA; }; -// // NOTE: do NOT instantiate EulerAngles as a whole as differentiateWRT breaks -// template <> -// void EulerAngles::setRotOrder(int, int, int); + template class EulerAngles>; + template class EulerAngles; + std::shared_ptr>> differentiateWRT(EulerAngles>& ref, std::shared_ptr var); } diff --git a/OndselSolver/EulerParameters.cpp b/OndselSolver/EulerParameters.cpp index b26cd71..dc31b61 100644 --- a/OndselSolver/EulerParameters.cpp +++ b/OndselSolver/EulerParameters.cpp @@ -13,7 +13,7 @@ namespace MbD { template<> - inline FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) + FMatFColDsptr EulerParameters::ppApEpEtimesColumn(FColDsptr col) { double a2c0 = 2 * col->at(0); double a2c1 = 2 * col->at(1); @@ -56,7 +56,7 @@ namespace MbD { } template<> - inline FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) + FMatDsptr EulerParameters::pCpEtimesColumn(FColDsptr col) { //"col size = 4." auto c0 = col->at(0); @@ -86,7 +86,7 @@ namespace MbD { } template - inline FMatDsptr EulerParameters::pCTpEtimesColumn(FColDsptr col) + FMatDsptr EulerParameters::pCTpEtimesColumn(FColDsptr col) { //"col size = 3." auto c0 = col->at(0); @@ -120,7 +120,7 @@ namespace MbD { } template<> - inline FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) + FMatFMatDsptr EulerParameters::ppApEpEtimesMatrix(FMatDsptr mat) { FRowDsptr a2m0 = mat->at(0)->times(2.0); FRowDsptr a2m1 = mat->at(1)->times(2.0); @@ -164,7 +164,7 @@ namespace MbD { } template // this is ALWAYS double; see note below. - inline void EulerParameters::initialize() + void EulerParameters::initialize() { aA = FullMatrixDouble::identitysptr(3); aB = std::make_shared(3, 4); @@ -179,18 +179,18 @@ namespace MbD { // the following can't be valid as FullMatrix instatiatiates , yet // this class needs to see the member functions of FullMatrix //template<> -//inline void EulerParameters::initialize() +//void EulerParameters::initialize() //{ //} template - inline void EulerParameters::calc() + void EulerParameters::calc() { this->calcABC(); this->calcpApE(); } template<> - inline void EulerParameters::calcABC() + void EulerParameters::calcABC() { double aE0 = this->at(0); double aE1 = this->at(1); @@ -235,7 +235,7 @@ namespace MbD { aA = aB->timesTransposeFullMatrix(aC); } template<> - inline void EulerParameters::calcpApE() + void EulerParameters::calcpApE() { double a2E0 = 2.0 * (this->at(0)); double a2E1 = 2.0 * (this->at(1)); @@ -304,9 +304,11 @@ namespace MbD { pAipEk->at(2) = a2E3; } template - inline void EulerParameters::conditionSelf() + void EulerParameters::conditionSelf() { EulerArray::conditionSelf(); this->normalizeSelf(); } + + template class EulerParameters; } diff --git a/OndselSolver/EulerParameters.h b/OndselSolver/EulerParameters.h index 1dc1c8b..35d32ae 100644 --- a/OndselSolver/EulerParameters.h +++ b/OndselSolver/EulerParameters.h @@ -59,6 +59,4 @@ namespace MbD { FMatDsptr aC; FColFMatDsptr pApE; }; - - template class EulerParameters; } diff --git a/OndselSolver/FullMatrix.cpp b/OndselSolver/FullMatrix.cpp index 7296c7f..0377eca 100644 --- a/OndselSolver/FullMatrix.cpp +++ b/OndselSolver/FullMatrix.cpp @@ -665,10 +665,10 @@ namespace MbD { return false; } } - std::shared_ptr> FullMatrixDouble::asDiagonalMatrix() + std::shared_ptr FullMatrixDouble::asDiagonalMatrix() { int nrow = this->nrow(); - auto diagMat = std::make_shared>(nrow); + auto diagMat = std::make_shared(nrow); for (int i = 0; i < nrow; i++) { diagMat->atiput(i, this->at(i)->at(i)); diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h index 468dc3e..91684ef 100644 --- a/OndselSolver/FullMatrix.h +++ b/OndselSolver/FullMatrix.h @@ -93,7 +93,7 @@ namespace MbD { double trace(); bool isDiagonal(); bool isDiagonalToWithin(double ratio); - std::shared_ptr> asDiagonalMatrix(); + std::shared_ptr asDiagonalMatrix(); void conditionSelfWithTol(double tol); std::ostream& printOn(std::ostream& s) const override; FColsptr timesFullColumn(FColsptr fullCol); diff --git a/OndselSolver/MBDynNode.cpp b/OndselSolver/MBDynNode.cpp index 49f114a..675f5fa 100644 --- a/OndselSolver/MBDynNode.cpp +++ b/OndselSolver/MBDynNode.cpp @@ -20,29 +20,28 @@ void MbD::MBDynNode::outputLine(int i, std::ostream& os) auto x = asmtPart->xs->at(i); auto y = asmtPart->ys->at(i); auto z = asmtPart->zs->at(i); - // TODO: undo the breaking I just did on purpose -// auto bryantAngles = std::make_shared>(); -// bryantAngles->setRotOrder(1, 2, 3); -// bryantAngles->at(0) = asmtPart->bryxs->at(i); -// bryantAngles->at(1) = asmtPart->bryys->at(i); -// bryantAngles->at(2) = asmtPart->bryzs->at(i); -// bryantAngles->calc(); -// auto aA = bryantAngles->aA; -// auto vx = asmtPart->vxs->at(i); -// auto vy = asmtPart->vys->at(i); -// auto vz = asmtPart->vzs->at(i); -// auto omex = asmtPart->omexs->at(i); -// auto omey = asmtPart->omeys->at(i); -// auto omez = asmtPart->omezs->at(i); -// os << id << " "; -// os << x << " " << y << " " << z << " "; -// auto row = aA->at(0); -// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; -// row = aA->at(1); -// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; -// row = aA->at(2); -// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; -// os << vx << " " << vy << " " << vz << " "; -// os << omex << " " << omey << " " << omez << " "; + auto bryantAngles = std::make_shared>(); + bryantAngles->setRotOrder(1, 2, 3); + bryantAngles->at(0) = asmtPart->bryxs->at(i); + bryantAngles->at(1) = asmtPart->bryys->at(i); + bryantAngles->at(2) = asmtPart->bryzs->at(i); + bryantAngles->calc(); + auto aA = bryantAngles->aA; + auto vx = asmtPart->vxs->at(i); + auto vy = asmtPart->vys->at(i); + auto vz = asmtPart->vzs->at(i); + auto omex = asmtPart->omexs->at(i); + auto omey = asmtPart->omeys->at(i); + auto omez = asmtPart->omezs->at(i); + os << id << " "; + os << x << " " << y << " " << z << " "; + auto row = aA->at(0); + os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; + row = aA->at(1); + os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; + row = aA->at(2); + os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; + os << vx << " " << vy << " " << vz << " "; + os << omex << " " << omey << " " << omez << " "; os << std::endl; } diff --git a/OndselSolver/MomentOfInertiaSolver.cpp b/OndselSolver/MomentOfInertiaSolver.cpp index 56401e2..6a6e43e 100644 --- a/OndselSolver/MomentOfInertiaSolver.cpp +++ b/OndselSolver/MomentOfInertiaSolver.cpp @@ -295,7 +295,7 @@ void MbD::MomentOfInertiaSolver::calcJppFromDiagJcmP() //"Eigenvalues are orders from smallest to largest." double average; - auto sortedJ = std::make_shared>(); + auto sortedJ = std::make_shared(); sortedJ->push_back(aJcmP->at(0)->at(0)); sortedJ->push_back(aJcmP->at(1)->at(1)); sortedJ->push_back(aJcmP->at(2)->at(2)); @@ -326,7 +326,7 @@ void MbD::MomentOfInertiaSolver::calcJppFromDiagJcmP() lam2 = average; } } - aJpp = std::make_shared>(ListD{ lam0, lam1, lam2 }); + aJpp = std::make_shared(ListD{ lam0, lam1, lam2 }); } void MbD::MomentOfInertiaSolver::calcJppFromFullJcmP() @@ -351,7 +351,7 @@ void MbD::MomentOfInertiaSolver::calcJppFromFullJcmP() auto phiDiv3 = modifiedArcCos(-q / std::sqrt(-p * p * p)) / 3.0; auto twoSqrtMinusp = 2.0 * std::sqrt(-p); auto piDiv3 = M_PI / 3.0; - auto sortedJ = std::make_shared>(); + auto sortedJ = std::make_shared(); sortedJ->push_back(twoSqrtMinusp * std::cos(phiDiv3)); sortedJ->push_back(twoSqrtMinusp * -std::cos(phiDiv3 + piDiv3)); sortedJ->push_back(twoSqrtMinusp * -std::cos(phiDiv3 - piDiv3)); @@ -382,7 +382,7 @@ void MbD::MomentOfInertiaSolver::calcJppFromFullJcmP() lam2 = average; } } - aJpp = std::make_shared>(ListD{ lam0, lam1, lam2 }); + aJpp = std::make_shared(ListD{ lam0, lam1, lam2 }); } double MbD::MomentOfInertiaSolver::modifiedArcCos(double val) diff --git a/OndselSolver/Part.cpp b/OndselSolver/Part.cpp index 701874c..20e881a 100644 --- a/OndselSolver/Part.cpp +++ b/OndselSolver/Part.cpp @@ -10,9 +10,11 @@ #include "PartFrame.h" #include "System.h" #include "CREATE.h" -#include "DiagonalMatrix.h" #include "EulerParameters.h" #include "PosVelAccData.h" +#include "FullColumn.h" +#include "FullMatrix.h" +#include "DiagonalMatrix.h" using namespace MbD; @@ -41,10 +43,10 @@ void Part::initializeLocally() { partFrame->initializeLocally(); if (m > 0) { - mX = std::make_shared>(3, m); + mX = std::make_shared(3, m); } else { - mX = std::make_shared>(3, 0.0); + mX = std::make_shared(3, 0.0); } } @@ -269,8 +271,8 @@ void Part::fillqsuWeights(DiagMatDsptr diagMat) auto aJiMax = this->root()->maximumMomentOfInertia(); double minw = 1.0e3; double maxw = 1.0e6; - auto wqX = std::make_shared>(3); - auto wqE = std::make_shared>(4); + auto wqX = std::make_shared(3); + auto wqE = std::make_shared(4); if (mMax == 0) { mMax = 1.0; } for (int i = 0; i < 3; i++) { @@ -317,8 +319,8 @@ void Part::fillqsudotWeights(DiagMatDsptr diagMat) if (maxInertia == 0) maxInertia = 1.0; double minw = 1.0e-12 * maxInertia; double maxw = maxInertia; - auto wqXdot = std::make_shared>(3); - auto wqEdot = std::make_shared>(4); + auto wqXdot = std::make_shared(3); + auto wqEdot = std::make_shared(4); for (int i = 0; i < 3; i++) { wqXdot->at(i) = (maxw * m / maxInertia) + minw; @@ -449,11 +451,11 @@ void Part::calcp() pE = mE->timesFullColumn(partFrame->qEdot); } -void Part::calcpdot() -{ - pXdot = mX->timesFullColumn(partFrame->qXddot); - pEdot = mEdot->timesFullColumn(partFrame->qEdot)->plusFullColumn(mE->timesFullColumn(partFrame->qEddot)); -} +//void Part::calcpdot() +//{ +// pXdot = mX->timesFullColumn(partFrame->qXddot); +// pEdot = mEdot->timesFullColumn(partFrame->qEdot)->plusFullColumn(mE->timesFullColumn(partFrame->qEddot)); +//} void Part::calcmEdot() { diff --git a/OndselSolver/Part.h b/OndselSolver/Part.h index 399f18f..df53e94 100644 --- a/OndselSolver/Part.h +++ b/OndselSolver/Part.h @@ -11,14 +11,14 @@ #include #include "Item.h" -#include "FullColumn.h" -#include "FullMatrix.h" +#include "FullColumn.ref.h" +#include "FullMatrix.ref.h" +#include "DiagonalMatrix.ref.h" #include "EulerParametersDot.h" namespace MbD { class System; class PartFrame; - template class DiagonalMatrix; class Part : public Item { @@ -100,7 +100,7 @@ namespace MbD { void fillVelICJacob(SpMatDsptr mat) override; void preAccIC() override; void calcp(); - void calcpdot(); +// void calcpdot(); void calcmEdot(); void calcpTpE(); void calcppTpEpE(); diff --git a/OndselSolver/VelICSolver.cpp b/OndselSolver/VelICSolver.cpp index b36ab99..07f582d 100644 --- a/OndselSolver/VelICSolver.cpp +++ b/OndselSolver/VelICSolver.cpp @@ -59,7 +59,7 @@ void VelICSolver::runBasic() this->assignEquationNumbers(); system->partsJointsMotionsDo([](std::shared_ptr item) { item->useEquationNumbers(); }); auto qsudotOld = std::make_shared>(nqsu); - auto qsudotWeights = std::make_shared>(nqsu); + auto qsudotWeights = std::make_shared(nqsu); errorVector = std::make_shared>(n); jacobian = std::make_shared>(n, n); system->partsJointsMotionsDo([&](std::shared_ptr item) { item->fillqsudot(qsudotOld); }); From d01bf20ef533e4bee9ddff7dcb62abd309c745f3 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Mon, 6 Nov 2023 19:55:34 -0600 Subject: [PATCH 14/17] restored original CMakeList again --- CMakeLists.txt | 601 +++++++++++++++++++++++++++++++++++- OndselSolver/CMakeLists.txt | 24 -- 2 files changed, 598 insertions(+), 27 deletions(-) delete mode 100644 OndselSolver/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0533690..7e77e58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,604 @@ cmake_minimum_required(VERSION 3.16) -project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") +project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -add_subdirectory(OndselSolver) -add_subdirectory(testapp) +include(GNUInstallDirs) + +add_library(OndselSolver STATIC) + +set(ONDSELSOLVER_SRC + OndselSolver/Array.cpp + OndselSolver/FullVector.cpp + OndselSolver/RowTypeMatrix.cpp + OndselSolver/FullColumn.cpp + OndselSolver/FullMatrix.cpp + OndselSolver/FullRow.cpp + OndselSolver/Abs.cpp + OndselSolver/AbsConstraint.cpp + OndselSolver/AccICKineNewtonRaphson.cpp + OndselSolver/AccICNewtonRaphson.cpp + OndselSolver/AccKineNewtonRaphson.cpp + OndselSolver/AccNewtonRaphson.cpp + OndselSolver/AngleJoint.cpp + OndselSolver/AngleZIecJec.cpp + OndselSolver/AngleZIeqcJec.cpp + OndselSolver/AngleZIeqcJeqc.cpp + OndselSolver/AnyGeneralSpline.cpp + OndselSolver/AnyPosICNewtonRaphson.cpp + OndselSolver/ArcSine.cpp + OndselSolver/ArcTan.cpp + OndselSolver/ArcTan2.cpp + OndselSolver/ASMTAnimationParameters.cpp + OndselSolver/ASMTAssembly.cpp + OndselSolver/ASMTConstantGravity.cpp + OndselSolver/ASMTConstraintSet.cpp + OndselSolver/ASMTCylindricalJoint.cpp + OndselSolver/ASMTExtrusion.cpp + OndselSolver/ASMTFixedJoint.cpp + OndselSolver/ASMTForceTorque.cpp + OndselSolver/ASMTGeneralMotion.cpp + OndselSolver/ASMTItem.cpp + OndselSolver/ASMTItemIJ.cpp + OndselSolver/ASMTJoint.cpp + OndselSolver/ASMTKinematicIJ.cpp + OndselSolver/ASMTMarker.cpp + OndselSolver/ASMTMotion.cpp + OndselSolver/ASMTNoRotationJoint.cpp + OndselSolver/ASMTPart.cpp + OndselSolver/ASMTPointInLineJoint.cpp + OndselSolver/ASMTPointInPlaneJoint.cpp + OndselSolver/ASMTPrincipalMassMarker.cpp + OndselSolver/ASMTRefCurve.cpp + OndselSolver/ASMTRefItem.cpp + OndselSolver/ASMTRefPoint.cpp + OndselSolver/ASMTRefSurface.cpp + OndselSolver/ASMTRevoluteJoint.cpp + OndselSolver/ASMTRotationalMotion.cpp + OndselSolver/ASMTSimulationParameters.cpp + OndselSolver/ASMTSpatialContainer.cpp + OndselSolver/ASMTSpatialItem.cpp + OndselSolver/ASMTSphericalJoint.cpp + OndselSolver/ASMTTime.cpp + OndselSolver/ASMTTranslationalJoint.cpp + OndselSolver/ASMTTranslationalMotion.cpp + OndselSolver/ASMTUniversalJoint.cpp + OndselSolver/AtPointConstraintIJ.cpp + OndselSolver/AtPointConstraintIqcJc.cpp + OndselSolver/AtPointConstraintIqcJqc.cpp + OndselSolver/AtPointConstraintIqctJqc.cpp + OndselSolver/AtPointJoint.cpp + OndselSolver/BasicIntegrator.cpp + OndselSolver/BasicQuasiIntegrator.cpp + OndselSolver/BasicUserFunction.cpp + OndselSolver/CADSystem.cpp + OndselSolver/CartesianFrame.cpp + OndselSolver/CompoundJoint.cpp + OndselSolver/Constant.cpp + OndselSolver/ConstantGravity.cpp + OndselSolver/ConstantVelocityJoint.cpp + OndselSolver/Constraint.cpp + OndselSolver/ConstraintIJ.cpp + OndselSolver/ConstVelConstraintIJ.cpp + OndselSolver/ConstVelConstraintIqcJc.cpp + OndselSolver/ConstVelConstraintIqcJqc.cpp + OndselSolver/Cosine.cpp + OndselSolver/CREATE.cpp + OndselSolver/CylindricalJoint.cpp + OndselSolver/CylSphJoint.cpp + OndselSolver/DiagonalMatrix.cpp + OndselSolver/DifferenceOperator.cpp + OndselSolver/DifferentiatedGeneralSpline.cpp + OndselSolver/DirectionCosineConstraintIJ.cpp + OndselSolver/DirectionCosineConstraintIqcJc.cpp + OndselSolver/DirectionCosineConstraintIqcJqc.cpp + OndselSolver/DirectionCosineConstraintIqctJqc.cpp + OndselSolver/DirectionCosineIecJec.cpp + OndselSolver/DirectionCosineIeqcJec.cpp + OndselSolver/DirectionCosineIeqcJeqc.cpp + OndselSolver/DirectionCosineIeqctJeqc.cpp + OndselSolver/DiscontinuityError.cpp + OndselSolver/DispCompIecJecIe.cpp + OndselSolver/DispCompIecJecKec.cpp + OndselSolver/DispCompIecJecKeqc.cpp + OndselSolver/DispCompIecJecO.cpp + OndselSolver/DispCompIeqcJecIe.cpp + OndselSolver/DispCompIeqcJecKeqc.cpp + OndselSolver/DispCompIeqcJecO.cpp + OndselSolver/DispCompIeqcJeqcIe.cpp + OndselSolver/DispCompIeqcJeqcKeqc.cpp + OndselSolver/DispCompIeqcJeqcKeqct.cpp + OndselSolver/DispCompIeqcJeqcO.cpp + OndselSolver/DispCompIeqctJeqcIe.cpp + OndselSolver/DispCompIeqctJeqcKeqct.cpp + OndselSolver/DispCompIeqctJeqcO.cpp + OndselSolver/DistanceConstraintIJ.cpp + OndselSolver/DistanceConstraintIqcJc.cpp + OndselSolver/DistanceConstraintIqcJqc.cpp + OndselSolver/DistanceConstraintIqctJqc.cpp + OndselSolver/DistancexyConstraintIJ.cpp + OndselSolver/DistancexyConstraintIqcJc.cpp + OndselSolver/DistancexyConstraintIqcJqc.cpp + OndselSolver/DistIecJec.cpp + OndselSolver/DistIeqcJec.cpp + OndselSolver/DistIeqcJeqc.cpp + OndselSolver/DistIeqctJeqc.cpp + OndselSolver/DistxyIecJec.cpp + OndselSolver/DistxyIeqcJec.cpp + OndselSolver/DistxyIeqcJeqc.cpp + OndselSolver/DistxyIeqctJeqc.cpp + OndselSolver/EigenDecomposition.cpp + OndselSolver/EndFramec.cpp + OndselSolver/EndFrameqc.cpp + OndselSolver/EndFrameqct.cpp + OndselSolver/EndFrameqct2.cpp + OndselSolver/EulerAngles.cpp + OndselSolver/EulerAnglesDDot.cpp + OndselSolver/EulerAnglesDot.cpp + OndselSolver/EulerAngleszxz.cpp + OndselSolver/EulerAngleszxzDDot.cpp + OndselSolver/EulerAngleszxzDot.cpp + OndselSolver/EulerArray.cpp + OndselSolver/EulerConstraint.cpp + OndselSolver/EulerParameters.cpp + OndselSolver/EulerParametersDDot.cpp + OndselSolver/EulerParametersDot.cpp + OndselSolver/Exponential.cpp + OndselSolver/ExpressionX.cpp + OndselSolver/ExternalSystem.cpp + OndselSolver/FixedJoint.cpp + OndselSolver/ForceTorqueData.cpp + OndselSolver/ForceTorqueItem.cpp + OndselSolver/FullMotion.cpp + OndselSolver/Function.cpp + OndselSolver/FunctionFromData.cpp + OndselSolver/FunctionWithManyArgs.cpp + OndselSolver/FunctionX.cpp + OndselSolver/FunctionXcParameter.cpp + OndselSolver/FunctionXY.cpp + OndselSolver/GearConstraintIJ.cpp + OndselSolver/GearConstraintIqcJc.cpp + OndselSolver/GearConstraintIqcJqc.cpp + OndselSolver/GearJoint.cpp + OndselSolver/GEFullMat.cpp + OndselSolver/GEFullMatFullPv.cpp + OndselSolver/GEFullMatParPv.cpp + OndselSolver/GeneralSpline.cpp + OndselSolver/GESpMat.cpp + OndselSolver/GESpMatFullPv.cpp + OndselSolver/GESpMatFullPvPosIC.cpp + OndselSolver/GESpMatParPv.cpp + OndselSolver/GESpMatParPvMarko.cpp + OndselSolver/GESpMatParPvMarkoFast.cpp + OndselSolver/GESpMatParPvPrecise.cpp + OndselSolver/ICKineIntegrator.cpp + OndselSolver/IndependentVariable.cpp + OndselSolver/InLineJoint.cpp + OndselSolver/InPlaneJoint.cpp + OndselSolver/Integrator.cpp + OndselSolver/IntegratorInterface.cpp + OndselSolver/Item.cpp + OndselSolver/Joint.cpp + OndselSolver/KineIntegrator.cpp + OndselSolver/KinematicIeJe.cpp + OndselSolver/LDUFullMat.cpp + OndselSolver/LDUFullMatParPv.cpp + OndselSolver/LDUSpMat.cpp + OndselSolver/LDUSpMatParPv.cpp + OndselSolver/LDUSpMatParPvMarko.cpp + OndselSolver/LDUSpMatParPvPrecise.cpp + OndselSolver/LinearMultiStepMethod.cpp + OndselSolver/LineInPlaneJoint.cpp + OndselSolver/Ln.cpp + OndselSolver/Log10.cpp + OndselSolver/LogN.cpp + OndselSolver/MarkerFrame.cpp + OndselSolver/MatrixDecomposition.cpp + OndselSolver/MatrixGaussElimination.cpp + OndselSolver/MatrixLDU.cpp + OndselSolver/MatrixSolver.cpp + OndselSolver/MaximumIterationError.cpp + OndselSolver/MbdMath.cpp + OndselSolver/MBDynBlock.cpp + OndselSolver/MBDynBody.cpp + OndselSolver/MBDynControlData.cpp + OndselSolver/MBDynData.cpp + OndselSolver/MBDynElement.cpp + OndselSolver/MBDynInitialValue.cpp + OndselSolver/MBDynItem.cpp + OndselSolver/MBDynJoint.cpp + OndselSolver/MBDynMarker.cpp + OndselSolver/MBDynNode.cpp + OndselSolver/MBDynReference.cpp + OndselSolver/MBDynStructural.cpp + OndselSolver/MBDynSystem.cpp + OndselSolver/MomentOfInertiaSolver.cpp + OndselSolver/Negative.cpp + OndselSolver/NewtonRaphson.cpp + OndselSolver/NewtonRaphsonError.cpp + OndselSolver/NoRotationJoint.cpp + OndselSolver/NotKinematicError.cpp + OndselSolver/Numeric.cpp + OndselSolver/OrbitAnglezIecJec.cpp + OndselSolver/OrbitAnglezIeqcJec.cpp + OndselSolver/OrbitAnglezIeqcJeqc.cpp + OndselSolver/Orientation.cpp + OndselSolver/ParallelAxesJoint.cpp + OndselSolver/Part.cpp + OndselSolver/PartFrame.cpp + OndselSolver/PerpendicularJoint.cpp + OndselSolver/PlanarJoint.cpp + OndselSolver/PointInLineJoint.cpp + OndselSolver/PointInPlaneJoint.cpp + OndselSolver/PosICKineNewtonRaphson.cpp + OndselSolver/PosICNewtonRaphson.cpp + OndselSolver/PosKineNewtonRaphson.cpp + OndselSolver/PosNewtonRaphson.cpp + OndselSolver/PosVelAccData.cpp + OndselSolver/Power.cpp + OndselSolver/PrescribedMotion.cpp + OndselSolver/Product.cpp + OndselSolver/QuasiIntegrator.cpp + OndselSolver/RackPinConstraintIJ.cpp + OndselSolver/RackPinConstraintIqcJc.cpp + OndselSolver/RackPinConstraintIqcJqc.cpp + OndselSolver/RackPinJoint.cpp + OndselSolver/Reciprocal.cpp + OndselSolver/RedundantConstraint.cpp + OndselSolver/RevCylJoint.cpp + OndselSolver/RevoluteJoint.cpp + OndselSolver/ScalarNewtonRaphson.cpp + OndselSolver/ScrewConstraintIJ.cpp + OndselSolver/ScrewConstraintIqcJc.cpp + OndselSolver/ScrewConstraintIqcJqc.cpp + OndselSolver/ScrewJoint.cpp + OndselSolver/SimulationStoppingError.cpp + OndselSolver/Sine.cpp + OndselSolver/SingularMatrixError.cpp + OndselSolver/Solver.cpp + OndselSolver/SparseColumn.cpp + OndselSolver/SparseMatrix.cpp + OndselSolver/SparseRow.cpp + OndselSolver/SparseVector.cpp + OndselSolver/SphericalJoint.cpp + OndselSolver/SphSphJoint.cpp + OndselSolver/StableBackwardDifference.cpp + OndselSolver/StateData.cpp + OndselSolver/Sum.cpp + OndselSolver/Symbolic.cpp + OndselSolver/SymbolicParser.cpp + OndselSolver/SyntaxError.cpp + OndselSolver/System.cpp + OndselSolver/SystemNewtonRaphson.cpp + OndselSolver/SystemSolver.cpp + OndselSolver/Time.cpp + OndselSolver/TooManyTriesError.cpp + OndselSolver/TooSmallStepSizeError.cpp + OndselSolver/Translation.cpp + OndselSolver/TranslationalJoint.cpp + OndselSolver/TranslationConstraintIJ.cpp + OndselSolver/TranslationConstraintIqcJc.cpp + OndselSolver/TranslationConstraintIqcJqc.cpp + OndselSolver/TranslationConstraintIqctJqc.cpp + OndselSolver/Units.cpp + OndselSolver/UniversalJoint.cpp + OndselSolver/UserFunction.cpp + OndselSolver/Variable.cpp + OndselSolver/VectorNewtonRaphson.cpp + OndselSolver/VelICKineSolver.cpp + OndselSolver/VelICSolver.cpp + OndselSolver/VelKineSolver.cpp + OndselSolver/VelSolver.cpp + OndselSolver/ZRotation.cpp + OndselSolver/ZTranslation.cpp +) + +set(ONDSELSOLVER_HEADERS + OndselSolver/Array.h + OndselSolver/FullVector.h + OndselSolver/RowTypeMatrix.h + OndselSolver/FullRow.h + OndselSolver/FullColumn.h + OndselSolver/FullMatrix.h + OndselSolver/Abs.h + OndselSolver/AbsConstraint.h + OndselSolver/AccICKineNewtonRaphson.h + OndselSolver/AccICNewtonRaphson.h + OndselSolver/AccKineNewtonRaphson.h + OndselSolver/AccNewtonRaphson.h + OndselSolver/AngleJoint.h + OndselSolver/AngleZIecJec.h + OndselSolver/AngleZIeqcJec.h + OndselSolver/AngleZIeqcJeqc.h + OndselSolver/AnyGeneralSpline.h + OndselSolver/AnyPosICNewtonRaphson.h + OndselSolver/APIExport.h + OndselSolver/ArcSine.h + OndselSolver/ArcTan.h + OndselSolver/ArcTan2.h + OndselSolver/ASMTAnimationParameters.h + OndselSolver/ASMTAssembly.h + OndselSolver/ASMTConstantGravity.h + OndselSolver/ASMTConstraintSet.h + OndselSolver/ASMTCylindricalJoint.h + OndselSolver/ASMTExtrusion.h + OndselSolver/ASMTFixedJoint.h + OndselSolver/ASMTForceTorque.h + OndselSolver/ASMTGeneralMotion.h + OndselSolver/ASMTItem.h + OndselSolver/ASMTItemIJ.h + OndselSolver/ASMTJoint.h + OndselSolver/ASMTKinematicIJ.h + OndselSolver/ASMTMarker.h + OndselSolver/ASMTMotion.h + OndselSolver/ASMTNoRotationJoint.h + OndselSolver/ASMTPart.h + OndselSolver/ASMTPointInLineJoint.h + OndselSolver/ASMTPointInPlaneJoint.h + OndselSolver/ASMTPrincipalMassMarker.h + OndselSolver/ASMTRefCurve.h + OndselSolver/ASMTRefItem.h + OndselSolver/ASMTRefPoint.h + OndselSolver/ASMTRefSurface.h + OndselSolver/ASMTRevoluteJoint.h + OndselSolver/ASMTRotationalMotion.h + OndselSolver/ASMTSimulationParameters.h + OndselSolver/ASMTSpatialContainer.h + OndselSolver/ASMTSpatialItem.h + OndselSolver/ASMTSphericalJoint.h + OndselSolver/ASMTTime.h + OndselSolver/ASMTTranslationalJoint.h + OndselSolver/ASMTTranslationalMotion.h + OndselSolver/ASMTUniversalJoint.h + OndselSolver/AtPointConstraintIJ.h + OndselSolver/AtPointConstraintIqcJc.h + OndselSolver/AtPointConstraintIqcJqc.h + OndselSolver/AtPointConstraintIqctJqc.h + OndselSolver/AtPointJoint.h + OndselSolver/BasicIntegrator.h + OndselSolver/BasicQuasiIntegrator.h + OndselSolver/BasicUserFunction.h + OndselSolver/CADSystem.h + OndselSolver/CartesianFrame.h + OndselSolver/CompoundJoint.h + OndselSolver/Constant.h + OndselSolver/ConstantGravity.h + OndselSolver/ConstantVelocityJoint.h + OndselSolver/Constraint.h + OndselSolver/ConstraintIJ.h + OndselSolver/ConstVelConstraintIJ.h + OndselSolver/ConstVelConstraintIqcJc.h + OndselSolver/ConstVelConstraintIqcJqc.h + OndselSolver/corecrt_math_defines.h + OndselSolver/Cosine.h + OndselSolver/CREATE.h + OndselSolver/CylindricalJoint.h + OndselSolver/CylSphJoint.h + OndselSolver/DiagonalMatrix.h + OndselSolver/DifferenceOperator.h + OndselSolver/DifferentiatedGeneralSpline.h + OndselSolver/DirectionCosineConstraintIJ.h + OndselSolver/DirectionCosineConstraintIqcJc.h + OndselSolver/DirectionCosineConstraintIqcJqc.h + OndselSolver/DirectionCosineConstraintIqctJqc.h + OndselSolver/DirectionCosineIecJec.h + OndselSolver/DirectionCosineIeqcJec.h + OndselSolver/DirectionCosineIeqcJeqc.h + OndselSolver/DirectionCosineIeqctJeqc.h + OndselSolver/DiscontinuityError.h + OndselSolver/DispCompIecJecIe.h + OndselSolver/DispCompIecJecKec.h + OndselSolver/DispCompIecJecKeqc.h + OndselSolver/DispCompIecJecO.h + OndselSolver/DispCompIeqcJecIe.h + OndselSolver/DispCompIeqcJecKeqc.h + OndselSolver/DispCompIeqcJecO.h + OndselSolver/DispCompIeqcJeqcIe.h + OndselSolver/DispCompIeqcJeqcKeqc.h + OndselSolver/DispCompIeqcJeqcKeqct.h + OndselSolver/DispCompIeqcJeqcO.h + OndselSolver/DispCompIeqctJeqcIe.h + OndselSolver/DispCompIeqctJeqcKeqct.h + OndselSolver/DispCompIeqctJeqcO.h + OndselSolver/DistanceConstraintIJ.h + OndselSolver/DistanceConstraintIqcJc.h + OndselSolver/DistanceConstraintIqcJqc.h + OndselSolver/DistanceConstraintIqctJqc.h + OndselSolver/DistancexyConstraintIJ.h + OndselSolver/DistancexyConstraintIqcJc.h + OndselSolver/DistancexyConstraintIqcJqc.h + OndselSolver/DistIecJec.h + OndselSolver/DistIeqcJec.h + OndselSolver/DistIeqcJeqc.h + OndselSolver/DistIeqctJeqc.h + OndselSolver/DistxyIecJec.h + OndselSolver/DistxyIeqcJec.h + OndselSolver/DistxyIeqcJeqc.h + OndselSolver/DistxyIeqctJeqc.h + OndselSolver/EigenDecomposition.h + OndselSolver/EndFramec.h + OndselSolver/EndFrameqc.h + OndselSolver/EndFrameqct.h + OndselSolver/EndFrameqct2.h + OndselSolver/enum.h + OndselSolver/EulerAngles.h + OndselSolver/EulerAnglesDDot.h + OndselSolver/EulerAnglesDot.h + OndselSolver/EulerAngleszxz.h + OndselSolver/EulerAngleszxzDDot.h + OndselSolver/EulerAngleszxzDot.h + OndselSolver/EulerArray.h + OndselSolver/EulerConstraint.h + OndselSolver/EulerParameters.h + OndselSolver/EulerParametersDDot.h + OndselSolver/EulerParametersDot.h + OndselSolver/Exponential.h + OndselSolver/ExpressionX.h + OndselSolver/ExternalSystem.h + OndselSolver/FixedJoint.h + OndselSolver/ForceTorqueData.h + OndselSolver/ForceTorqueItem.h + OndselSolver/FullMotion.h + OndselSolver/FullRow.h + OndselSolver/Function.h + OndselSolver/FunctionFromData.h + OndselSolver/FunctionWithManyArgs.h + OndselSolver/FunctionX.h + OndselSolver/FunctionXcParameter.h + OndselSolver/FunctionXY.h + OndselSolver/GearConstraintIJ.h + OndselSolver/GearConstraintIqcJc.h + OndselSolver/GearConstraintIqcJqc.h + OndselSolver/GearJoint.h + OndselSolver/GEFullMat.h + OndselSolver/GEFullMatFullPv.h + OndselSolver/GEFullMatParPv.h + OndselSolver/GeneralSpline.h + OndselSolver/GESpMat.h + OndselSolver/GESpMatFullPv.h + OndselSolver/GESpMatFullPvPosIC.h + OndselSolver/GESpMatParPv.h + OndselSolver/GESpMatParPvMarko.h + OndselSolver/GESpMatParPvMarkoFast.h + OndselSolver/GESpMatParPvPrecise.h + OndselSolver/ICKineIntegrator.h + OndselSolver/IndependentVariable.h + OndselSolver/InLineJoint.h + OndselSolver/InPlaneJoint.h + OndselSolver/Integrator.h + OndselSolver/IntegratorInterface.h + OndselSolver/Item.h + OndselSolver/Joint.h + OndselSolver/KineIntegrator.h + OndselSolver/KinematicIeJe.h + OndselSolver/LDUFullMat.h + OndselSolver/LDUFullMatParPv.h + OndselSolver/LDUSpMat.h + OndselSolver/LDUSpMatParPv.h + OndselSolver/LDUSpMatParPvMarko.h + OndselSolver/LDUSpMatParPvPrecise.h + OndselSolver/LinearMultiStepMethod.h + OndselSolver/LineInPlaneJoint.h + OndselSolver/Ln.h + OndselSolver/Log10.h + OndselSolver/LogN.h + OndselSolver/MarkerFrame.h + OndselSolver/MatrixDecomposition.h + OndselSolver/MatrixGaussElimination.h + OndselSolver/MatrixLDU.h + OndselSolver/MatrixSolver.h + OndselSolver/MaximumIterationError.h + OndselSolver/MbdMath.h + OndselSolver/MBDynBlock.h + OndselSolver/MBDynBody.h + OndselSolver/MBDynControlData.h + OndselSolver/MBDynData.h + OndselSolver/MBDynElement.h + OndselSolver/MBDynInitialValue.h + OndselSolver/MBDynItem.h + OndselSolver/MBDynJoint.h + OndselSolver/MBDynMarker.h + OndselSolver/MBDynNode.h + OndselSolver/MBDynReference.h + OndselSolver/MBDynStructural.h + OndselSolver/MBDynSystem.h + OndselSolver/MomentOfInertiaSolver.h + OndselSolver/Negative.h + OndselSolver/NewtonRaphson.h + OndselSolver/NewtonRaphsonError.h + OndselSolver/NoRotationJoint.h + OndselSolver/NotKinematicError.h + OndselSolver/Numeric.h + OndselSolver/OrbitAnglezIecJec.h + OndselSolver/OrbitAnglezIeqcJec.h + OndselSolver/OrbitAnglezIeqcJeqc.h + OndselSolver/Orientation.h + OndselSolver/ParallelAxesJoint.h + OndselSolver/Part.h + OndselSolver/PartFrame.h + OndselSolver/PerpendicularJoint.h + OndselSolver/PlanarJoint.h + OndselSolver/PointInLineJoint.h + OndselSolver/PointInPlaneJoint.h + OndselSolver/PosICKineNewtonRaphson.h + OndselSolver/PosICNewtonRaphson.h + OndselSolver/PosKineNewtonRaphson.h + OndselSolver/PosNewtonRaphson.h + OndselSolver/PosVelAccData.h + OndselSolver/Power.h + OndselSolver/PrescribedMotion.h + OndselSolver/Product.h + OndselSolver/QuasiIntegrator.h + OndselSolver/RackPinConstraintIJ.h + OndselSolver/RackPinConstraintIqcJc.h + OndselSolver/RackPinConstraintIqcJqc.h + OndselSolver/RackPinJoint.h + OndselSolver/Reciprocal.h + OndselSolver/RedundantConstraint.h + OndselSolver/resource.h + OndselSolver/RevCylJoint.h + OndselSolver/RevoluteJoint.h + OndselSolver/ScalarNewtonRaphson.h + OndselSolver/ScrewConstraintIJ.h + OndselSolver/ScrewConstraintIqcJc.h + OndselSolver/ScrewConstraintIqcJqc.h + OndselSolver/ScrewJoint.h + OndselSolver/SimulationStoppingError.h + OndselSolver/Sine.h + OndselSolver/SingularMatrixError.h + OndselSolver/Solver.h + OndselSolver/SparseColumn.h + OndselSolver/SparseMatrix.h + OndselSolver/SparseRow.h + OndselSolver/SparseVector.h + OndselSolver/SphericalJoint.h + OndselSolver/SphSphJoint.h + OndselSolver/StableBackwardDifference.h + OndselSolver/StateData.h + OndselSolver/Sum.h + OndselSolver/Symbolic.h + OndselSolver/SymbolicParser.h + OndselSolver/SyntaxError.h + OndselSolver/System.h + OndselSolver/SystemNewtonRaphson.h + OndselSolver/SystemSolver.h + OndselSolver/Time.h + OndselSolver/TooManyTriesError.h + OndselSolver/TooSmallStepSizeError.h + OndselSolver/Translation.h + OndselSolver/TranslationalJoint.h + OndselSolver/TranslationConstraintIJ.h + OndselSolver/TranslationConstraintIqcJc.h + OndselSolver/TranslationConstraintIqcJqc.h + OndselSolver/TranslationConstraintIqctJqc.h + OndselSolver/Units.h + OndselSolver/UniversalJoint.h + OndselSolver/UserFunction.h + OndselSolver/Variable.h + OndselSolver/VectorNewtonRaphson.h + OndselSolver/VelICKineSolver.h + OndselSolver/VelICSolver.h + OndselSolver/VelKineSolver.h + OndselSolver/VelSolver.h + OndselSolver/ZRotation.h + OndselSolver/ZTranslation.h +) + +target_sources(OndselSolver PRIVATE + "${ONDSELSOLVER_SRC}" + "${ONDSELSOLVER_HEADERS}") + +set_target_properties(OndselSolver + PROPERTIES VERSION ${PROJECT_VERSION} + SOVERSION 1 + PUBLIC_HEADER "${ONDSELSOLVER_HEADERS}" +) + +configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) +install(TARGETS OndselSolver + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) +install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) \ No newline at end of file diff --git a/OndselSolver/CMakeLists.txt b/OndselSolver/CMakeLists.txt deleted file mode 100644 index a5ad462..0000000 --- a/OndselSolver/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED True) - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-4") - -include(GNUInstallDirs) - -file(GLOB ONDSELSOLVER_SOURCES "*.cpp") -file(GLOB ONDSELSOLVER_HEADERS "*.h") -add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) -target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}) - -#target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) - -#configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) -#install(TARGETS OndselSolver -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) -#install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc -# DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) From 274527102badc4480959dd64f6a4fa151c4d6123 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Tue, 7 Nov 2023 14:19:19 -0600 Subject: [PATCH 15/17] make lib shared; resolved FullRow method ;fixed spelling errors --- CMakeLists.txt | 2 +- OndselSolver/CREATE.h | 2 +- OndselSolver/FullRow.cpp | 4 ++-- OndselSolver/FullRow.h | 2 +- OndselSolver/FullVector.h | 5 +++-- OndselSolver/RedundantConstraint.cpp | 2 +- OndselSolver/StableBackwardDifference.cpp | 2 +- testapp/circular.asmt | 2 +- testapp/gyro.asmt | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e77e58..f0dc291 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) include(GNUInstallDirs) -add_library(OndselSolver STATIC) +add_library(OndselSolver SHARED) set(ONDSELSOLVER_SRC OndselSolver/Array.cpp diff --git a/OndselSolver/CREATE.h b/OndselSolver/CREATE.h index 67bdf9a..099af9b 100644 --- a/OndselSolver/CREATE.h +++ b/OndselSolver/CREATE.h @@ -6,7 +6,7 @@ * See LICENSE file for details about copyright. * ***************************************************************************/ -//This header file causes wierd problems in Visual Studio when included in subclasses of std::vector or std::map. Why? +//This header file causes weird problems in Visual Studio when included in subclasses of std::vector or std::map. Why? #pragma once diff --git a/OndselSolver/FullRow.cpp b/OndselSolver/FullRow.cpp index 2716599..5e49af8 100644 --- a/OndselSolver/FullRow.cpp +++ b/OndselSolver/FullRow.cpp @@ -10,8 +10,8 @@ #include "FullMatrix.h" namespace MbD { - template - std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) + template<> + std::shared_ptr FullRow::transposeTimesFullRow(FRowsptr fullRow) { //"a*b = a(i)b(j)" auto nrow = (int)this->size(); diff --git a/OndselSolver/FullRow.h b/OndselSolver/FullRow.h index 8d9ecca..7dfe096 100644 --- a/OndselSolver/FullRow.h +++ b/OndselSolver/FullRow.h @@ -37,7 +37,7 @@ namespace MbD { void atiplusFullRow(int j, FRowsptr fullRow); std::ostream& printOn(std::ostream& s) const override; - std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); + std::shared_ptr transposeTimesFullRow(FRowsptr fullRow); FRowsptr timesTransposeFullMatrix(std::shared_ptr fullMat); // FRowsptr> timesTransposeFullMatrixForFMFMDsptr(std::shared_ptr fullMat); FRowsptr timesFullMatrix(std::shared_ptr fullMat); diff --git a/OndselSolver/FullVector.h b/OndselSolver/FullVector.h index 53b3d4c..5a98b61 100644 --- a/OndselSolver/FullVector.h +++ b/OndselSolver/FullVector.h @@ -178,8 +178,9 @@ namespace MbD { template inline void FullVector::conditionSelfWithTol(double tol) { - assert(false); - return; + assert(false && tol != tol); // clang++ flips out with warnings if you don't use 'tol' + // but suppressing that warning breaks Visual Studio. + return; // Visual Studio demands the unused return } template inline std::ostream& FullVector::printOn(std::ostream& s) const diff --git a/OndselSolver/RedundantConstraint.cpp b/OndselSolver/RedundantConstraint.cpp index dd7c595..d1190d5 100644 --- a/OndselSolver/RedundantConstraint.cpp +++ b/OndselSolver/RedundantConstraint.cpp @@ -105,7 +105,7 @@ void RedundantConstraint::setqsuddotlam(FColDsptr col) void RedundantConstraint::discontinuityAtaddTypeTo(double t, std::shared_ptr> disconTypes) { - //"Reactivate all contraints." + //"Reactivate all constraints." assert(false); //| newSelf | //newSelf : = self constraint. diff --git a/OndselSolver/StableBackwardDifference.cpp b/OndselSolver/StableBackwardDifference.cpp index 09c07e3..89dc329 100644 --- a/OndselSolver/StableBackwardDifference.cpp +++ b/OndselSolver/StableBackwardDifference.cpp @@ -12,7 +12,7 @@ using namespace MbD; void StableBackwardDifference::formTaylorMatrix() { - //This form is numerically more stable and is prefered over the full Taylor Matrix. + //This form is numerically more stable and is preferred over the full Taylor Matrix. //For method order 3: //| (t1 - t) (t1 - t) ^ 2 / 2! (t1 - t) ^ 3 / 3!| |qd(t) | = | q(t1) - q(t) | //| (t2 - t) (t2 - t) ^ 2 / 2! (t2 - t) ^ 3 / 3!| |qdd(t) | |q(t2) - q(t) | diff --git a/testapp/circular.asmt b/testapp/circular.asmt index 3442374..55a9c51 100644 --- a/testapp/circular.asmt +++ b/testapp/circular.asmt @@ -1,7 +1,7 @@ freeCAD: 3D CAD with Motion Simulation by askoh.com Assembly Notes - (Text string: 'Copyright (C) 2000-2004, A-S Koh, All Rights Reserved.The Tree View is on the left.The Graphics View is on the right.The Selection View is at the bottom left.The XYZ axes are colored Red Green Blue (RGB). The default world axes are one meter long (about 40 inches).Units are SI units. Angles are in radians unless stated to be in degrees.A rectangular beam is connected to ground with a revolute (pin) joint which allows rotation in the XY plane. A motion is applied to the joint to rotate the beam with constant angular velocity. A similar beam is made to rotate in a plane parallel to the YZ plane. Units are SI units. Angles are in radians.To load the example for a quick look:Click/File/Open/Assembly/ to get a dialog. Enter *.asm for a list of assemblies. Select circular.asm. Click/OK. The projectiles should appear on the screen.Click /Edit/Marker Size/ to set a suitable length for the marker axes.Click ''Wireframe'' and ''Solid'' to switch between wireframe and rendered views.Click ''TiltRotate'' to show all. Drag on the handles to orientate the assembly in 3D. Tilt means tilting away from the line from the eye to the handle.Click ''ZoomIn'' and drag a rectangle over the region of interest to zoom in.Click ''Animation'' to get a dialog. Click Play to animate.Click ''TiltRotate'' to show all or ''ZoomOut'' to see more.You can use any of the View menu items during animation to change you view.Click Stop to stop the animation.To create the assembly from scratch:Click/File/New/Assembly/ to create an empty assembly. A dialog allows you to specify a unique name (Assembly1).To create the first beam:Click on (Assembly1) in the Tree View if it is not already selected.Click/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Part/New/ to insert a part on the selected plane. A dialog allows you to specify a unique name (Part1).Click/Insert/Sketch/ to insert a sketch on the new part. A dialog allows you to specify a unique name (Sketch1).Click/Draw/Rectangle/ to select the rectangle tool. In the drawing area, click and drag toward the positive quadrant (increasing x and y) to create a rectangle. Click inside the rectangle if three black handles are not visible, RightClick/Position/Angle/ to get a dialog to specify the rectangle position (0.0d, 0.0d), angle (0.0d) and size (2.0d, 0.2d) precisely.Click/Insert/Feature/Extrusion/ to extrude the drawing perpendicular to the sketch plane. A dialog allows you to specify the z coordinates for extrusion (0.0d, 0.1d).Click ''WireFrame'' to make mass marker visible. Click the mass marker, RightClick/Position/Direction/ to get a dialog to specify its mass and inertias precisely. Click/''Apply Uniform Density''. Enter the density (10.0d).To connect the beam to the assembly with a revolute (pin) joint:To mark the joint attachment point on the assembly:Drag the beam to the upper right to clear up the area near the origin.Select Assembly1 from the Tree View.Click/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin.To mark the joint attachment point on the beam:Click on the wide face of the beam to hightlight it.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the face origin. The marker is referenced to the face which becomes the marker''s guide frame.RightClick/Position/Direction/ over the marker to get a dialog to specify the exact placement of the marker on the part. Enter the coordinates of the marker origin relative to the guide frame. (0.1d, 0.1d, 0.0d). No need to change the other values.To create the joint:Click/Kinematic/Joint/RevoluteZ/ to select the revolute (pin) joint tool. Click on the assembly marker, drag to the part marker, and release the button. A dialog allows you to specify a unique name (Joint1). A rubber band connects the ''i'' and ''j'' markers with an label ''rev'' to denote the revolute joint. A revolute joint constraints the origins of ''i'' and ''j'' to be coincident and the z axes of ''i'' and ''j'' to be colinear. Only one rotational degree of freedom exists between ''i'' and ''j''.To apply a motion to the joint:Click/Kinematic/Motion/RotationZ/ to select the z rotation tool. Click on a revolute joint rubber band. A dialog allows you to specify a unique name (Motion1). A second dialog allows you to specify a function of time describing the angle of the ''j'' x-axis relative to the ''i'' x-axis. Enter 2.0d*pi*time. Click/OK. Another rubber band is superposed on the joint but the new label is ''rmo''. If you want to change the function, click the ''rmo'' label. The superposition of the rubber bands can make it difficult to select the desired item. This problem can be overcomed by selecting the desired item directly from the Tree View.You have just learned the basics of creating markers, connections and prescribed motions.To simulate:Click/Simulation/Transient/ to start a simulation. Click/''current state'' for the desired input state. In the next dialog, set the desired end time (1.0d) and output time step (0.01d) of the simulation. The other default parameters should be acceptable.Click/OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click/Simulation/Stop/ to terminate the simulation anytime.To animate:Click ''Animation'' for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click/Stop to stop the animation.To plot marker data:If a suitable marker is not available, insert a marker anywhere on the part. Click on the marker, RightClick/Plot/, a new plot window appears. Click/Plot/Select/ to get a dialog to specify the data for the x and y axes. Multiply select with shift-click or control-click for the y-axis. Click/OK to get the plots. You can export the plot data in tabular form: Click/Plot/Export/ to specify an output filename. The file can be imported into a spreadsheet for further analysis.To plot joint or motion data:Select a joint or motion from the Tree or Graphic Views. RightClick/Plot/ and follow the same procedure for marker data.To add the second beam:Since the second beam is the same as the first, we will reuse.Select \Assembly1\Part1 in the Tree View. Expand the tree as necessary to reach Part1.Click/File/Save As/Part to save the selected part to file. Enter a filename with .prt extension (Part1.prt).Select Assembly1 in the Tree ViewClick/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Part/File/ to insert a part from file. A dialog allows you to specify a unique name (Part2). Another dialog allows you to select the file Part1.prt. The second beam is inserted at the assembly origin.To connect the second beam to the assembly with a revolute (pin) joint:To mark the second joint attachment point on the assembly:Select Assembly1 in the Tree ViewClick/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker2). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin. Drag the handle to move the new marker away from the origin.Click on the marker if it does not have a black handle, RightClick/Position/Direction/ to get a dialog to specify the exact placement of the marker in the assembly. Enter the coordinates of the marker origin relative to the assembly (3.0d, 0.0d, 0.0d). Orient the z-axis to (-1.0d, 0.0d, 0.0d). Orient the x-axis to (0.0d, 0.0d, 1.0d). To mark the joint attachment point on the second beam:The marker on the second beam is ready for attachment. Drag, tilt and rotate the second beam so the the markers for joint attachment are nearby and nearly parallel. This will help the solver find the exact answer.To create the second joint:Click/Kinematic/Joint/RevoluteZ/ to select the revolute (pin) joint tool. Click on \Assembly1\Marker2, drag to the \Assembly1\Part2\Marker1, and release the button. A dialog allows you to specify a unique name (Joint2). A rubber band connects the ''i'' and ''j'' markers with an label ''rev'' to denote the revolute joint.To apply a motion to the second joint:Click/Kinematic/Motion/RotationZ/ to select the z rotation tool. Click on a revolute joint rubber band (Joint2). A dialog allows you to specify a unique name (Motion2). A second dialog allows you to specify a function of time describing the angle of the ''j'' x-axis relative to the ''i'' x-axis. Enter 4.0d*pi*time to make the motion twice as fast as the first one. Click/OK. Another rubber band is superposed on the joint but the new label is ''rmo''. If you want to change the function, click the ''rmo'' label. The superposition of the rubber bands can make it difficult to select the desired item. This problem can be overcomed by selecting the desired item directly from the Tree View.To simulate:Click/Simulation/Transient/ to start a simulation. Click/''current state'' for the desired input state. In the next dialog, set the desired end time (1.0d) and output time step (0.01d) of the simulation. The other default parameters should be acceptable.Click/OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click/Simulation/Stop/ to terminate the simulation anytime.To animate:Click ''Animation'' for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click/Stop to stop the animation. Close the window when done.' runs: (Core.RunArray runs: #(654 37 1 25 63 12 3 8 53 18 54 9 7 5 57 10 141 6 70 9 19 10 20 10 18 7 38 4 55 4 25 36 1 24 89 25 70 27 41 22 95 20 93 21 208 26 114 31 144 9 55 30 61 29 31 64 1 51 109 27 41 20 145 47 54 20 217 30 221 20 1 32 47 1 225 118 68 31 1 33 272 8 314 89 2 12 1 27 24 21 183 8 215 22 39 11 6 12 141 4 34 10 25 20 99 16 29 18 125 8 65 18 99 29 58 16 49 23 151 23 121 27 41 23 192 71 1 58 35 27 41 20 261 30 255 54 216 27 1 32 286 38 1 33 331 8 314 12 1 27 24 21 183 8 136 4 75 22 39 11 6 12 179 10 54) values: #(nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #underline nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil))) + (Text string: 'Copyright (C) 2000-2004, A-S Koh, All Rights Reserved.The Tree View is on the left.The Graphics View is on the right.The Selection View is at the bottom left.The XYZ axes are colored Red Green Blue (RGB). The default world axes are one meter long (about 40 inches).Units are SI units. Angles are in radians unless stated to be in degrees.A rectangular beam is connected to ground with a revolute (pin) joint which allows rotation in the XY plane. A motion is applied to the joint to rotate the beam with constant angular velocity. A similar beam is made to rotate in a plane parallel to the YZ plane. Units are SI units. Angles are in radians.To load the example for a quick look:Click/File/Open/Assembly/ to get a dialog. Enter *.asm for a list of assemblies. Select circular.asm. Click/OK. The projectiles should appear on the screen.Click /Edit/Marker Size/ to set a suitable length for the marker axes.Click ''Wireframe'' and ''Solid'' to switch between wireframe and rendered views.Click ''TiltRotate'' to show all. Drag on the handles to orientate the assembly in 3D. Tilt means tilting away from the line from the eye to the handle.Click ''ZoomIn'' and drag a rectangle over the region of interest to zoom in.Click ''Animation'' to get a dialog. Click Play to animate.Click ''TiltRotate'' to show all or ''ZoomOut'' to see more.You can use any of the View menu items during animation to change you view.Click Stop to stop the animation.To create the assembly from scratch:Click/File/New/Assembly/ to create an empty assembly. A dialog allows you to specify a unique name (Assembly1).To create the first beam:Click on (Assembly1) in the Tree View if it is not already selected.Click/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Part/New/ to insert a part on the selected plane. A dialog allows you to specify a unique name (Part1).Click/Insert/Sketch/ to insert a sketch on the new part. A dialog allows you to specify a unique name (Sketch1).Click/Draw/Rectangle/ to select the rectangle tool. In the drawing area, click and drag toward the positive quadrant (increasing x and y) to create a rectangle. Click inside the rectangle if three black handles are not visible, RightClick/Position/Angle/ to get a dialog to specify the rectangle position (0.0d, 0.0d), angle (0.0d) and size (2.0d, 0.2d) precisely.Click/Insert/Feature/Extrusion/ to extrude the drawing perpendicular to the sketch plane. A dialog allows you to specify the z coordinates for extrusion (0.0d, 0.1d).Click ''WireFrame'' to make mass marker visible. Click the mass marker, RightClick/Position/Direction/ to get a dialog to specify its mass and inertias precisely. Click/''Apply Uniform Density''. Enter the density (10.0d).To connect the beam to the assembly with a revolute (pin) joint:To mark the joint attachment point on the assembly:Drag the beam to the upper right to clear up the area near the origin.Select Assembly1 from the Tree View.Click/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin.To mark the joint attachment point on the beam:Click on the wide face of the beam to highlight it.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the face origin. The marker is referenced to the face which becomes the marker''s guide frame.RightClick/Position/Direction/ over the marker to get a dialog to specify the exact placement of the marker on the part. Enter the coordinates of the marker origin relative to the guide frame. (0.1d, 0.1d, 0.0d). No need to change the other values.To create the joint:Click/Kinematic/Joint/RevoluteZ/ to select the revolute (pin) joint tool. Click on the assembly marker, drag to the part marker, and release the button. A dialog allows you to specify a unique name (Joint1). A rubber band connects the ''i'' and ''j'' markers with an label ''rev'' to denote the revolute joint. A revolute joint constraints the origins of ''i'' and ''j'' to be coincident and the z axes of ''i'' and ''j'' to be colinear. Only one rotational degree of freedom exists between ''i'' and ''j''.To apply a motion to the joint:Click/Kinematic/Motion/RotationZ/ to select the z rotation tool. Click on a revolute joint rubber band. A dialog allows you to specify a unique name (Motion1). A second dialog allows you to specify a function of time describing the angle of the ''j'' x-axis relative to the ''i'' x-axis. Enter 2.0d*pi*time. Click/OK. Another rubber band is superposed on the joint but the new label is ''rmo''. If you want to change the function, click the ''rmo'' label. The superposition of the rubber bands can make it difficult to select the desired item. This problem can be overcomed by selecting the desired item directly from the Tree View.You have just learned the basics of creating markers, connections and prescribed motions.To simulate:Click/Simulation/Transient/ to start a simulation. Click/''current state'' for the desired input state. In the next dialog, set the desired end time (1.0d) and output time step (0.01d) of the simulation. The other default parameters should be acceptable.Click/OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click/Simulation/Stop/ to terminate the simulation anytime.To animate:Click ''Animation'' for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click/Stop to stop the animation.To plot marker data:If a suitable marker is not available, insert a marker anywhere on the part. Click on the marker, RightClick/Plot/, a new plot window appears. Click/Plot/Select/ to get a dialog to specify the data for the x and y axes. Multiply select with shift-click or control-click for the y-axis. Click/OK to get the plots. You can export the plot data in tabular form: Click/Plot/Export/ to specify an output filename. The file can be imported into a spreadsheet for further analysis.To plot joint or motion data:Select a joint or motion from the Tree or Graphic Views. RightClick/Plot/ and follow the same procedure for marker data.To add the second beam:Since the second beam is the same as the first, we will reuse.Select \Assembly1\Part1 in the Tree View. Expand the tree as necessary to reach Part1.Click/File/Save As/Part to save the selected part to file. Enter a filename with .prt extension (Part1.prt).Select Assembly1 in the Tree ViewClick/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Part/File/ to insert a part from file. A dialog allows you to specify a unique name (Part2). Another dialog allows you to select the file Part1.prt. The second beam is inserted at the assembly origin.To connect the second beam to the assembly with a revolute (pin) joint:To mark the second joint attachment point on the assembly:Select Assembly1 in the Tree ViewClick/Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click/Insert/Marker/. A dialog allows you to specify a unique name (Marker2). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin. Drag the handle to move the new marker away from the origin.Click on the marker if it does not have a black handle, RightClick/Position/Direction/ to get a dialog to specify the exact placement of the marker in the assembly. Enter the coordinates of the marker origin relative to the assembly (3.0d, 0.0d, 0.0d). Orient the z-axis to (-1.0d, 0.0d, 0.0d). Orient the x-axis to (0.0d, 0.0d, 1.0d). To mark the joint attachment point on the second beam:The marker on the second beam is ready for attachment. Drag, tilt and rotate the second beam so the the markers for joint attachment are nearby and nearly parallel. This will help the solver find the exact answer.To create the second joint:Click/Kinematic/Joint/RevoluteZ/ to select the revolute (pin) joint tool. Click on \Assembly1\Marker2, drag to the \Assembly1\Part2\Marker1, and release the button. A dialog allows you to specify a unique name (Joint2). A rubber band connects the ''i'' and ''j'' markers with an label ''rev'' to denote the revolute joint.To apply a motion to the second joint:Click/Kinematic/Motion/RotationZ/ to select the z rotation tool. Click on a revolute joint rubber band (Joint2). A dialog allows you to specify a unique name (Motion2). A second dialog allows you to specify a function of time describing the angle of the ''j'' x-axis relative to the ''i'' x-axis. Enter 4.0d*pi*time to make the motion twice as fast as the first one. Click/OK. Another rubber band is superposed on the joint but the new label is ''rmo''. If you want to change the function, click the ''rmo'' label. The superposition of the rubber bands can make it difficult to select the desired item. This problem can be overcomed by selecting the desired item directly from the Tree View.To simulate:Click/Simulation/Transient/ to start a simulation. Click/''current state'' for the desired input state. In the next dialog, set the desired end time (1.0d) and output time step (0.01d) of the simulation. The other default parameters should be acceptable.Click/OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click/Simulation/Stop/ to terminate the simulation anytime.To animate:Click ''Animation'' for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click/Stop to stop the animation. Close the window when done.' runs: (Core.RunArray runs: #(654 37 1 25 63 12 3 8 53 18 54 9 7 5 57 10 141 6 70 9 19 10 20 10 18 7 38 4 55 4 25 36 1 24 89 25 70 27 41 22 95 20 93 21 208 26 114 31 144 9 55 30 61 29 31 64 1 51 109 27 41 20 145 47 54 20 217 30 221 20 1 32 47 1 225 118 68 31 1 33 272 8 314 89 2 12 1 27 24 21 183 8 215 22 39 11 6 12 141 4 34 10 25 20 99 16 29 18 125 8 65 18 99 29 58 16 49 23 151 23 121 27 41 23 192 71 1 58 35 27 41 20 261 30 255 54 216 27 1 32 286 38 1 33 331 8 314 12 1 27 24 21 183 8 136 4 75 22 39 11 6 12 179 10 54) values: #(nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #underline nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil))) Name Assembly1 Position3D diff --git a/testapp/gyro.asmt b/testapp/gyro.asmt index bc41851..92e87a2 100644 --- a/testapp/gyro.asmt +++ b/testapp/gyro.asmt @@ -1,7 +1,7 @@ freeCAD: 3D CAD with Motion Simulation by askoh.com Assembly Notes - (Text string: 'CAD: Copyright (C) 2000-2004, Aik-Siong Koh, All Rights Reserved.A cylinder is connected to ground with a spherical (ball) joint. Its axis passes through the joint. Gravity acts in the negative y direction. While held in the horizontal position, the cylinder is set spinning about its axis at high speed. Then it is released. Gyroscopic and gravitational forces cause the spinning cylinder to precess (rotate about the vertical) and nutate (bop up and down). Units are SI units. Angles are in radians.If the instructions below are too brief, refer to the Notes in projectile.asm and circular.asm.To load the example for a quick look:Click File/Open/Assembly/ to get a dialog. Enter *.asm for a list of assemblies. Select gyro.asm. To create the assembly from scratch:To create a cylindrical rotor:Click File/New/Assembly/ to create an empty assembly. A dialog allows you to specify a unique name (Assembly1).Click Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click Insert/Part/New/ to insert a part on the selected plane. A dialog allows you to specify a unique name (Part1).Click Insert/Sketch/ to insert a sketch on the new part. A dialog allows you to specify a unique name (Sketch1).Click Draw/Circle/ to select the circle tool. In the drawing area, click and drag to create a circle. RightClick/Position/Angle/ over the circle to get a dialog to specify the circle position (0.0d, 0.0d, 0.0d), angle (0.0d) and size (0.5d, 0.5d) precisely.Click Insert/Feature/Extrusion/ to extrude the drawing perpendicular to the sketch plane. A dialog allows you to specify the z coordinates for extrusion (0.0d, 1.0d).RightClick/Position/Direction/ over the part mass marker to get a dialog to specify its mass and inertias precisely. Click ''Apply Uniform Density''. Enter the density (10.0d).To connect the rotor to the assembly with a spherical joint:To mark the joint attachment point on the assembly:Drag the cylinder to the upper right to clear up the area near the origin.Click Select/Assembly/Assembly1/ to reselect the assembly named Assembly1.Click Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin.To mark the joint attachment point on the rotor:Click on the z face of the cylinder to hightlight it.Click Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the face origin. The marker is referenced to the face which becomes the marker''s guide frame.RightClick/Position/Direction/ to get a dialog to specify the exact placement of the marker on the part. Enter the coordinates of the marker origin relative to the guide frame. (0.0d, 0.0d, -2.0d). No need to change the other values. Tilt the cylinder slightly to get a good view of the marker.To create a spherical joint:The goal now is to connect the part to the assembly with a spherical (pin) joint.Click Kinematic/Joint/Spherical/ to select the spherical joint tool. Click on the assembly marker, drag to the part marker, and release the button. A dialog allows you to specify a unique name (Joint1). A rubber band connects the ''i'' and ''j'' markers with an label ''sph'' to denote the spherical joint.To set initial conditions:RightClick/PositionPart/Direction/ over the marker (Assembly1Part1Marker1) to get a dialog to specify its absolute position and orientation in space precisely. Enter the absolute coordinates of the marker origin in space (0.0d, 0.0d, 0.0d). Enter the marker z-axis direction in absolute coordinates (0.0d, 0.0d, 1.0d). Do not worry about the magnitude as only the direction is important. Enter the direction of a vector in the marker x-z plane in absolute coordinates (1.0d, 0.0d, 0.0d).RightClick/Velocity/ over the marker (Assembly1Part1Marker1) to get a dialog to specify its absolute velocity in space precisely. Enter velocity of marker origin in absolute components (0.0d, 0.0d, 0.0d). Enter the angular velocity of the marker in absolute components (0.0d, 0.0d, 3600.0d).To set gravity:Click Dynamic/Gravity/ for the gravity dialog. Enter (0.0d, -9.81d, 0.0d).To simulate:Click Simulation/Dynamics/ to start a simulation. Click ''current state'' for the desired input state. In the subsequent dialog, set the desired end time (10.0d) and output time step (0.05d) of the simulation. The other default parameters should be acceptable.Click OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click Simulation/Stop/ to terminate the simulation anytime.To animate:Click Simulation/Animation/ for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click Stop to stop the animation. Close the window when done.To plot:Click Simulation/Plot/ for a list of items that can have plots. Select a marker (Assembly1Part1MassMarker). A new plot window appears. Click Plot/Select/ to get a dialog to specify the data for the x and y axes. Multiply select with shift-click or control-click for the y-axis. Click OK to get the plots. You can export the plot data in tabular form: Click Plot/Export/ to specify an output filename. The file can be imported into a spreadsheet for further analysis.' runs: (Core.RunArray runs: #(505 63 14 5 12 1 2 37 89 8 4 36 1 30 1013 60 1 51 384 48 588 28 385 26 782 15 77 12 544 11 270 8 468) values: #(nil #underline #(#underline #bold) #underline #(#underline #bold) #underline nil #(#bold #large) nil #bold nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil))) + (Text string: 'CAD: Copyright (C) 2000-2004, Aik-Siong Koh, All Rights Reserved.A cylinder is connected to ground with a spherical (ball) joint. Its axis passes through the joint. Gravity acts in the negative y direction. While held in the horizontal position, the cylinder is set spinning about its axis at high speed. Then it is released. Gyroscopic and gravitational forces cause the spinning cylinder to precess (rotate about the vertical) and nutate (bop up and down). Units are SI units. Angles are in radians.If the instructions below are too brief, refer to the Notes in projectile.asm and circular.asm.To load the example for a quick look:Click File/Open/Assembly/ to get a dialog. Enter *.asm for a list of assemblies. Select gyro.asm. To create the assembly from scratch:To create a cylindrical rotor:Click File/New/Assembly/ to create an empty assembly. A dialog allows you to specify a unique name (Assembly1).Click Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click Insert/Part/New/ to insert a part on the selected plane. A dialog allows you to specify a unique name (Part1).Click Insert/Sketch/ to insert a sketch on the new part. A dialog allows you to specify a unique name (Sketch1).Click Draw/Circle/ to select the circle tool. In the drawing area, click and drag to create a circle. RightClick/Position/Angle/ over the circle to get a dialog to specify the circle position (0.0d, 0.0d, 0.0d), angle (0.0d) and size (0.5d, 0.5d) precisely.Click Insert/Feature/Extrusion/ to extrude the drawing perpendicular to the sketch plane. A dialog allows you to specify the z coordinates for extrusion (0.0d, 1.0d).RightClick/Position/Direction/ over the part mass marker to get a dialog to specify its mass and inertias precisely. Click ''Apply Uniform Density''. Enter the density (10.0d).To connect the rotor to the assembly with a spherical joint:To mark the joint attachment point on the assembly:Drag the cylinder to the upper right to clear up the area near the origin.Click Select/Assembly/Assembly1/ to reselect the assembly named Assembly1.Click Select/Plane/x=X y=Y/ to select the XY plane of the assembly.Click Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the assembly origin.To mark the joint attachment point on the rotor:Click on the z face of the cylinder to highlight it.Click Insert/Marker/. A dialog allows you to specify a unique name (Marker1). A RedGreenBlue (RGB) marker representing the xyz axes appears at the face origin. The marker is referenced to the face which becomes the marker''s guide frame.RightClick/Position/Direction/ to get a dialog to specify the exact placement of the marker on the part. Enter the coordinates of the marker origin relative to the guide frame. (0.0d, 0.0d, -2.0d). No need to change the other values. Tilt the cylinder slightly to get a good view of the marker.To create a spherical joint:The goal now is to connect the part to the assembly with a spherical (pin) joint.Click Kinematic/Joint/Spherical/ to select the spherical joint tool. Click on the assembly marker, drag to the part marker, and release the button. A dialog allows you to specify a unique name (Joint1). A rubber band connects the ''i'' and ''j'' markers with an label ''sph'' to denote the spherical joint.To set initial conditions:RightClick/PositionPart/Direction/ over the marker (Assembly1Part1Marker1) to get a dialog to specify its absolute position and orientation in space precisely. Enter the absolute coordinates of the marker origin in space (0.0d, 0.0d, 0.0d). Enter the marker z-axis direction in absolute coordinates (0.0d, 0.0d, 1.0d). Do not worry about the magnitude as only the direction is important. Enter the direction of a vector in the marker x-z plane in absolute coordinates (1.0d, 0.0d, 0.0d).RightClick/Velocity/ over the marker (Assembly1Part1Marker1) to get a dialog to specify its absolute velocity in space precisely. Enter velocity of marker origin in absolute components (0.0d, 0.0d, 0.0d). Enter the angular velocity of the marker in absolute components (0.0d, 0.0d, 3600.0d).To set gravity:Click Dynamic/Gravity/ for the gravity dialog. Enter (0.0d, -9.81d, 0.0d).To simulate:Click Simulation/Dynamics/ to start a simulation. Click ''current state'' for the desired input state. In the subsequent dialog, set the desired end time (10.0d) and output time step (0.05d) of the simulation. The other default parameters should be acceptable.Click OK to start the simulation. The simulation progress is shown in the Transcript window and animated in the drawing. You can use any of the View menu items during the simulation. Let the simulation run to completion or Click Simulation/Stop/ to terminate the simulation anytime.To animate:Click Simulation/Animation/ for a animation control window to play the animation, step frame by frame, jump to the specified current frame. You can also use any of the View menu items during the animation. Click Stop to stop the animation. Close the window when done.To plot:Click Simulation/Plot/ for a list of items that can have plots. Select a marker (Assembly1Part1MassMarker). A new plot window appears. Click Plot/Select/ to get a dialog to specify the data for the x and y axes. Multiply select with shift-click or control-click for the y-axis. Click OK to get the plots. You can export the plot data in tabular form: Click Plot/Export/ to specify an output filename. The file can be imported into a spreadsheet for further analysis.' runs: (Core.RunArray runs: #(505 63 14 5 12 1 2 37 89 8 4 36 1 30 1013 60 1 51 384 48 588 28 385 26 782 15 77 12 544 11 270 8 468) values: #(nil #underline #(#underline #bold) #underline #(#underline #bold) #underline nil #(#bold #large) nil #bold nil #(#bold #large) nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil #bold nil))) Name Gyro Position3D From 5ec6c3e22cebba7e254ea8ac700a048819203d96 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Tue, 7 Nov 2023 17:29:44 -0600 Subject: [PATCH 16/17] added conditional static/shared select to cmake --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0dc291..23f391f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,18 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) include(GNUInstallDirs) -add_library(OndselSolver SHARED) +if( BUILD_SHARED_LIBS ) + set( ONDSELSOLVER_BUILD_SHARED ON ) +endif() + +if ( ONDSELSOLVER_BUILD_SHARED ) + message( STATUS "[OndselSolver] Building shared library" ) + add_library(OndselSolver SHARED) +else() + message( STATUS "[OndselSolver] Building static library" ) + add_library(OndselSolver STATIC) +endif() + set(ONDSELSOLVER_SRC OndselSolver/Array.cpp From e2c4510e924f8e3c42cbcb3e41babbf057edc113 Mon Sep 17 00:00:00 2001 From: John Dupuy Date: Wed, 8 Nov 2023 19:09:00 -0600 Subject: [PATCH 17/17] Add OS check to cmakelists file --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23f391f..87255c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) include(GNUInstallDirs) -if( BUILD_SHARED_LIBS ) +if( UNIX ) set( ONDSELSOLVER_BUILD_SHARED ON ) -endif() +ELSEIF ( APPLE ) + set( ONDSELSOLVER_BUILD_SHARED ON ) +ELSE() + set( ONDSELSOLVER_BUILD_SHARED OFF ) +ENDIF () if ( ONDSELSOLVER_BUILD_SHARED ) message( STATUS "[OndselSolver] Building shared library" )