OndselSolver can read and write *.asmt files

This commit is contained in:
Aik-Siong Koh
2023-10-19 10:51:51 -06:00
parent 95cd91c9d1
commit 4360daddf3
61 changed files with 1383 additions and 107 deletions

View File

@@ -5,7 +5,9 @@
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include <algorithm>
#include <fstream>
#include "ASMTSpatialContainer.h"
#include "Units.h"
#include "Part.h"
@@ -13,8 +15,7 @@
#include "ASMTRefPoint.h"
#include "ASMTRefCurve.h"
#include "ASMTRefSurface.h"
#include <algorithm>
//#include "ASMTPrincipalMassMarker.h"
//#include "ASMTPrincipalMassMarker.h"
using namespace MbD;
@@ -489,3 +490,210 @@ std::shared_ptr<std::vector<std::shared_ptr<ASMTMarker>>> MbD::ASMTSpatialContai
}
return markers;
}
void MbD::ASMTSpatialContainer::storeOnLevel(std::ofstream& os, int level)
{
ASMTSpatialItem::storeOnLevel(os, level);
storeOnLevelVelocity(os, level + 1);
storeOnLevelOmega(os, level + 1);
storeOnLevelRefPoints(os, level + 1);
storeOnLevelRefCurves(os, level + 1);
storeOnLevelRefSurfaces(os, level + 1);
}
void MbD::ASMTSpatialContainer::setVelocity3D(FColDsptr vec)
{
velocity3D = vec;
}
void MbD::ASMTSpatialContainer::setOmega3D(FColDsptr vec)
{
omega3D = vec;
}
void MbD::ASMTSpatialContainer::readVelocity3D(std::vector<std::string>& lines)
{
assert(lines[0].find("Velocity3D") != std::string::npos);
lines.erase(lines.begin());
std::istringstream iss(lines[0]);
velocity3D = std::make_shared<FullColumn<double>>();
double d;
while (iss >> d) {
velocity3D->push_back(d);
}
lines.erase(lines.begin());
}
void MbD::ASMTSpatialContainer::readOmega3D(std::vector<std::string>& lines)
{
assert(lines[0].find("Omega3D") != std::string::npos);
lines.erase(lines.begin());
std::istringstream iss(lines[0]);
omega3D = std::make_shared<FullColumn<double>>();
double d;
while (iss >> d) {
omega3D->push_back(d);
}
lines.erase(lines.begin());
}
void MbD::ASMTSpatialContainer::setVelocity3D(double a, double b, double c)
{
velocity3D = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
}
void MbD::ASMTSpatialContainer::setOmega3D(double a, double b, double c)
{
omega3D = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
}
void MbD::ASMTSpatialContainer::storeOnLevelVelocity(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "Velocity3D");
storeOnLevelArray(os, level + 1, *velocity3D);
}
void MbD::ASMTSpatialContainer::storeOnLevelOmega(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "Omega3D");
storeOnLevelArray(os, level + 1, *omega3D);
}
void MbD::ASMTSpatialContainer::storeOnLevelRefPoints(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "RefPoints");
for (auto& refPoint : *refPoints)
{
refPoint->storeOnLevel(os, level + 1);
}
}
void MbD::ASMTSpatialContainer::storeOnLevelRefCurves(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "RefCurves");
for (auto& refCurve : *refCurves)
{
refCurve->storeOnLevel(os, level);
}
}
void MbD::ASMTSpatialContainer::storeOnLevelRefSurfaces(std::ofstream& os, int level)
{
storeOnLevelString(os, level, "RefSurfaces");
for (auto& refSurface : *refSurfaces)
{
refSurface->storeOnLevel(os, level);
}
}
void MbD::ASMTSpatialContainer::storeOnTimeSeries(std::ofstream& os)
{
os << "X\t";
for (int i = 0; i < xs->size(); i++)
{
os << xs->at(i) << '\t';
}
os << std::endl;
os << "Y\t";
for (int i = 0; i < ys->size(); i++)
{
os << ys->at(i) << '\t';
}
os << std::endl;
os << "Z\t";
for (int i = 0; i < zs->size(); i++)
{
os << zs->at(i) << '\t';
}
os << std::endl;
os << "Bryantx\t";
for (int i = 0; i < bryxs->size(); i++)
{
os << bryxs->at(i) << '\t';
}
os << std::endl;
os << "Bryanty\t";
for (int i = 0; i < bryys->size(); i++)
{
os << bryys->at(i) << '\t';
}
os << std::endl;
os << "Bryantz\t";
for (int i = 0; i < bryzs->size(); i++)
{
os << bryzs->at(i) << '\t';
}
os << std::endl;
os << "VX\t";
for (int i = 0; i < vxs->size(); i++)
{
os << vxs->at(i) << '\t';
}
os << std::endl;
os << "VY\t";
for (int i = 0; i < vys->size(); i++)
{
os << vys->at(i) << '\t';
}
os << std::endl;
os << "VZ\t";
for (int i = 0; i < vzs->size(); i++)
{
os << vzs->at(i) << '\t';
}
os << std::endl;
os << "OmegaX\t";
for (int i = 0; i < omexs->size(); i++)
{
os << omexs->at(i) << '\t';
}
os << std::endl;
os << "OmegaY\t";
for (int i = 0; i < omeys->size(); i++)
{
os << omeys->at(i) << '\t';
}
os << std::endl;
os << "OmegaZ\t";
for (int i = 0; i < omezs->size(); i++)
{
os << omezs->at(i) << '\t';
}
os << std::endl;
os << "AX\t";
for (int i = 0; i < axs->size(); i++)
{
os << axs->at(i) << '\t';
}
os << std::endl;
os << "AY\t";
for (int i = 0; i < ays->size(); i++)
{
os << ays->at(i) << '\t';
}
os << std::endl;
os << "AZ\t";
for (int i = 0; i < azs->size(); i++)
{
os << azs->at(i) << '\t';
}
os << std::endl;
os << "AlphaX\t";
for (int i = 0; i < alpxs->size(); i++)
{
os << alpxs->at(i) << '\t';
}
os << std::endl;
os << "AlphaY\t";
for (int i = 0; i < alpys->size(); i++)
{
os << alpys->at(i) << '\t';
}
os << std::endl;
os << "AlphaZ\t";
for (int i = 0; i < alpzs->size(); i++)
{
os << alpzs->at(i) << '\t';
}
os << std::endl;
}