ASMT output, MBDyn input and output done.

This commit is contained in:
Aik-Siong Koh
2023-11-06 18:00:24 -07:00
parent 34858977b1
commit 678d03db1f
96 changed files with 8806 additions and 4043 deletions

View File

@@ -10,6 +10,7 @@
#include "Units.h"
#include "Part.h"
#include "ASMTSpatialContainer.h"
#include "EulerAngles.h"
using namespace MbD;
@@ -102,14 +103,50 @@ void MbD::ASMTSpatialItem::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTSpatialItem::storeOnLevelPosition(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "Position3D");
storeOnLevelArray(os, level + 1, *position3D);
if (xs == nullptr || xs->empty()) {
storeOnLevelArray(os, level + 1, *position3D);
}
else {
auto array = getPosition3D(0);
storeOnLevelArray(os, level + 1, *array);
}
}
void MbD::ASMTSpatialItem::storeOnLevelRotationMatrix(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "RotationMatrix");
for (int i = 0; i < 3; i++)
{
storeOnLevelArray(os, level + 1, *rotationMatrix->at(i));
if (xs == nullptr || xs->empty()) {
for (int i = 0; i < 3; i++)
{
storeOnLevelArray(os, level + 1, *rotationMatrix->at(i));
}
}
else {
auto rotMat = getRotationMatrix(0);
for (int i = 0; i < 3; i++)
{
storeOnLevelArray(os, level + 1, *rotMat->at(i));
}
}
}
FColDsptr MbD::ASMTSpatialItem::getPosition3D(size_t i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, xs->at(i));
vec3->atiput(1, ys->at(i));
vec3->atiput(2, zs->at(i));
return vec3;
}
FMatDsptr MbD::ASMTSpatialItem::getRotationMatrix(size_t i)
{
auto bryantAngles = std::make_shared<EulerAngles<double>>();
bryantAngles->setRotOrder(1, 2, 3);
bryantAngles->at(0) = bryxs->at(i);
bryantAngles->at(1) = bryys->at(i);
bryantAngles->at(2) = bryzs->at(i);
bryantAngles->calc();
return bryantAngles->aA;
}