Merge pull request #18 from Ondsel-Development/OutputASMT
OndselSolver can read and write *.asmt files
This commit is contained in:
@@ -42,3 +42,20 @@ void MbD::ASMTAnimationParameters::parseASMT(std::vector<std::string>& lines)
|
||||
lines.erase(lines.begin());
|
||||
|
||||
}
|
||||
|
||||
void MbD::ASMTAnimationParameters::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "AnimationParameters");
|
||||
storeOnLevelString(os, level + 1, "nframe");
|
||||
storeOnLevelInt(os, level + 2, nframe);
|
||||
storeOnLevelString(os, level + 1, "icurrent");
|
||||
storeOnLevelInt(os, level + 2, icurrent);
|
||||
storeOnLevelString(os, level + 1, "istart");
|
||||
storeOnLevelInt(os, level + 2, istart);
|
||||
storeOnLevelString(os, level + 1, "iend");
|
||||
storeOnLevelInt(os, level + 2, iend);
|
||||
storeOnLevelString(os, level + 1, "isForward");
|
||||
storeOnLevelBool(os, level + 2, isForward);
|
||||
storeOnLevelString(os, level + 1, "framesPerSecond");
|
||||
storeOnLevelInt(os, level + 2, framesPerSecond);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
int nframe = 1000000, icurrent = 0, istart = 0, iend = 1000000, framesPerSecond = 30;
|
||||
bool isForward = true;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "SystemSolver.h"
|
||||
#include "ASMTItemIJ.h"
|
||||
#include "ASMTKinematicIJ.h"
|
||||
#include <iomanip>
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
@@ -369,15 +370,17 @@ void MbD::ASMTAssembly::runSinglePendulum()
|
||||
void MbD::ASMTAssembly::runFile(const char* fileName)
|
||||
{
|
||||
std::ifstream stream(fileName);
|
||||
if(stream.fail()) {
|
||||
throw std::invalid_argument("File not found.");
|
||||
}
|
||||
if (stream.fail()) {
|
||||
throw std::invalid_argument("File not found.");
|
||||
}
|
||||
std::string line;
|
||||
std::vector<std::string> lines;
|
||||
while (std::getline(stream, line)) {
|
||||
lines.push_back(line);
|
||||
}
|
||||
assert(lines[0] == "freeCAD: 3D CAD with Motion Simulation by askoh.com");
|
||||
bool bool1 = lines[0] == "freeCAD: 3D CAD with Motion Simulation by askoh.com";
|
||||
bool bool2 = lines[0] == "OndselSolver";
|
||||
assert(bool1 || bool2);
|
||||
lines.erase(lines.begin());
|
||||
|
||||
if (lines[0] == "Assembly") {
|
||||
@@ -386,7 +389,32 @@ void MbD::ASMTAssembly::runFile(const char* fileName)
|
||||
assembly->parseASMT(lines);
|
||||
assembly->runKINEMATIC();
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::readWriteFile(const char* fileName)
|
||||
{
|
||||
std::ifstream stream(fileName);
|
||||
if (stream.fail()) {
|
||||
throw std::invalid_argument("File not found.");
|
||||
}
|
||||
std::string line;
|
||||
std::vector<std::string> lines;
|
||||
while (std::getline(stream, line)) {
|
||||
lines.push_back(line);
|
||||
}
|
||||
bool bool1 = lines[0] == "freeCAD: 3D CAD with Motion Simulation by askoh.com";
|
||||
bool bool2 = lines[0] == "OndselSolver";
|
||||
assert(bool1 || bool2);
|
||||
lines.erase(lines.begin());
|
||||
|
||||
if (lines[0] == "Assembly") {
|
||||
lines.erase(lines.begin());
|
||||
auto assembly = CREATE<ASMTAssembly>::With();
|
||||
assembly->parseASMT(lines);
|
||||
assembly->runKINEMATIC();
|
||||
assembly->outputFile("assembly.asmt");
|
||||
ASMTAssembly::runFile("assembly.asmt");
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::initialize()
|
||||
@@ -906,7 +934,38 @@ void MbD::ASMTAssembly::createMbD(std::shared_ptr<System> mbdSys, std::shared_pt
|
||||
mbdSysSolver->orderMax = simulationParameters->orderMax;
|
||||
mbdSysSolver->translationLimit = simulationParameters->translationLimit / mbdUnits->length;
|
||||
mbdSysSolver->rotationLimit = simulationParameters->rotationLimit;
|
||||
animationParameters = nullptr;
|
||||
//animationParameters = nullptr;
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::outputFile(std::string filename)
|
||||
{
|
||||
std::ofstream os(filename);
|
||||
os << std::setprecision(std::numeric_limits<double>::digits10 + 1);
|
||||
// try {
|
||||
os << "OndselSolver" << std::endl;
|
||||
storeOnLevel(os, 0);
|
||||
os.close();
|
||||
// }
|
||||
// catch (...) {
|
||||
// os.close();
|
||||
// }
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Assembly");
|
||||
storeOnLevelNotes(os, level + 1);
|
||||
storeOnLevelName(os, level + 1);
|
||||
ASMTSpatialContainer::storeOnLevel(os, level);
|
||||
|
||||
storeOnLevelParts(os, level + 1);
|
||||
storeOnLevelKinematicIJs(os, level + 1);
|
||||
storeOnLevelConstraintSets(os, level + 1);
|
||||
storeOnLevelForceTorques(os, level + 1);
|
||||
constantGravity->storeOnLevel(os, level + 1);
|
||||
simulationParameters->storeOnLevel(os, level + 1);
|
||||
animationParameters->storeOnLevel(os, level + 1);
|
||||
storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::solve()
|
||||
@@ -1089,4 +1148,88 @@ std::shared_ptr<ASMTPart> MbD::ASMTAssembly::partPartialNamed(std::string partia
|
||||
return part;
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelNotes(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Notes");
|
||||
storeOnLevelString(os, level + 1, notes);
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelParts(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Parts");
|
||||
for (auto& part : *parts) {
|
||||
part->storeOnLevel(os, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelKinematicIJs(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "KinematicIJs");
|
||||
for (auto& kinematicIJ : *kinematicIJs) {
|
||||
kinematicIJ->storeOnLevel(os, level);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "ConstraintSets");
|
||||
storeOnLevelJoints(os, level + 1);
|
||||
storeOnLevelMotions(os, level + 1);
|
||||
storeOnLevelGeneralConstraintSets(os, level + 1);
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelForceTorques(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "ForceTorques");
|
||||
for (auto& forceTorque : *forcesTorques) {
|
||||
forceTorque->storeOnLevel(os, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelJoints(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Joints");
|
||||
for (auto& joint : *joints) {
|
||||
joint->storeOnLevel(os, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Motions");
|
||||
for (auto& motion : *motions) {
|
||||
motion->storeOnLevel(os, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "GeneralConstraintSets");
|
||||
//for (auto& generalConstraintSet : *generalConstraintSets) {
|
||||
// generalConstraintSet->storeOnLevel(os, level);
|
||||
//}
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "TimeSeries" << std::endl;
|
||||
os << "Number\tInput\t";
|
||||
for (int i = 1; i < times->size(); i++)
|
||||
{
|
||||
os << i << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "Time\tInput\t";
|
||||
for (int i = 1; i < times->size(); i++)
|
||||
{
|
||||
os << times->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "AssemblySeries\t" << fullName("") << std::endl;
|
||||
ASMTSpatialContainer::storeOnTimeSeries(os);
|
||||
for (auto& part : *parts) part->storeOnTimeSeries(os);
|
||||
for (auto& joint : *joints) joint->storeOnTimeSeries(os);
|
||||
for (auto& motion : *motions) motion->storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace MbD {
|
||||
static void runSinglePendulumSimplified();
|
||||
static void runSinglePendulum();
|
||||
static void runFile(const char* chars);
|
||||
static void readWriteFile(const char* chars);
|
||||
void initialize() override;
|
||||
ASMTAssembly* root() override;
|
||||
void setNotes(std::string str);
|
||||
@@ -84,6 +85,8 @@ namespace MbD {
|
||||
std::shared_ptr<std::map<std::string, std::shared_ptr<ASMTMarker>>>markerMap();
|
||||
void deleteMbD();
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void outputFile(std::string filename);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
/* This function performs a one shot solve of the assembly.*/
|
||||
void solve();
|
||||
@@ -108,6 +111,15 @@ namespace MbD {
|
||||
void setSimulationParameters(std::shared_ptr<ASMTSimulationParameters> simulationParameters);
|
||||
std::shared_ptr<ASMTPart> partNamed(std::string partName);
|
||||
std::shared_ptr<ASMTPart> partPartialNamed(std::string partialName);
|
||||
void storeOnLevelNotes(std::ofstream& os, int level);
|
||||
void storeOnLevelParts(std::ofstream& os, int level);
|
||||
void storeOnLevelKinematicIJs(std::ofstream& os, int level);
|
||||
void storeOnLevelConstraintSets(std::ofstream& os, int level);
|
||||
void storeOnLevelForceTorques(std::ofstream& os, int level);
|
||||
void storeOnLevelJoints(std::ofstream& os, int level);
|
||||
void storeOnLevelMotions(std::ofstream& os, int level);
|
||||
void storeOnLevelGeneralConstraintSets(std::ofstream& os, int level);
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::string notes;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTPart>>> parts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
|
||||
|
||||
@@ -38,3 +38,9 @@ void MbD::ASMTConstantGravity::setg(double a, double b, double c)
|
||||
{
|
||||
g = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
|
||||
}
|
||||
|
||||
void MbD::ASMTConstantGravity::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "ConstantGravity");
|
||||
storeOnLevelArray(os, level + 1, *g);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace MbD {
|
||||
void setg(FColDsptr g);
|
||||
|
||||
void setg(double a, double b, double c);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
FColDsptr g = std::make_shared<FullColumn<double>>(ListD{ 0.,0.,0. });
|
||||
};
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTCylindricalJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -14,3 +15,17 @@ std::shared_ptr<Joint> MbD::ASMTCylindricalJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<CylindricalJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTCylindricalJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "CylindricalJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTCylindricalJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "CylindricalJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTFixedJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -14,3 +15,17 @@ std::shared_ptr<Joint> MbD::ASMTFixedJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<FixedJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTFixedJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "FixedJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTFixedJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "FixedJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTGeneralMotion.h"
|
||||
#include "ASMTAssembly.h"
|
||||
#include "SymbolicParser.h"
|
||||
@@ -147,3 +148,17 @@ void MbD::ASMTGeneralMotion::createMbD(std::shared_ptr<System> mbdSys, std::shar
|
||||
fangIJJ->rotOrder = rotOrder;
|
||||
fullMotion->fangIJJ = fangIJJ;
|
||||
}
|
||||
|
||||
void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "GeneralMotion");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTGeneralMotion::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "GeneralMotionSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace MbD {
|
||||
void readRotationOrder(std::vector<std::string>& lines);
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::shared_ptr<FullColumn<std::string>> rIJI, angIJJ;
|
||||
std::string rotationOrder;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "ASMTItem.h"
|
||||
#include "CREATE.h"
|
||||
#include "ASMTSpatialContainer.h"
|
||||
@@ -173,3 +173,66 @@ std::shared_ptr<Constant> MbD::ASMTItem::sptrConstant(double value)
|
||||
{
|
||||
return std::make_shared<Constant>(value);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, int level)
|
||||
{
|
||||
for (int i = 0; i < level; i++)
|
||||
{
|
||||
os << '\t';
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelString(std::ofstream& os, int level, std::string str)
|
||||
{
|
||||
storeOnLevelTabs(os, level);
|
||||
os << str << std::endl;
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelDouble(std::ofstream& os, int level, double value)
|
||||
{
|
||||
storeOnLevelTabs(os, level);
|
||||
os << value << std::endl;
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelInt(std::ofstream& os, int level, int i)
|
||||
{
|
||||
storeOnLevelTabs(os, level);
|
||||
os << i << std::endl;
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelBool(std::ofstream& os, int level, bool value)
|
||||
{
|
||||
storeOnLevelTabs(os, level);
|
||||
if (value) {
|
||||
os << "true" << std::endl;
|
||||
}
|
||||
else {
|
||||
os << "false" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<double> array)
|
||||
{
|
||||
storeOnLevelTabs(os, level);
|
||||
for (int i = 0; i < array.size(); i++)
|
||||
{
|
||||
os << array[i] << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnLevelName(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Name");
|
||||
storeOnLevelString(os, level + 1, name);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,31 @@ namespace MbD {
|
||||
virtual void outputResults(AnalysisType type);
|
||||
std::shared_ptr<Units> mbdUnits();
|
||||
std::shared_ptr<Constant> sptrConstant(double value);
|
||||
virtual void storeOnLevel(std::ofstream& os, int level);
|
||||
virtual void storeOnLevelTabs(std::ofstream& os, int level);
|
||||
virtual void storeOnLevelString(std::ofstream& os, int level, std::string str);
|
||||
virtual void storeOnLevelDouble(std::ofstream& os, int level, double value);
|
||||
virtual void storeOnLevelInt(std::ofstream& os, int level, int i);
|
||||
virtual void storeOnLevelBool(std::ofstream& os, int level, bool value);
|
||||
//template<typename T>
|
||||
//void storeOnLevelArray(std::ofstream& os, int level, std::vector<T> array);
|
||||
void storeOnLevelArray(std::ofstream& os, int level, std::vector<double> array);
|
||||
void storeOnLevelName(std::ofstream& os, int level);
|
||||
virtual void storeOnTimeSeries(std::ofstream& os);
|
||||
|
||||
std::string name;
|
||||
ASMTItem* owner = nullptr;
|
||||
std::shared_ptr<Item> mbdObject;
|
||||
};
|
||||
//template<typename T>
|
||||
//inline void ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<T> array)
|
||||
//{
|
||||
// storeOnLevelTabs(os, level);
|
||||
// for (int i = 0; i < array.size(); i++)
|
||||
// {
|
||||
// os << array[i] << '\t';
|
||||
// }
|
||||
// //os << std::endl;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTItemIJ.h"
|
||||
|
||||
MbD::ASMTItemIJ::ASMTItemIJ()
|
||||
@@ -95,3 +96,51 @@ void MbD::ASMTItemIJ::readTZonIs(std::vector<std::string>& lines)
|
||||
readDoublesInto(str, "TZonI", intzs);
|
||||
lines.erase(lines.begin());
|
||||
}
|
||||
|
||||
void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level + 1, "MarkerI");
|
||||
storeOnLevelString(os, level + 2, markerI);
|
||||
storeOnLevelString(os, level + 1, "MarkerJ");
|
||||
storeOnLevelString(os, level + 2, markerJ);
|
||||
}
|
||||
|
||||
void MbD::ASMTItemIJ::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "FXonI\t";
|
||||
for (int i = 0; i < fxs->size(); i++)
|
||||
{
|
||||
os << fxs->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "FYonI\t";
|
||||
for (int i = 0; i < fys->size(); i++)
|
||||
{
|
||||
os << fys->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "FZonI\t";
|
||||
for (int i = 0; i < fzs->size(); i++)
|
||||
{
|
||||
os << fzs->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "TXonI\t";
|
||||
for (int i = 0; i < txs->size(); i++)
|
||||
{
|
||||
os << txs->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "TYonI\t";
|
||||
for (int i = 0; i < tys->size(); i++)
|
||||
{
|
||||
os << tys->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
os << "TZonI\t";
|
||||
for (int i = 0; i < tzs->size(); i++)
|
||||
{
|
||||
os << tzs->at(i) << '\t';
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace MbD {
|
||||
void readTXonIs(std::vector<std::string>& lines);
|
||||
void readTYonIs(std::vector<std::string>& lines);
|
||||
void readTZonIs(std::vector<std::string>& lines);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::string markerI, markerJ;
|
||||
FRowDsptr fxs, fys, fzs, txs, tys, tzs;
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -34,3 +35,13 @@ void MbD::ASMTJoint::readJointSeries(std::vector<std::string>& lines)
|
||||
readTYonIs(lines);
|
||||
readTZonIs(lines);
|
||||
}
|
||||
|
||||
void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace MbD {
|
||||
public:
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void readJointSeries(std::vector<std::string>& lines);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ForceTorqueData>>> jointSeries;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "ASMTMarker.h"
|
||||
#include "ASMTRefItem.h"
|
||||
#include "ASMTPart.h"
|
||||
@@ -60,3 +60,11 @@ void MbD::ASMTMarker::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace MbD {
|
||||
FColDsptr rpmp();
|
||||
FMatDsptr aApm();
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTMotion.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -31,3 +32,13 @@ void MbD::ASMTMotion::readMotionSeries(std::vector<std::string>& lines)
|
||||
void MbD::ASMTMotion::initMarkers()
|
||||
{
|
||||
}
|
||||
|
||||
void MbD::ASMTMotion::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTMotion::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace MbD {
|
||||
public:
|
||||
void readMotionSeries(std::vector<std::string>& lines);
|
||||
virtual void initMarkers();
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ForceTorqueData>>> motionSeries;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTNoRotationJoint.h"
|
||||
#include "NoRotationJoint.h"
|
||||
@@ -15,3 +16,17 @@ std::shared_ptr<Joint> MbD::ASMTNoRotationJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<NoRotationJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTNoRotationJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "NoRotationJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTNoRotationJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "NoRotationJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTPart.h"
|
||||
#include "CREATE.h"
|
||||
#include "ASMTPrincipalMassMarker.h"
|
||||
@@ -116,3 +117,29 @@ void MbD::ASMTPart::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Un
|
||||
ASMTSpatialContainer::createMbD(mbdSys, mbdUnits);
|
||||
if (isFixed) std::static_pointer_cast<Part>(mbdObject)->asFixed();
|
||||
}
|
||||
|
||||
void MbD::ASMTPart::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Part");
|
||||
storeOnLevelName(os, level + 1);
|
||||
storeOnLevelPosition(os, level + 1);
|
||||
storeOnLevelRotationMatrix(os, level + 1);
|
||||
storeOnLevelVelocity(os, level + 1);
|
||||
storeOnLevelOmega(os, level + 1);
|
||||
storeOnLevelString(os, level + 1, "FeatureOrder");
|
||||
storeOnLevelMassMarker(os, level + 1);
|
||||
storeOnLevelRefPoints(os, level + 1);
|
||||
storeOnLevelRefCurves(os, level + 1);
|
||||
storeOnLevelRefSurfaces(os, level + 1);
|
||||
}
|
||||
|
||||
void MbD::ASMTPart::storeOnLevelMassMarker(std::ofstream& os, int level)
|
||||
{
|
||||
principalMassMarker->storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTPart::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "PartSeries\t" << fullName("") << std::endl;
|
||||
ASMTSpatialContainer::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace MbD {
|
||||
FColDsptr omeOpO() override;
|
||||
ASMTPart* part() override;
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnLevelMassMarker(std::ofstream& os, int level);
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
//std::shared_ptr<std::vector<std::shared_ptr<ASMTFeature>>> featureOrder;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<PosVelAccData>>> partSeries;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTPointInLineJoint.h"
|
||||
#include "PointInLineJoint.h"
|
||||
@@ -14,4 +15,18 @@ using namespace MbD;
|
||||
std::shared_ptr<Joint> MbD::ASMTPointInLineJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<PointInLineJoint>::With();
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTPointInLineJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "PointInLineJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTPointInLineJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "PointInLineJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTPointInPlaneJoint.h"
|
||||
#include "PointInPlaneJoint.h"
|
||||
|
||||
@@ -38,3 +39,17 @@ void MbD::ASMTPointInPlaneJoint::createMbD(std::shared_ptr<System> mbdSys, std::
|
||||
pointInPlaneJoint->offset = offset;
|
||||
}
|
||||
|
||||
void MbD::ASMTPointInPlaneJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "PointInPlaneJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTPointInPlaneJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "PointInPlaneJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace MbD {
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void readOffset(std::vector<std::string>& lines);
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
double offset;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector<std::string>& lines)
|
||||
auto leadingTabs = lines[0].substr(0, pos);
|
||||
assert(lines[0] == (leadingTabs + "Name"));
|
||||
lines.erase(lines.begin());
|
||||
name = lines[0];
|
||||
name = readString(lines[0]);
|
||||
lines.erase(lines.begin());
|
||||
assert(lines[0] == (leadingTabs + "Position3D"));
|
||||
lines.erase(lines.begin());
|
||||
@@ -72,3 +72,17 @@ void MbD::ASMTPrincipalMassMarker::setMomentOfInertias(double a, double b, doubl
|
||||
{
|
||||
momentOfInertias = std::make_shared<DiagonalMatrix<double>>(ListD{ a, b, c });
|
||||
}
|
||||
|
||||
void MbD::ASMTPrincipalMassMarker::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "PrincipalMassMarker");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTSpatialItem::storeOnLevel(os, level);
|
||||
storeOnLevelString(os, level + 1, "Mass");
|
||||
storeOnLevelDouble(os, level + 2, mass);
|
||||
storeOnLevelString(os, level + 1, "MomentOfInertias");
|
||||
storeOnLevelArray(os, level + 2, *momentOfInertias);
|
||||
storeOnLevelString(os, level + 1, "Density");
|
||||
storeOnLevelDouble(os, level + 2, density);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace MbD {
|
||||
|
||||
// Overloads to simplify syntax.
|
||||
void setMomentOfInertias(double a, double b, double c);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
double mass = 0.0;
|
||||
double density = 0.0;
|
||||
|
||||
@@ -15,3 +15,8 @@ void MbD::ASMTRefCurve::parseASMT(std::vector<std::string>& lines)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTRefCurve::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -41,3 +41,12 @@ void MbD::ASMTRefItem::readMarker(std::vector<std::string>& lines)
|
||||
markers->push_back(marker);
|
||||
marker->owner = this;
|
||||
}
|
||||
|
||||
void MbD::ASMTRefItem::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "RefPoints");
|
||||
ASMTSpatialItem::storeOnLevel(os, level+1);
|
||||
for (auto& marker : *markers) {
|
||||
marker->storeOnLevel(os, level);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace MbD {
|
||||
void addMarker(std::shared_ptr<ASMTMarker> marker);
|
||||
void readMarkers(std::vector<std::string>& lines);
|
||||
void readMarker(std::vector<std::string>& lines);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTMarker>>> markers = std::make_shared<std::vector<std::shared_ptr<ASMTMarker>>>();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "ASMTRefPoint.h"
|
||||
#include "ASMTMarker.h"
|
||||
#include "CREATE.h"
|
||||
@@ -30,3 +30,13 @@ void MbD::ASMTRefPoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_pt
|
||||
marker->createMbD(mbdSys, mbdUnits);
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTRefPoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "RefPoint");
|
||||
ASMTSpatialItem::storeOnLevel(os, level);
|
||||
storeOnLevelString(os, level + 1, "Markers");
|
||||
for (auto& marker : *markers) {
|
||||
marker->storeOnLevel(os, level + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace MbD {
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
std::string fullName(std::string partialName) override;
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -15,3 +15,8 @@ void MbD::ASMTRefSurface::parseASMT(std::vector<std::string>& lines)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTRefSurface::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -5,12 +5,27 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTRevoluteJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
std::shared_ptr<Joint> MbD::ASMTRevoluteJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<RevoluteJoint>::With();
|
||||
return CREATE<RevoluteJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTRevoluteJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "RevoluteJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTRevoluteJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "RevoluteJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTRotationalMotion.h"
|
||||
#include "ASMTAssembly.h"
|
||||
@@ -20,6 +21,10 @@ using namespace MbD;
|
||||
void MbD::ASMTRotationalMotion::parseASMT(std::vector<std::string>& lines)
|
||||
{
|
||||
readName(lines);
|
||||
if (lines[0].find("MarkerI") != std::string::npos) {
|
||||
readMarkerI(lines);
|
||||
readMarkerJ(lines);
|
||||
}
|
||||
readMotionJoint(lines);
|
||||
readRotationZ(lines);
|
||||
}
|
||||
@@ -82,3 +87,21 @@ void MbD::ASMTRotationalMotion::setRotationZ(std::string rotZ)
|
||||
{
|
||||
rotationZ = rotZ;
|
||||
}
|
||||
|
||||
void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "RotationalMotion");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
storeOnLevelString(os, level + 1, "MotionJoint");
|
||||
storeOnLevelString(os, level + 2, motionJoint);
|
||||
storeOnLevelString(os, level + 1, "RotationZ");
|
||||
storeOnLevelString(os, level + 2, rotationZ);
|
||||
}
|
||||
|
||||
void MbD::ASMTRotationalMotion::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "RotationalMotionSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace MbD {
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void setMotionJoint(std::string motionJoint);
|
||||
void setRotationZ(std::string rotZ);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::string motionJoint, rotationZ;
|
||||
};
|
||||
|
||||
@@ -78,3 +78,20 @@ void MbD::ASMTSimulationParameters::setmaxIter(int maxIter)
|
||||
iterMaxPosKine = maxIter;
|
||||
iterMaxAccKine = maxIter;
|
||||
}
|
||||
|
||||
void MbD::ASMTSimulationParameters::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "SimulationParameters");
|
||||
storeOnLevelString(os, level + 1, "tstart");
|
||||
storeOnLevelDouble(os, level + 2, tstart);
|
||||
storeOnLevelString(os, level + 1, "tend");
|
||||
storeOnLevelDouble(os, level + 2, tend);
|
||||
storeOnLevelString(os, level + 1, "hmin");
|
||||
storeOnLevelDouble(os, level + 2, hmin);
|
||||
storeOnLevelString(os, level + 1, "hmax");
|
||||
storeOnLevelDouble(os, level + 2, hmax);
|
||||
storeOnLevelString(os, level + 1, "hout");
|
||||
storeOnLevelDouble(os, level + 2, hout);
|
||||
storeOnLevelString(os, level + 1, "errorTol");
|
||||
storeOnLevelDouble(os, level + 2, errorTol);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace MbD {
|
||||
void sethout(double hout);
|
||||
void seterrorTol(double errorTol);
|
||||
void setmaxIter(int maxIter);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
|
||||
double tstart = 0.0, tend = 1.0, hmin = 1.0e-9, hmax = 1.0e9, hout = 0.1, errorTol = 1.0e-6;
|
||||
double errorTolPosKine = 1.0e-6, errorTolAccKine = 1.0e-6, corAbsTol = 1.0e-6, corRelTol = 1.0e-6;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,22 @@ namespace MbD {
|
||||
void addMarker(std::shared_ptr<ASMTMarker> marker);
|
||||
std::string generateUniqueMarkerName();
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTMarker>>> markerList();
|
||||
void setVelocity3D(FColDsptr velocity3D);
|
||||
void setOmega3D(FColDsptr omega3D);
|
||||
void readVelocity3D(std::vector<std::string>& lines);
|
||||
void readOmega3D(std::vector<std::string>& lines);
|
||||
void setVelocity3D(double a, double b, double c);
|
||||
void setOmega3D(double a, double b, double c);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnLevelVelocity(std::ofstream& os, int level);
|
||||
void storeOnLevelOmega(std::ofstream& os, int level);
|
||||
void storeOnLevelRefPoints(std::ofstream& os, int level);
|
||||
void storeOnLevelRefCurves(std::ofstream& os, int level);
|
||||
void storeOnLevelRefSurfaces(std::ofstream& os, int level);
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
FColDsptr velocity3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefPoint>>> refPoints;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefCurve>>> refCurves;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefSurface>>> refSurfaces;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "ASMTSpatialItem.h"
|
||||
#include "Units.h"
|
||||
#include "Part.h"
|
||||
@@ -30,16 +30,6 @@ void MbD::ASMTSpatialItem::setRotationMatrix(FMatDsptr mat)
|
||||
rotationMatrix = mat;
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::setVelocity3D(FColDsptr vec)
|
||||
{
|
||||
velocity3D = vec;
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::setOmega3D(FColDsptr vec)
|
||||
{
|
||||
omega3D = vec;
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::readPosition3D(std::vector<std::string>& lines)
|
||||
{
|
||||
assert(lines[0].find("Position3D") != std::string::npos);
|
||||
@@ -70,32 +60,6 @@ void MbD::ASMTSpatialItem::readRotationMatrix(std::vector<std::string>& lines)
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::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::ASMTSpatialItem::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::ASMTSpatialItem::getPosition3D(double& a, double& b, double& c)
|
||||
{
|
||||
a = position3D->at(0);
|
||||
@@ -118,16 +82,6 @@ void MbD::ASMTSpatialItem::setPosition3D(double a, double b, double c)
|
||||
position3D = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::setVelocity3D(double a, double b, double c)
|
||||
{
|
||||
velocity3D = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::setOmega3D(double a, double b, double c)
|
||||
{
|
||||
omega3D = std::make_shared<FullColumn<double>>(ListD{ a, b, c });
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::setRotationMatrix(double v11, double v12, double v13,
|
||||
double v21, double v22, double v23,
|
||||
double v31, double v32, double v33)
|
||||
@@ -137,4 +91,25 @@ void MbD::ASMTSpatialItem::setRotationMatrix(double v11, double v12, double v13,
|
||||
{ v21, v22, v23 },
|
||||
{ v31, v32, v33 }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelPosition(os, level + 1);
|
||||
storeOnLevelRotationMatrix(os, level + 1);
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialItem::storeOnLevelPosition(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "Position3D");
|
||||
storeOnLevelArray(os, level + 1, *position3D);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,32 +17,27 @@ namespace MbD {
|
||||
public:
|
||||
void setPosition3D(FColDsptr position3D);
|
||||
void setRotationMatrix(FMatDsptr rotationMatrix);
|
||||
void setVelocity3D(FColDsptr velocity3D);
|
||||
void setOmega3D(FColDsptr omega3D);
|
||||
void readPosition3D(std::vector<std::string>& lines);
|
||||
void readRotationMatrix(std::vector<std::string>& lines);
|
||||
void readVelocity3D(std::vector<std::string>& lines);
|
||||
void readOmega3D(std::vector<std::string>& lines);
|
||||
|
||||
FColDsptr position3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr velocity3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);
|
||||
FMatDsptr rotationMatrix = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
|
||||
// Overloads to simplify syntax.
|
||||
void getPosition3D(double& a, double& b, double& c);
|
||||
void getQuarternions(double& q0, double& q1, double& q2, double& q3);
|
||||
void setPosition3D(double a, double b, double c);
|
||||
void setQuarternions(double q0, double q1, double q2, double q3);
|
||||
void setVelocity3D(double a, double b, double c);
|
||||
void setOmega3D(double a, double b, double c);
|
||||
void setRotationMatrix(double v11, double v12, double v13,
|
||||
double v21, double v22, double v23,
|
||||
double v31, double v32, double v33);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnLevelPosition(std::ofstream& os, int level);
|
||||
void storeOnLevelRotationMatrix(std::ofstream& os, int level);
|
||||
|
||||
FColDsptr position3D = std::make_shared<FullColumn<double>>(3);
|
||||
FMatDsptr rotationMatrix = std::make_shared<FullMatrix<double>>(ListListD{
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTSphericalJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -14,3 +15,17 @@ std::shared_ptr<Joint> MbD::ASMTSphericalJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<SphericalJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTSphericalJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "SphericalJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTSphericalJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "SphericalJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTTranslationalJoint.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -14,3 +15,17 @@ std::shared_ptr<Joint> MbD::ASMTTranslationalJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<TranslationalJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "TranslationalJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "TranslationalJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTTranslationalMotion.h"
|
||||
#include "ASMTAssembly.h"
|
||||
#include "SymbolicParser.h"
|
||||
@@ -22,21 +23,6 @@ void MbD::ASMTTranslationalMotion::parseASMT(std::vector<std::string>& lines)
|
||||
readName(lines);
|
||||
readMotionJoint(lines);
|
||||
readTranslationZ(lines);
|
||||
|
||||
//size_t pos = lines[0].find_first_not_of("\t");
|
||||
//auto leadingTabs = lines[0].substr(0, pos);
|
||||
//assert(lines[0] == (leadingTabs + "Name"));
|
||||
//lines.erase(lines.begin());
|
||||
//name = lines[0];
|
||||
//lines.erase(lines.begin());
|
||||
//assert(lines[0] == (leadingTabs + "MotionJoint"));
|
||||
//lines.erase(lines.begin());
|
||||
//motionJoint = lines[0];
|
||||
//lines.erase(lines.begin());
|
||||
//assert(lines[0] == (leadingTabs + "TranslationZ"));
|
||||
//lines.erase(lines.begin());
|
||||
//translationZ = lines[0];
|
||||
//lines.erase(lines.begin());
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::initMarkers()
|
||||
@@ -81,3 +67,17 @@ void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector<std::string>& li
|
||||
translationZ = readString(lines[0]);
|
||||
lines.erase(lines.begin());
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "TranslationalMotion");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "TranslationalMotionSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace MbD {
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void readMotionJoint(std::vector<std::string>& lines);
|
||||
void readTranslationZ(std::vector<std::string>& lines);
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
std::string motionJoint, translationZ;
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
* *
|
||||
* See LICENSE file for details about copyright. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "ASMTUniversalJoint.h"
|
||||
#include "UniversalJoint.h"
|
||||
|
||||
@@ -15,3 +16,17 @@ std::shared_ptr<Joint> MbD::ASMTUniversalJoint::mbdClassNew()
|
||||
{
|
||||
return CREATE<UniversalJoint>::With();
|
||||
}
|
||||
|
||||
void MbD::ASMTUniversalJoint::storeOnLevel(std::ofstream& os, int level)
|
||||
{
|
||||
storeOnLevelString(os, level, "UniversalJoint");
|
||||
storeOnLevelString(os, level + 1, "Name");
|
||||
storeOnLevelString(os, level + 2, name);
|
||||
ASMTItemIJ::storeOnLevel(os, level);
|
||||
}
|
||||
|
||||
void MbD::ASMTUniversalJoint::storeOnTimeSeries(std::ofstream& os)
|
||||
{
|
||||
os << "UniversalJointSeries\t" << fullName("") << std::endl;
|
||||
ASMTItemIJ::storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace MbD {
|
||||
//
|
||||
public:
|
||||
std::shared_ptr<Joint> mbdClassNew() override;
|
||||
void storeOnLevel(std::ofstream& os, int level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ void MbD::MBDynSystem::runFile(const char* filename)
|
||||
system->setFilename(filename);
|
||||
system->parseMBDyn(statements);
|
||||
system->runKINEMATIC();
|
||||
system->outputFiles();
|
||||
}
|
||||
|
||||
void MbD::MBDynSystem::parseMBDyn(std::vector<std::string>& lines)
|
||||
|
||||
@@ -25,6 +25,7 @@ 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
|
||||
|
||||
439
OndselSolver/assembly.asmt
Normal file
439
OndselSolver/assembly.asmt
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user