AllowRotation and size_t

This commit is contained in:
Aik-Siong Koh
2024-01-14 21:40:33 -07:00
committed by PaddleStroke
parent fe99ad2593
commit 85557e1fa4
285 changed files with 1854 additions and 1116 deletions

View File

@@ -25,6 +25,9 @@ endif()
set(ONDSELSOLVER_SRC
OndselSolver/AllowZRotation.cpp
OndselSolver/AllowZRotationConstraintIqctJqc.cpp
OndselSolver/ASMTAllowRotation.cpp
OndselSolver/Array.cpp
OndselSolver/FullVector.cpp
OndselSolver/RowTypeMatrix.cpp
@@ -345,6 +348,9 @@ set(ONDSELSOLVER_SRC
)
set(ONDSELSOLVER_HEADERS
OndselSolver/AllowZRotation.h
OndselSolver/AllowZRotationConstraintIqctJqc.h
OndselSolver/ASMTAllowRotation.h
OndselSolver/Array.h
OndselSolver/FullVector.h
OndselSolver/RowTypeMatrix.h

View File

@@ -0,0 +1,76 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "ASMTAllowRotation.h"
#include "ASMTAssembly.h"
#include "ASMTJoint.h"
#include "AllowZRotation.h"
using namespace MbD;
std::shared_ptr<ASMTAllowRotation> MbD::ASMTAllowRotation::With()
{
auto asmtAllowRotation = std::make_shared<ASMTAllowRotation>();
return asmtAllowRotation;
}
void MbD::ASMTAllowRotation::parseASMT(std::vector<std::string>& lines)
{
readName(lines);
if (lines[0].find("MarkerI") != std::string::npos) {
readMarkerI(lines);
readMarkerJ(lines);
}
readMotionJoint(lines);
}
void MbD::ASMTAllowRotation::readMotionJoint(std::vector<std::string>& lines)
{
assert(lines[0].find("MotionJoint") != std::string::npos);
lines.erase(lines.begin());
motionJoint = readString(lines[0]);
lines.erase(lines.begin());
}
void MbD::ASMTAllowRotation::initMarkers()
{
if (motionJoint == "") {
assert(markerI != "");
assert(markerJ != "");
}
else {
auto jt = root()->jointAt(motionJoint);
markerI = jt->markerI;
markerJ = jt->markerJ;
}
}
std::shared_ptr<Joint> MbD::ASMTAllowRotation::mbdClassNew()
{
return AllowZRotation::With();
}
void MbD::ASMTAllowRotation::setMotionJoint(std::string motionJoint)
{
}
void MbD::ASMTAllowRotation::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "AllowRotation");
storeOnLevelString(os, level + 1, "Name");
storeOnLevelString(os, level + 2, name);
ASMTItemIJ::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "MotionJoint");
storeOnLevelString(os, level + 2, motionJoint);
}
void MbD::ASMTAllowRotation::storeOnTimeSeries(std::ofstream& os)
{
os << "AllowRotationSeries\t" << fullName("") << std::endl;
ASMTItemIJ::storeOnTimeSeries(os);
}

View File

@@ -0,0 +1,29 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "ASMTMotion.h"
namespace MbD {
class ASMTAllowRotation : public ASMTMotion
{
//
public:
static std::shared_ptr<ASMTAllowRotation> With();
void parseASMT(std::vector<std::string>& lines) override;
void readMotionJoint(std::vector<std::string>& lines);
void initMarkers() override;
std::shared_ptr<Joint> mbdClassNew() override;
void setMotionJoint(std::string motionJoint);
void storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::string motionJoint, rotationZ;
};
}

View File

@@ -42,7 +42,7 @@ void MbD::ASMTAngleJoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_
angleJoint->theIzJz = theIzJz;
}
void MbD::ASMTAngleJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTAngleJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "theIzJz");

View File

@@ -19,7 +19,7 @@ namespace MbD {
void parseASMT(std::vector<std::string>& lines) override;
void readTheIzJz(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 storeOnLevel(std::ofstream& os, size_t level) override;
double theIzJz = 0.0;
};

View File

@@ -12,9 +12,9 @@ using namespace MbD;
void MbD::ASMTAnimationParameters::parseASMT(std::vector<std::string>& lines)
{
//int nframe, icurrent, istart, iend, framesPerSecond;
//size_t nframe, icurrent, istart, iend, framesPerSecond;
//bool isForward;
int pos = (int)lines[0].find_first_not_of("\t");
auto pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "nframe"));
lines.erase(lines.begin());
@@ -43,7 +43,7 @@ void MbD::ASMTAnimationParameters::parseASMT(std::vector<std::string>& lines)
}
void MbD::ASMTAnimationParameters::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTAnimationParameters::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "AnimationParameters");
storeOnLevelString(os, level + 1, "nframe");

View File

@@ -16,9 +16,9 @@ namespace MbD {
//
public:
void parseASMT(std::vector<std::string>& lines) override;
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
int nframe = 1000000, icurrent = 1, istart = 1, iend = 1000000, framesPerSecond = 30;
size_t nframe = 1000000, icurrent = 1, istart = 1, iend = 1000000, framesPerSecond = 30;
bool isForward = true;

View File

@@ -25,6 +25,7 @@
#include "ASMTSphericalJoint.h"
#include "ASMTFixedJoint.h"
#include "ASMTGeneralMotion.h"
#include "ASMTAllowRotation.h"
#include "ASMTUniversalJoint.h"
#include "ASMTPointInPlaneJoint.h"
#include "ASMTPrincipalMassMarker.h"
@@ -692,6 +693,9 @@ void MbD::ASMTAssembly::readMotions(std::vector<std::string>& lines)
else if (motionsLines[0] == "\t\t\tGeneralMotion") {
motion = CREATE<ASMTGeneralMotion>::With();
}
else if (motionsLines[0] == "\t\t\tAllowRotation") {
motion = CREATE<ASMTAllowRotation>::With();
}
else {
assert(false);
}
@@ -809,7 +813,7 @@ void MbD::ASMTAssembly::readJointSeriesMany(std::vector<std::string>& lines)
if (lines.empty()) return;
assert(lines[0].find("JointSeries") != std::string::npos);
auto it = std::find_if(lines.begin(), lines.end(), [](const std::string& s) {
return s.find("MotionSeries") != std::string::npos;
return s.find("tionSeries") != std::string::npos;
});
std::vector<std::string> jointSeriesLines(lines.begin(), it);
while (!jointSeriesLines.empty()) {
@@ -885,7 +889,7 @@ void MbD::ASMTAssembly::readJointSeries(std::vector<std::string>& lines)
void MbD::ASMTAssembly::readMotionSeriesMany(std::vector<std::string>& lines)
{
while (!lines.empty()) {
assert(lines[0].find("MotionSeries") != std::string::npos);
assert(lines[0].find("tionSeries") != std::string::npos);
readMotionSeries(lines);
}
}
@@ -894,7 +898,7 @@ void MbD::ASMTAssembly::readMotionSeries(std::vector<std::string>& lines)
{
if (lines.empty()) return;
std::string str = lines[0];
std::string substr = "MotionSeries";
std::string substr = "tionSeries";
auto pos = str.find(substr);
assert(pos != std::string::npos);
str.erase(0, pos + substr.length());
@@ -941,9 +945,9 @@ double MbD::ASMTAssembly::calcCharacteristicTime()
double MbD::ASMTAssembly::calcCharacteristicMass()
{
auto n = (int)parts->size();
auto n = parts->size();
double sumOfSquares = 0.0;
for (int i = 0; i < n; i++)
for (size_t i = 0; i < n; i++)
{
auto mass = parts->at(i)->principalMassMarker->mass;
sumOfSquares += mass * mass;
@@ -964,9 +968,9 @@ double MbD::ASMTAssembly::calcCharacteristicLength()
auto& mkrJ = markerMap->at(connector->markerJ);
lengths->push_back(mkrJ->rpmp()->length());
}
auto n = (int)lengths->size();
auto n = lengths->size();
double sumOfSquares = std::accumulate(lengths->begin(), lengths->end(), 0.0, [](double sum, double l) { return sum + l * l; });
auto unitLength = std::sqrt(sumOfSquares / std::max((int)n, 1));
auto unitLength = std::sqrt(sumOfSquares / std::max(n, size_t(1)));
if (unitLength <= 0) unitLength = 1.0;
return unitLength;
}
@@ -1062,7 +1066,7 @@ void MbD::ASMTAssembly::outputFile(std::string filename)
// }
}
void MbD::ASMTAssembly::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Assembly");
storeOnLevelNotes(os, level + 1);
@@ -1291,13 +1295,13 @@ std::shared_ptr<ASMTPart> MbD::ASMTAssembly::partPartialNamed(std::string partia
return part;
}
void MbD::ASMTAssembly::storeOnLevelNotes(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelNotes(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Notes");
storeOnLevelString(os, level + 1, notes);
}
void MbD::ASMTAssembly::storeOnLevelParts(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelParts(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Parts");
for (auto& part : *parts) {
@@ -1305,7 +1309,7 @@ void MbD::ASMTAssembly::storeOnLevelParts(std::ofstream& os, int level)
}
}
void MbD::ASMTAssembly::storeOnLevelKinematicIJs(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelKinematicIJs(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "KinematicIJs");
for (auto& kinematicIJ : *kinematicIJs) {
@@ -1313,7 +1317,7 @@ void MbD::ASMTAssembly::storeOnLevelKinematicIJs(std::ofstream& os, int level)
}
}
void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "ConstraintSets");
storeOnLevelJoints(os, level + 1);
@@ -1321,7 +1325,7 @@ void MbD::ASMTAssembly::storeOnLevelConstraintSets(std::ofstream& os, int level)
storeOnLevelGeneralConstraintSets(os, level + 1);
}
void MbD::ASMTAssembly::storeOnLevelForceTorques(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelForceTorques(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "ForceTorques");
for (auto& forceTorque : *forcesTorques) {
@@ -1329,7 +1333,7 @@ void MbD::ASMTAssembly::storeOnLevelForceTorques(std::ofstream& os, int level)
}
}
void MbD::ASMTAssembly::storeOnLevelJoints(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelJoints(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Joints");
for (auto& joint : *joints) {
@@ -1337,7 +1341,7 @@ void MbD::ASMTAssembly::storeOnLevelJoints(std::ofstream& os, int level)
}
}
void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Motions");
for (auto& motion : *motions) {
@@ -1345,7 +1349,7 @@ void MbD::ASMTAssembly::storeOnLevelMotions(std::ofstream& os, int level)
}
}
void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, int level)
void MbD::ASMTAssembly::storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralConstraintSets");
//for (auto& generalConstraintSet : *generalConstraintSets) {
@@ -1358,13 +1362,13 @@ void MbD::ASMTAssembly::storeOnTimeSeries(std::ofstream& os)
if (times->empty()) return;
os << "TimeSeries" << std::endl;
os << "Number\tInput\t";
for (int i = 1; i < (int)times->size(); i++)
for (size_t i = 1; i < times->size(); i++)
{
os << i << '\t';
}
os << std::endl;
os << "Time\tInput\t";
for (int i = 1; i < (int)times->size(); i++)
for (size_t i = 1; i < times->size(); i++)
{
os << times->at(i) << '\t';
}

View File

@@ -81,7 +81,7 @@ namespace MbD {
void deleteMbD() override;
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;
void storeOnLevel(std::ofstream& os, size_t level) override;
/* This function performs a one shot solve of the assembly.*/
void solve();
@@ -109,14 +109,14 @@ 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 storeOnLevelNotes(std::ofstream& os, size_t level);
void storeOnLevelParts(std::ofstream& os, size_t level);
void storeOnLevelKinematicIJs(std::ofstream& os, size_t level);
void storeOnLevelConstraintSets(std::ofstream& os, size_t level);
void storeOnLevelForceTorques(std::ofstream& os, size_t level);
void storeOnLevelJoints(std::ofstream& os, size_t level);
void storeOnLevelMotions(std::ofstream& os, size_t level);
void storeOnLevelGeneralConstraintSets(std::ofstream& os, size_t level);
void storeOnTimeSeries(std::ofstream& os) override;
void setFilename(std::string filename);

View File

@@ -37,7 +37,7 @@ void MbD::ASMTCompoundJoint::createMbD(std::shared_ptr<System> mbdSys, std::shar
compoundJoint->distanceIJ = distanceIJ;
}
void MbD::ASMTCompoundJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTCompoundJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "distanceIJ");

View File

@@ -18,7 +18,7 @@ namespace MbD {
void parseASMT(std::vector<std::string>& lines) override;
void readDistanceIJ(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 storeOnLevel(std::ofstream& os, size_t level) override;
double distanceIJ = 0.0;

View File

@@ -44,7 +44,7 @@ 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)
void MbD::ASMTConstantGravity::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "ConstantGravity");
storeOnLevelArray(os, level + 1, *g);

View File

@@ -25,7 +25,7 @@ namespace MbD {
void setg(FColDsptr g);
void setg(double a, double b, double c);
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
FColDsptr g = std::make_shared<FullColumn<double>>(ListD{ 0.,0.,0. });
};

View File

@@ -56,7 +56,7 @@ void MbD::ASMTGearJoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_p
gearJoint->radiusJ = radiusJ;
}
void MbD::ASMTGearJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTGearJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "radiusI");

View File

@@ -20,7 +20,7 @@ namespace MbD {
void readRadiusI(std::vector<std::string>& lines);
void readRadiusJ(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 storeOnLevel(std::ofstream& os, size_t level) override;
double radiusI = 0.0, radiusJ = 0.0, aConstant = 0.0;
};

View File

@@ -70,8 +70,8 @@ void MbD::ASMTGeneralMotion::readRotationOrder(std::vector<std::string>& lines)
assert(lines[0].find("RotationOrder") != std::string::npos);
lines.erase(lines.begin());
std::istringstream iss(lines[0]);
rotationOrder = std::make_shared<std::vector<int>>();
int i;
rotationOrder = std::make_shared<std::vector<size_t>>();
size_t i;
while (iss >> i) {
rotationOrder->push_back(i);
}
@@ -146,7 +146,7 @@ void MbD::ASMTGeneralMotion::createMbD(std::shared_ptr<System> mbdSys, std::shar
fullMotion->fangIJJ = fangIJJ;
}
void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTGeneralMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "GeneralMotion");
storeOnLevelString(os, level + 1, "Name");

View File

@@ -21,12 +21,12 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::shared_ptr<FullColumn<std::string>> rIJI = std::make_shared<FullColumn<std::string>>(3);
std::shared_ptr<FullColumn<std::string>> angIJJ = std::make_shared<FullColumn<std::string>>(3);
std::shared_ptr<std::vector<int>> rotationOrder = std::make_shared<std::vector<int>>(std::initializer_list<int>{ 1, 2, 3 });
std::shared_ptr<std::vector<size_t>> rotationOrder = std::make_shared<std::vector<size_t>>(std::initializer_list<size_t>{ 1, 2, 3 });
};
}

View File

@@ -29,7 +29,7 @@ void MbD::ASMTInPlaneJoint::createMbD(std::shared_ptr<System> mbdSys, std::share
inPlaneJoint->offset = offset;
}
void MbD::ASMTInPlaneJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTInPlaneJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "offset");

View File

@@ -18,7 +18,7 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
double offset = 0.0;

View File

@@ -199,39 +199,39 @@ std::shared_ptr<Constant> MbD::ASMTItem::sptrConstant(double value)
return std::make_shared<Constant>(value);
}
void MbD::ASMTItem::storeOnLevel(std::ofstream&, int)
void MbD::ASMTItem::storeOnLevel(std::ofstream&, size_t)
{
noop();
assert(false);
}
void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, int level)
void MbD::ASMTItem::storeOnLevelTabs(std::ofstream& os, size_t level)
{
for (int i = 0; i < level; i++)
for (size_t i = 0; i < level; i++)
{
os << '\t';
}
}
void MbD::ASMTItem::storeOnLevelString(std::ofstream& os, int level, std::string str)
void MbD::ASMTItem::storeOnLevelString(std::ofstream& os, size_t level, std::string str)
{
storeOnLevelTabs(os, level);
os << str << std::endl;
}
void MbD::ASMTItem::storeOnLevelDouble(std::ofstream& os, int level, double value)
void MbD::ASMTItem::storeOnLevelDouble(std::ofstream& os, size_t level, double value)
{
storeOnLevelTabs(os, level);
os << value << std::endl;
}
void MbD::ASMTItem::storeOnLevelInt(std::ofstream& os, int level, int i)
void MbD::ASMTItem::storeOnLevelInt(std::ofstream& os, size_t level, int i)
{
storeOnLevelTabs(os, level);
os << i << std::endl;
}
void MbD::ASMTItem::storeOnLevelBool(std::ofstream& os, int level, bool value)
void MbD::ASMTItem::storeOnLevelBool(std::ofstream& os, size_t level, bool value)
{
storeOnLevelTabs(os, level);
if (value) {
@@ -242,17 +242,17 @@ void MbD::ASMTItem::storeOnLevelBool(std::ofstream& os, int level, bool value)
}
}
void MbD::ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<double> array)
void MbD::ASMTItem::storeOnLevelArray(std::ofstream& os, size_t level, std::vector<double> array)
{
storeOnLevelTabs(os, level);
for (int i = 0; i < (int)array.size(); i++)
for (size_t i = 0; i < array.size(); i++)
{
os << array[i] << '\t';
}
os << std::endl;
}
void MbD::ASMTItem::storeOnLevelName(std::ofstream& os, int level)
void MbD::ASMTItem::storeOnLevelName(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Name");
storeOnLevelString(os, level + 1, name);

View File

@@ -48,16 +48,16 @@ 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);
virtual void storeOnLevel(std::ofstream& os, size_t level);
virtual void storeOnLevelTabs(std::ofstream& os, size_t level);
virtual void storeOnLevelString(std::ofstream& os, size_t level, std::string str);
virtual void storeOnLevelDouble(std::ofstream& os, size_t level, double value);
virtual void storeOnLevelInt(std::ofstream& os, size_t level, int i);
virtual void storeOnLevelBool(std::ofstream& os, size_t 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);
//void storeOnLevelArray(std::ofstream& os, size_t level, std::vector<T> array);
void storeOnLevelArray(std::ofstream& os, size_t level, std::vector<double> array);
void storeOnLevelName(std::ofstream& os, size_t level);
virtual void storeOnTimeSeries(std::ofstream& os);
void logString(std::string& str);
void logString(const char* chars);
@@ -67,10 +67,10 @@ namespace MbD {
std::shared_ptr<Item> mbdObject;
};
//template<typename T>
//inline void ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<T> array)
//inline void ASMTItem::storeOnLevelArray(std::ofstream& os, size_t level, std::vector<T> array)
//{
// storeOnLevelTabs(os, level);
// for (int i = 0; i < array.size(); i++)
// for (size_t i = 0; i < array.size(); i++)
// {
// os << array[i] << '\t';
// }

View File

@@ -97,7 +97,7 @@ void MbD::ASMTItemIJ::readTZonIs(std::vector<std::string>& lines)
lines.erase(lines.begin());
}
void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level + 1, "MarkerI");
storeOnLevelString(os, level + 2, markerI);
@@ -108,37 +108,37 @@ void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTItemIJ::storeOnTimeSeries(std::ofstream& os)
{
os << "FXonI\t";
for (int i = 0; i < (int)fxs->size(); i++)
for (size_t i = 0; i < fxs->size(); i++)
{
os << fxs->at(i) << '\t';
}
os << std::endl;
os << "FYonI\t";
for (int i = 0; i < (int)fys->size(); i++)
for (size_t i = 0; i < fys->size(); i++)
{
os << fys->at(i) << '\t';
}
os << std::endl;
os << "FZonI\t";
for (int i = 0; i < (int)fzs->size(); i++)
for (size_t i = 0; i < fzs->size(); i++)
{
os << fzs->at(i) << '\t';
}
os << std::endl;
os << "TXonI\t";
for (int i = 0; i < (int)txs->size(); i++)
for (size_t i = 0; i < txs->size(); i++)
{
os << txs->at(i) << '\t';
}
os << std::endl;
os << "TYonI\t";
for (int i = 0; i < (int)tys->size(); i++)
for (size_t i = 0; i < tys->size(); i++)
{
os << tys->at(i) << '\t';
}
os << std::endl;
os << "TZonI\t";
for (int i = 0; i < (int)tzs->size(); i++)
for (size_t i = 0; i < tzs->size(); i++)
{
os << tzs->at(i) << '\t';
}

View File

@@ -27,7 +27,7 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::string markerI, markerJ;

View File

@@ -36,7 +36,7 @@ void MbD::ASMTJoint::readJointSeries(std::vector<std::string>& lines)
readTZonIs(lines);
}
void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, size_t level)
{
auto jointType = classname();
jointType = jointType.substr(4, jointType.size() - 4); //Remove ASMT in name

View File

@@ -19,7 +19,7 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::shared_ptr<std::vector<std::shared_ptr<ForceTorqueData>>> jointSeries;

View File

@@ -62,7 +62,7 @@ void ASMTMarker::createMbD(std::shared_ptr<System>, std::shared_ptr<Units> mbdUn
mbdObject = mkr->endFrames->at(0);
}
void ASMTMarker::storeOnLevel(std::ofstream& os, int level)
void ASMTMarker::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Marker");
storeOnLevelString(os, level + 1, "Name");

View File

@@ -22,7 +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;
void storeOnLevel(std::ofstream& os, size_t level) override;
};
}

View File

@@ -14,7 +14,7 @@ using namespace MbD;
void ASMTMotion::readMotionSeries(std::vector<std::string>& lines)
{
std::string str = lines[0];
std::string substr = "MotionSeries";
std::string substr = "tionSeries";
auto pos = str.find(substr);
assert(pos != std::string::npos);
str.erase(0, pos + substr.length());
@@ -33,7 +33,7 @@ void ASMTMotion::initMarkers()
{
}
void ASMTMotion::storeOnLevel(std::ofstream&, int)
void ASMTMotion::storeOnLevel(std::ofstream&, size_t)
{
assert(false);
}

View File

@@ -18,7 +18,7 @@ namespace MbD {
public:
void readMotionSeries(std::vector<std::string>& lines);
virtual void initMarkers();
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::shared_ptr<std::vector<std::shared_ptr<ForceTorqueData>>> motionSeries;

View File

@@ -118,7 +118,7 @@ void MbD::ASMTPart::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Un
if (isFixed) std::static_pointer_cast<Part>(mbdObject)->asFixed();
}
void MbD::ASMTPart::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTPart::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Part");
storeOnLevelName(os, level + 1);
@@ -133,7 +133,7 @@ void MbD::ASMTPart::storeOnLevel(std::ofstream& os, int level)
storeOnLevelRefSurfaces(os, level + 1);
}
void MbD::ASMTPart::storeOnLevelMassMarker(std::ofstream& os, int level)
void MbD::ASMTPart::storeOnLevelMassMarker(std::ofstream& os, size_t level)
{
principalMassMarker->storeOnLevel(os, level);
}

View File

@@ -25,8 +25,8 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnLevelMassMarker(std::ofstream& os, size_t level);
void storeOnTimeSeries(std::ofstream& os) override;
//std::shared_ptr<std::vector<std::shared_ptr<ASMTFeature>>> featureOrder;

View File

@@ -19,7 +19,7 @@ MbD::ASMTPrincipalMassMarker::ASMTPrincipalMassMarker()
void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector<std::string>& lines)
{
int pos = (int)lines[0].find_first_not_of("\t");
auto pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "Name"));
lines.erase(lines.begin());
@@ -32,7 +32,7 @@ void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector<std::string>& lines)
assert(lines[0] == (leadingTabs + "RotationMatrix"));
lines.erase(lines.begin());
rotationMatrix = std::make_shared<FullMatrix<double>>(3);
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
auto row = readRowOfDoubles(lines[0]);
rotationMatrix->atiput(i, row);
@@ -47,7 +47,7 @@ void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector<std::string>& lines)
momentOfInertias = std::make_shared<DiagonalMatrix<double>>(3);
auto row = readRowOfDoubles(lines[0]);
lines.erase(lines.begin());
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
momentOfInertias->atiput(i, row->at(i));
}
@@ -78,7 +78,7 @@ 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)
void MbD::ASMTPrincipalMassMarker::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "PrincipalMassMarker");
storeOnLevelString(os, level + 1, "Name");

View File

@@ -23,7 +23,7 @@ namespace MbD {
// Overloads to simplify syntax.
void setMomentOfInertias(double a, double b, double c);
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
double mass = 1.0;
double density = 10.0;

View File

@@ -42,7 +42,7 @@ void MbD::ASMTRackPinionJoint::createMbD(std::shared_ptr<System> mbdSys, std::sh
rackPinJoint->pitchRadius = pitchRadius;
}
void MbD::ASMTRackPinionJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTRackPinionJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "pitchRadius");

View File

@@ -19,7 +19,7 @@ namespace MbD {
void parseASMT(std::vector<std::string>& lines) override;
void readPitchRadius(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 storeOnLevel(std::ofstream& os, size_t level) override;
double pitchRadius = 0.0, aConstant = 0.0;
};

View File

@@ -16,7 +16,7 @@ void MbD::ASMTRefCurve::parseASMT(std::vector<std::string>&)
assert(false);
}
void MbD::ASMTRefCurve::storeOnLevel(std::ofstream&, int)
void MbD::ASMTRefCurve::storeOnLevel(std::ofstream&, size_t)
{
assert(false);
}

View File

@@ -16,7 +16,7 @@ namespace MbD {
//
public:
void parseASMT(std::vector<std::string>& lines) override;
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
};

View File

@@ -43,7 +43,7 @@ void MbD::ASMTRefItem::readMarker(std::vector<std::string>& lines)
marker->owner = this;
}
void MbD::ASMTRefItem::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTRefItem::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RefPoints");
ASMTSpatialItem::storeOnLevel(os, level+1);

View File

@@ -20,7 +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;
void storeOnLevel(std::ofstream& os, size_t level) override;
std::shared_ptr<std::vector<std::shared_ptr<ASMTMarker>>> markers = std::make_shared<std::vector<std::shared_ptr<ASMTMarker>>>();

View File

@@ -31,7 +31,7 @@ void MbD::ASMTRefPoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_pt
}
}
void MbD::ASMTRefPoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTRefPoint::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RefPoint");
ASMTSpatialItem::storeOnLevel(os, level);

View File

@@ -20,7 +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;
void storeOnLevel(std::ofstream& os, size_t level) override;
};

View File

@@ -16,7 +16,7 @@ void MbD::ASMTRefSurface::parseASMT(std::vector<std::string>&)
assert(false);
}
void MbD::ASMTRefSurface::storeOnLevel(std::ofstream&, int)
void MbD::ASMTRefSurface::storeOnLevel(std::ofstream&, size_t)
{
assert(false);
}

View File

@@ -16,7 +16,7 @@ namespace MbD {
//
public:
void parseASMT(std::vector<std::string>& lines) override;
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevel(std::ofstream& os, size_t level) override;
};

View File

@@ -92,7 +92,7 @@ void MbD::ASMTRotationalMotion::setRotationZ(std::string rotZ)
rotationZ = rotZ;
}
void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTRotationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationalMotion");
storeOnLevelString(os, level + 1, "Name");

View File

@@ -24,7 +24,7 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::string motionJoint, rotationZ;

View File

@@ -42,7 +42,7 @@ void MbD::ASMTScrewJoint::createMbD(std::shared_ptr<System> mbdSys, std::shared_
screwJoint->pitch = pitch;
}
void MbD::ASMTScrewJoint::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTScrewJoint::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTJoint::storeOnLevel(os, level);
storeOnLevelString(os, level + 1, "pitch");

View File

@@ -19,7 +19,7 @@ namespace MbD {
void parseASMT(std::vector<std::string>& lines) override;
void readPitch(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 storeOnLevel(std::ofstream& os, size_t level) override;
double pitch = 0.0, aConstant = 0.0;
};

View File

@@ -14,7 +14,7 @@ void MbD::ASMTSimulationParameters::parseASMT(std::vector<std::string>& lines)
{
//tstart, tend, hmin, hmax, hout, errorTol;
int pos = (int)lines[0].find_first_not_of("\t");
auto pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "tstart"));
lines.erase(lines.begin());
@@ -73,13 +73,13 @@ void MbD::ASMTSimulationParameters::seterrorTol(double tol)
errorTol = tol;
}
void MbD::ASMTSimulationParameters::setmaxIter(int maxIter)
void MbD::ASMTSimulationParameters::setmaxIter(size_t maxIter)
{
iterMaxPosKine = maxIter;
iterMaxAccKine = maxIter;
}
void MbD::ASMTSimulationParameters::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTSimulationParameters::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "SimulationParameters");
storeOnLevelString(os, level + 1, "tstart");

View File

@@ -22,13 +22,13 @@ namespace MbD {
void sethmax(double hmax);
void sethout(double hout);
void seterrorTol(double errorTol);
void setmaxIter(int maxIter);
void storeOnLevel(std::ofstream& os, int level) override;
void setmaxIter(size_t maxIter);
void storeOnLevel(std::ofstream& os, size_t 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;
double intAbsTol = 1.0e-6, intRelTol = 1.0e-6, translationLimit = 1.0e9, rotationLimit = 1.0e9;
int iterMaxPosKine = 25, iterMaxAccKine = 25, iterMaxDyn = 4, orderMax = 5;
size_t iterMaxPosKine = 25, iterMaxAccKine = 25, iterMaxDyn = 4, orderMax = 5;
};
}

View File

@@ -501,7 +501,7 @@ std::shared_ptr<std::vector<std::shared_ptr<ASMTMarker>>> MbD::ASMTSpatialContai
return markers;
}
void MbD::ASMTSpatialContainer::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTSpatialContainer::storeOnLevel(std::ofstream& os, size_t level)
{
ASMTSpatialItem::storeOnLevel(os, level);
storeOnLevelVelocity(os, level + 1);
@@ -557,7 +557,7 @@ 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)
void MbD::ASMTSpatialContainer::storeOnLevelVelocity(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Velocity3D");
if (vxs == nullptr || vxs->empty()) {
@@ -569,7 +569,7 @@ void MbD::ASMTSpatialContainer::storeOnLevelVelocity(std::ofstream& os, int leve
}
}
void MbD::ASMTSpatialContainer::storeOnLevelOmega(std::ofstream& os, int level)
void MbD::ASMTSpatialContainer::storeOnLevelOmega(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Omega3D");
if (omexs == nullptr || omexs->empty()) {
@@ -581,7 +581,7 @@ void MbD::ASMTSpatialContainer::storeOnLevelOmega(std::ofstream& os, int level)
}
}
void MbD::ASMTSpatialContainer::storeOnLevelRefPoints(std::ofstream& os, int level)
void MbD::ASMTSpatialContainer::storeOnLevelRefPoints(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RefPoints");
for (auto& refPoint : *refPoints)
@@ -590,7 +590,7 @@ void MbD::ASMTSpatialContainer::storeOnLevelRefPoints(std::ofstream& os, int lev
}
}
void MbD::ASMTSpatialContainer::storeOnLevelRefCurves(std::ofstream& os, int level)
void MbD::ASMTSpatialContainer::storeOnLevelRefCurves(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RefCurves");
for (auto& refCurve : *refCurves)
@@ -599,7 +599,7 @@ void MbD::ASMTSpatialContainer::storeOnLevelRefCurves(std::ofstream& os, int lev
}
}
void MbD::ASMTSpatialContainer::storeOnLevelRefSurfaces(std::ofstream& os, int level)
void MbD::ASMTSpatialContainer::storeOnLevelRefSurfaces(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RefSurfaces");
for (auto& refSurface : *refSurfaces)
@@ -611,116 +611,116 @@ void MbD::ASMTSpatialContainer::storeOnLevelRefSurfaces(std::ofstream& os, int l
void MbD::ASMTSpatialContainer::storeOnTimeSeries(std::ofstream& os)
{
os << "X\t";
for (int i = 0; i < (int)xs->size(); i++)
for (size_t i = 0; i < xs->size(); i++)
{
os << xs->at(i) << '\t';
}
os << std::endl;
os << "Y\t";
for (int i = 0; i < (int)ys->size(); i++)
for (size_t i = 0; i < ys->size(); i++)
{
os << ys->at(i) << '\t';
}
os << std::endl;
os << "Z\t";
for (int i = 0; i < (int)zs->size(); i++)
for (size_t i = 0; i < zs->size(); i++)
{
os << zs->at(i) << '\t';
}
os << std::endl;
os << "Bryantx\t";
for (int i = 0; i < (int)bryxs->size(); i++)
for (size_t i = 0; i < bryxs->size(); i++)
{
os << bryxs->at(i) << '\t';
}
os << std::endl;
os << "Bryanty\t";
for (int i = 0; i < (int)bryys->size(); i++)
for (size_t i = 0; i < bryys->size(); i++)
{
os << bryys->at(i) << '\t';
}
os << std::endl;
os << "Bryantz\t";
for (int i = 0; i < (int)bryzs->size(); i++)
for (size_t i = 0; i < bryzs->size(); i++)
{
os << bryzs->at(i) << '\t';
}
os << std::endl;
os << "VX\t";
for (int i = 0; i < (int)vxs->size(); i++)
for (size_t i = 0; i < vxs->size(); i++)
{
os << vxs->at(i) << '\t';
}
os << std::endl;
os << "VY\t";
for (int i = 0; i < (int)vys->size(); i++)
for (size_t i = 0; i < vys->size(); i++)
{
os << vys->at(i) << '\t';
}
os << std::endl;
os << "VZ\t";
for (int i = 0; i < (int)vzs->size(); i++)
for (size_t i = 0; i < vzs->size(); i++)
{
os << vzs->at(i) << '\t';
}
os << std::endl;
os << "OmegaX\t";
for (int i = 0; i < (int)omexs->size(); i++)
for (size_t i = 0; i < omexs->size(); i++)
{
os << omexs->at(i) << '\t';
}
os << std::endl;
os << "OmegaY\t";
for (int i = 0; i < (int)omeys->size(); i++)
for (size_t i = 0; i < omeys->size(); i++)
{
os << omeys->at(i) << '\t';
}
os << std::endl;
os << "OmegaZ\t";
for (int i = 0; i < (int)omezs->size(); i++)
for (size_t i = 0; i < omezs->size(); i++)
{
os << omezs->at(i) << '\t';
}
os << std::endl;
os << "AX\t";
for (int i = 0; i < (int)axs->size(); i++)
for (size_t i = 0; i < axs->size(); i++)
{
os << axs->at(i) << '\t';
}
os << std::endl;
os << "AY\t";
for (int i = 0; i < (int)ays->size(); i++)
for (size_t i = 0; i < ays->size(); i++)
{
os << ays->at(i) << '\t';
}
os << std::endl;
os << "AZ\t";
for (int i = 0; i < (int)azs->size(); i++)
for (size_t i = 0; i < azs->size(); i++)
{
os << azs->at(i) << '\t';
}
os << std::endl;
os << "AlphaX\t";
for (int i = 0; i < (int)alpxs->size(); i++)
for (size_t i = 0; i < alpxs->size(); i++)
{
os << alpxs->at(i) << '\t';
}
os << std::endl;
os << "AlphaY\t";
for (int i = 0; i < (int)alpys->size(); i++)
for (size_t i = 0; i < alpys->size(); i++)
{
os << alpys->at(i) << '\t';
}
os << std::endl;
os << "AlphaZ\t";
for (int i = 0; i < (int)alpzs->size(); i++)
for (size_t i = 0; i < alpzs->size(); i++)
{
os << alpzs->at(i) << '\t';
}
os << std::endl;
}
FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(int i)
FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(size_t i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, vxs->at(i));
@@ -729,7 +729,7 @@ FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(int i)
return vec3;
}
FColDsptr MbD::ASMTSpatialContainer::getOmega3D(int i)
FColDsptr MbD::ASMTSpatialContainer::getOmega3D(size_t i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, omexs->at(i));

View File

@@ -80,15 +80,15 @@ namespace MbD {
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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnLevelVelocity(std::ofstream& os, size_t level);
void storeOnLevelOmega(std::ofstream& os, size_t level);
void storeOnLevelRefPoints(std::ofstream& os, size_t level);
void storeOnLevelRefCurves(std::ofstream& os, size_t level);
void storeOnLevelRefSurfaces(std::ofstream& os, size_t level);
void storeOnTimeSeries(std::ofstream& os) override;
FColDsptr getVelocity3D(int i);
FColDsptr getOmega3D(int i);
FColDsptr getVelocity3D(size_t i);
FColDsptr getOmega3D(size_t i);
FColDsptr velocity3D = std::make_shared<FullColumn<double>>(3);
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);

View File

@@ -53,7 +53,7 @@ void MbD::ASMTSpatialItem::readRotationMatrix(std::vector<std::string>& lines)
assert(lines[0].find("RotationMatrix") != std::string::npos);
lines.erase(lines.begin());
rotationMatrix = std::make_shared<FullMatrix<double>>(3, 0);
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
auto& row = rotationMatrix->at(i);
std::istringstream iss(lines[0]);
@@ -98,13 +98,13 @@ void MbD::ASMTSpatialItem::setRotationMatrix(double v11, double v12, double v13,
});
}
void MbD::ASMTSpatialItem::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTSpatialItem::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelPosition(os, level + 1);
storeOnLevelRotationMatrix(os, level + 1);
}
void MbD::ASMTSpatialItem::storeOnLevelPosition(std::ofstream& os, int level)
void MbD::ASMTSpatialItem::storeOnLevelPosition(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "Position3D");
if (xs == nullptr || xs->empty()) {
@@ -116,18 +116,18 @@ void MbD::ASMTSpatialItem::storeOnLevelPosition(std::ofstream& os, int level)
}
}
void MbD::ASMTSpatialItem::storeOnLevelRotationMatrix(std::ofstream& os, int level)
void MbD::ASMTSpatialItem::storeOnLevelRotationMatrix(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "RotationMatrix");
if (xs == nullptr || xs->empty()) {
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
storeOnLevelArray(os, level + 1, *rotationMatrix->at(i));
}
}
else {
auto rotMat = getRotationMatrix(0);
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < 3; i++)
{
storeOnLevelArray(os, level + 1, *rotMat->at(i));
}
@@ -135,7 +135,7 @@ void MbD::ASMTSpatialItem::storeOnLevelRotationMatrix(std::ofstream& os, int lev
}
FColDsptr MbD::ASMTSpatialItem::getPosition3D(int i)
FColDsptr MbD::ASMTSpatialItem::getPosition3D(size_t i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, xs->at(i));
@@ -144,7 +144,7 @@ FColDsptr MbD::ASMTSpatialItem::getPosition3D(int i)
return vec3;
}
FMatDsptr MbD::ASMTSpatialItem::getRotationMatrix(int i)
FMatDsptr MbD::ASMTSpatialItem::getRotationMatrix(size_t i)
{
auto bryantAngles = std::make_shared<EulerAngles<double>>();
bryantAngles->setRotOrder(1, 2, 3);

View File

@@ -29,11 +29,11 @@ namespace MbD {
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 getPosition3D(int i);
FMatDsptr getRotationMatrix(int i);
void storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnLevelPosition(std::ofstream& os, size_t level);
void storeOnLevelRotationMatrix(std::ofstream& os, size_t level);
FColDsptr getPosition3D(size_t i);
FMatDsptr getRotationMatrix(size_t i);
FColDsptr position3D = std::make_shared<FullColumn<double>>(3);
FMatDsptr rotationMatrix = std::make_shared<FullMatrix<double>>(ListListD{

View File

@@ -68,7 +68,7 @@ void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector<std::string>& li
lines.erase(lines.begin());
}
void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTTranslationalMotion::storeOnLevel(std::ofstream& os, size_t level)
{
storeOnLevelString(os, level, "TranslationalMotion");
storeOnLevelString(os, level + 1, "Name");

View File

@@ -21,7 +21,7 @@ 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 storeOnLevel(std::ofstream& os, size_t level) override;
void storeOnTimeSeries(std::ofstream& os) override;
std::string motionJoint, translationZ;

View File

@@ -15,7 +15,7 @@ using namespace MbD;
//
//AbsConstraint::AbsConstraint(const char* str) : Constraint(str) {}
AbsConstraint::AbsConstraint(int i)
AbsConstraint::AbsConstraint(size_t i)
{
axis = i;
}
@@ -23,10 +23,10 @@ AbsConstraint::AbsConstraint(int i)
void AbsConstraint::calcPostDynCorrectorIteration()
{
if (axis < 3) {
aG = static_cast<PartFrame*>(owner)->qX->at((int)axis);
aG = static_cast<PartFrame*>(owner)->qX->at(axis);
}
else {
aG = static_cast<PartFrame*>(owner)->qE->at((int)axis - 3);
aG = static_cast<PartFrame*>(owner)->qE->at(axis - 3);
}
}
@@ -63,10 +63,10 @@ void AbsConstraint::fillAccICIterError(FColDsptr col)
auto partFrame = static_cast<PartFrame*>(owner);
double sum;
if (axis < 3) {
sum = partFrame->qXddot->at((int)axis);
sum = partFrame->qXddot->at(axis);
}
else {
sum = partFrame->qEddot->at((int)axis - 3);
sum = partFrame->qEddot->at(axis - 3);
}
col->atiplusNumber(iG, sum);
}

View File

@@ -16,7 +16,7 @@ namespace MbD {
public:
//AbsConstraint();
//AbsConstraint(const char* str);
AbsConstraint(int axis);
AbsConstraint(size_t axis);
void calcPostDynCorrectorIteration() override;
void fillAccICIterError(FColDsptr col) override;
@@ -26,8 +26,8 @@ namespace MbD {
void fillVelICJacob(SpMatDsptr mat) override;
void useEquationNumbers() override;
int axis = -1;
int iqXminusOnePlusAxis = -1;
size_t axis = SIZE_MAX;
size_t iqXminusOnePlusAxis = SIZE_MAX;
};
}

View File

@@ -29,7 +29,7 @@ void AccNewtonRaphson::assignEquationNumbers()
//auto contactEndFrames = system->contactEndFrames();
//auto uHolders = system->uHolders();
auto constraints = system->allConstraints();
int eqnNo = 0;
size_t eqnNo = 0;
for (auto& part : *parts) {
part->iqX(eqnNo);
eqnNo = eqnNo + 3;
@@ -74,7 +74,8 @@ void AccNewtonRaphson::fillY()
void AccNewtonRaphson::incrementIterNo()
{
if (iterNo >= iterMax)
iterNo++;
if (iterNo > iterMax)
{
std::stringstream ss;
ss << "MbD: No convergence after " << iterNo << " iterations.";
@@ -91,8 +92,6 @@ void AccNewtonRaphson::incrementIterNo()
throw SimulationStoppingError("");
}
iterNo++;
}
void AccNewtonRaphson::initializeGlobally()

View File

@@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "System.h"
#include "AllowZRotation.h"
#include "FullColumn.h"
#include "AllowZRotationConstraintIqctJqc.h"
#include "EndFrameqc.h"
#include "EndFrameqct.h"
#include "CREATE.h"
#include "RedundantConstraint.h"
using namespace MbD;
MbD::AllowZRotation::AllowZRotation()
{
}
MbD::AllowZRotation::AllowZRotation(const char* str) : PrescribedMotion(str)
{
}
std::shared_ptr<AllowZRotation> MbD::AllowZRotation::With()
{
auto allowZRotation = std::make_shared<AllowZRotation>();
allowZRotation->initialize();
return allowZRotation;
}
void MbD::AllowZRotation::initializeGlobally()
{
if (constraints->empty()) {
initMotions();
auto dirCosCon = AllowZRotationConstraintIqctJqc::With(frmI, frmJ, 1, 0);
addConstraint(dirCosCon);
this->root()->hasChanged = true;
}
else {
PrescribedMotion::initializeGlobally();
}
}
void MbD::AllowZRotation::postPosIC()
{
for (size_t i = 0; i < constraints->size(); i++)
{
auto& constraint = constraints->at(i);
auto redunCon = CREATE<RedundantConstraint>::With();
redunCon->constraint = constraint;
constraints->at(i) = redunCon;
}
}

View File

@@ -0,0 +1,25 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "PrescribedMotion.h"
namespace MbD {
class AllowZRotation : public PrescribedMotion
{
//
public:
AllowZRotation();
AllowZRotation(const char* str);
static std::shared_ptr<AllowZRotation> With();
void initializeGlobally() override;
void postPosIC() override;
};
}

View File

@@ -0,0 +1,53 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#include "AllowZRotationConstraintIqctJqc.h"
#include "EndFramec.h"
#include "MarkerFrame.h"
#include "EndFrameqc.h"
#include "CREATE.h"
#include "Symbolic.h"
#include "Constant.h"
#include "EulerAngleszxz.h"
using namespace MbD;
MbD::AllowZRotationConstraintIqctJqc::AllowZRotationConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
DirectionCosineConstraintIqctJqc(frmi, frmj, axisi, axisj)
{
}
std::shared_ptr<AllowZRotationConstraintIqctJqc> MbD::AllowZRotationConstraintIqctJqc::With(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj)
{
auto con = std::make_shared<AllowZRotationConstraintIqctJqc>(frmi, frmj, axisi, axisj);
con->initialize();
return con;
}
void MbD::AllowZRotationConstraintIqctJqc::postInput()
{
auto eqctI = std::static_pointer_cast<EndFrameqct>(frmI);
auto aAImJe = eqctI->getMarkerFrame()->aAOm->transposeTimesFullMatrix(frmJ->aAOe);
auto aEulerAngleszxz = aAImJe->eulerAngleszxz();
auto the1z = aEulerAngleszxz->at(1);
auto the2x = aEulerAngleszxz->at(2);
if (std::abs(the2x) < (OS_M_PI / 2.0)) {
eqctI->phiThePsiBlks->at(1) = std::make_shared<Constant>(the1z);
}
else {
eqctI->phiThePsiBlks->at(1) = std::make_shared<Constant>(OS_M_PI + the1z);
}
eqctI->postInput();
DirectionCosineConstraintIqctJqc::postInput();
}
void MbD::AllowZRotationConstraintIqctJqc::postPosIC()
{
//self becomeRedundantConstraint
assert(false);
}

View File

@@ -0,0 +1,25 @@
/***************************************************************************
* Copyright (c) 2023 Ondsel, Inc. *
* *
* This file is part of OndselSolver. *
* *
* See LICENSE file for details about copyright. *
***************************************************************************/
#pragma once
#include "DirectionCosineConstraintIqctJqc.h"
namespace MbD {
class AllowZRotationConstraintIqctJqc : public DirectionCosineConstraintIqctJqc
{
public:
AllowZRotationConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
static std::shared_ptr<AllowZRotationConstraintIqctJqc> With(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void postInput() override;
void postPosIC() override;
};
}

View File

@@ -28,11 +28,11 @@ void MbD::AngleZIeqcJec::calcPostDynCorrectorIteration()
psthezpEI = aA10IeJe->pvaluepEI();
auto ppcthezpEIpEI = aA00IeJe->ppvaluepEIpEI();
auto ppsthezpEIpEI = aA10IeJe->ppvaluepEIpEI();
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
pthezpEI->atiput(i, (psthezpEI->at(i)) * cosOverSSq - ((pcthezpEI->at(i)) * sinOverSSq));
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto ppthezpEIpEIi = ppthezpEIpEI->at(i);
auto ppcthezpEIpEIi = ppcthezpEIpEI->at(i);
@@ -43,7 +43,7 @@ void MbD::AngleZIeqcJec::calcPostDynCorrectorIteration()
auto term2 = ppsthezpEIpEIi->at(i) * cosOverSSq - (ppcthezpEIpEIi->at(i) * sinOverSSq);
auto term3 = (psthezpEIi * pcthezpEIi + (pcthezpEIi * psthezpEIi)) * dSqOverSSqSq;
ppthezpEIpEIi->atiput(i, term1 + term2 + term3);
for (int j = i + 1; j < 4; j++)
for (size_t j = i + 1; j < 4; j++)
{
auto pcthezpEIj = pcthezpEI->at(j);
auto psthezpEIj = psthezpEI->at(j);

View File

@@ -32,18 +32,18 @@ void MbD::AngleZIeqcJeqc::calcPostDynCorrectorIteration()
auto ppsthezpEIpEJ = aA10IeJe->ppvaluepEIpEJ();
auto ppcthezpEJpEJ = aA00IeJe->ppvaluepEJpEJ();
auto ppsthezpEJpEJ = aA10IeJe->ppvaluepEJpEJ();
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
pthezpEJ->atiput(i, (psthezpEJ->at(i)) * cosOverSSq - ((pcthezpEJ->at(i)) * sinOverSSq));
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto ppthezpEIpEJi = ppthezpEIpEJ->at(i);
auto ppcthezpEIpEJi = ppcthezpEIpEJ->at(i);
auto ppsthezpEIpEJi = ppsthezpEIpEJ->at(i);
auto pcthezpEIi = pcthezpEI->at(i);
auto psthezpEIi = psthezpEI->at(i);
for (int j = 0; j < 4; j++)
for (size_t j = 0; j < 4; j++)
{
auto pcthezpEJj = pcthezpEJ->at(j);
auto psthezpEJj = psthezpEJ->at(j);
@@ -53,7 +53,7 @@ void MbD::AngleZIeqcJeqc::calcPostDynCorrectorIteration()
ppthezpEIpEJi->atiput(j, term1 + term2 + term3);
}
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto ppthezpEJpEJi = ppthezpEJpEJ->at(i);
auto ppcthezpEJpEJi = ppcthezpEJpEJ->at(i);
@@ -64,7 +64,7 @@ void MbD::AngleZIeqcJeqc::calcPostDynCorrectorIteration()
auto term2 = ppsthezpEJpEJi->at(i) * cosOverSSq - (ppcthezpEJpEJi->at(i) * sinOverSSq);
auto term3 = (psthezpEJi * pcthezpEJi + (pcthezpEJi * psthezpEJi)) * dSqOverSSqSq;
ppthezpEJpEJi->atiput(i, term1 + term2 + term3);
for (int j = i + 1; j < 4; j++)
for (size_t j = i + 1; j < 4; j++)
{
auto pcthezpEJj = pcthezpEJ->at(j);
auto psthezpEJj = psthezpEJ->at(j);

View File

@@ -26,10 +26,10 @@ namespace MbD {
void passRootToSystem() override;
void assignEquationNumbers() override = 0;
int nqsu = -1;
size_t nqsu = SIZE_MAX;
FColDsptr qsuOld;
DiagMatDsptr qsuWeights;
int nSingularMatrixError = -1;
size_t nSingularMatrixError = SIZE_MAX;
};
}

View File

@@ -13,6 +13,8 @@
#include <memory>
#include <cmath>
#include <cassert>
#include "Numeric.h"
#include <limits>
//#include "Symbolic.h"
@@ -38,15 +40,15 @@ namespace MbD {
virtual void zeroSelf();
virtual double sumOfSquares() = 0;
double rootMeanSquare();
virtual int numberOfElements();
void swapElems(int i, int ii);
virtual size_t numberOfElements();
void swapElems(size_t i, size_t ii);
virtual double maxMagnitude() = 0;
double maxMagnitudeOfVector();
void equalArrayAt(std::shared_ptr<Array<T>> array, int i);
void atiput(int i, T value);
void equalArrayAt(std::shared_ptr<Array<T>> array, size_t i);
void atiput(size_t i, T value);
void magnifySelf(T factor);
void negateSelf();
void atitimes(int i, double factor);
void atitimes(size_t i, double factor);
virtual std::ostream& printOn(std::ostream& s) const {
std::string str = typeid(*this).name();
@@ -72,14 +74,14 @@ namespace MbD {
template<typename T>
inline void Array<T>::copyFrom(std::shared_ptr<Array<T>> x)
{
for (int i = 0; i < (int)x->size(); i++) {
for (size_t i = 0; i < x->size(); i++) {
this->at(i) = x->at(i);
}
}
template<typename T>
inline void Array<T>::zeroSelf()
{
for (int i = 0; i < (int)this->size(); i++) {
for (size_t i = 0; i < this->size(); i++) {
this->at(i) = (T)0;
}
}
@@ -89,12 +91,12 @@ namespace MbD {
return std::sqrt(this->sumOfSquares() / this->numberOfElements());
}
template<typename T>
inline int Array<T>::numberOfElements()
inline size_t Array<T>::numberOfElements()
{
return (int)this->size();
return this->size();
}
template<typename T>
inline void Array<T>::swapElems(int i, int ii)
inline void Array<T>::swapElems(size_t i, size_t ii)
{
auto temp = this->at(i);
this->at(i) = this->at(ii);
@@ -104,7 +106,7 @@ namespace MbD {
//inline double Array<double>::maxMagnitude()
//{
// double max = 0.0;
// for (int i = 0; i < this->size(); i++)
// for (size_t i = 0; i < this->size(); i++)
// {
// auto element = this->at(i);
// if (element < 0.0) element = -element;
@@ -116,7 +118,7 @@ namespace MbD {
inline double Array<T>::maxMagnitudeOfVector()
{
double answer = 0.0;
for (int i = 0; i < this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
double mag = std::abs(this->at(i));
if (answer < mag) answer = mag;
@@ -124,11 +126,11 @@ namespace MbD {
return answer;
}
template<typename T>
inline void Array<T>::equalArrayAt(std::shared_ptr<Array<T>> array, int i)
inline void Array<T>::equalArrayAt(std::shared_ptr<Array<T>> array, size_t i)
{
for (int ii = 0; ii < (int)this->size(); ii++)
for (size_t ii = 0; ii < this->size(); ii++)
{
this->at(ii) = array->at((int)i + ii);
this->at(ii) = array->at(i + ii);
}
}
//template<>
@@ -148,7 +150,7 @@ namespace MbD {
//template<>
//inline void Array<double>::conditionSelfWithTol(double tol)
//{
// for (int i = 0; i < this->size(); i++)
// for (size_t i = 0; i < this->size(); i++)
// {
// double element = this->at(i);
// if (element < 0.0) element = -element;
@@ -156,7 +158,7 @@ namespace MbD {
// }
//}
template<typename T>
inline void Array<T>::atiput(int i, T value)
inline void Array<T>::atiput(size_t i, T value)
{
this->at(i) = value;
}
@@ -164,7 +166,7 @@ namespace MbD {
//inline double Array<double>::length()
//{
// double ssq = 0.0;
// for (int i = 0; i < this->size(); i++)
// for (size_t i = 0; i < this->size(); i++)
// {
// double elem = this->at(i);
// ssq += elem * elem;
@@ -174,7 +176,7 @@ namespace MbD {
template<typename T>
inline void Array<T>::magnifySelf(T factor)
{
for (int i = 0; i < (int)this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
this->atitimes(i, factor);
}
@@ -185,7 +187,7 @@ namespace MbD {
magnifySelf(-1);
}
template<typename T>
inline void Array<T>::atitimes(int i, double factor)
inline void Array<T>::atitimes(size_t i, double factor)
{
this->at(i) *= factor;
}

View File

@@ -12,7 +12,7 @@
using namespace MbD;
AtPointConstraintIJ::AtPointConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, int axisi) :
AtPointConstraintIJ::AtPointConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi) :
ConstraintIJ(frmi, frmj), axis(axisi)
{
}

View File

@@ -17,7 +17,7 @@ namespace MbD {
{
//axis riIeJeO
public:
AtPointConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, int axisi);
AtPointConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi);
void calcPostDynCorrectorIteration() override;
void initialize() override;
@@ -32,7 +32,7 @@ namespace MbD {
ConstraintType type() override;
int axis;
size_t axis;
std::shared_ptr<DispCompIecJecO> riIeJeO;
};
}

View File

@@ -13,7 +13,7 @@
using namespace MbD;
AtPointConstraintIqcJc::AtPointConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi) :
AtPointConstraintIqcJc::AtPointConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi) :
AtPointConstraintIJ(frmi, frmj, axisi)
{
}
@@ -97,7 +97,7 @@ void AtPointConstraintIqcJc::addToJointTorqueI(FColDsptr jointTorque)
auto pAOIppEI = frmI->pAOppE();
auto aBOIp = frmI->aBOp();
auto fpAOIppEIrIpIeIp = std::make_shared<FullColumn<double>>(4, 0.0);
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto dum = cForceT->timesFullColumn(pAOIppEI->at(i)->timesFullColumn(rIpIeIp));
fpAOIppEIrIpIeIp->atiput(i, dum);

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpEI ppGpEIpEI iqXIminusOnePlusAxis iqEI
public:
AtPointConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi);
AtPointConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi);
void addToJointForceI(FColDsptr col) override;
void addToJointTorqueI(FColDsptr col) override;
@@ -31,8 +31,8 @@ namespace MbD {
FRowDsptr pGpEI;
FMatDsptr ppGpEIpEI;
int iqXIminusOnePlusAxis = -1;
int iqEI = -1;
size_t iqXIminusOnePlusAxis = SIZE_MAX;
size_t iqEI = SIZE_MAX;
};
}

View File

@@ -13,7 +13,7 @@
using namespace MbD;
AtPointConstraintIqcJqc::AtPointConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi) :
AtPointConstraintIqcJqc::AtPointConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi) :
AtPointConstraintIqcJc(frmi, frmj, axisi)
{
}

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpEJ ppGpEJpEJ iqXJminusOnePlusAxis iqEJ
public:
AtPointConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi);
AtPointConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi);
void calcPostDynCorrectorIteration() override;
void initializeGlobally() override;
@@ -29,7 +29,7 @@ namespace MbD {
FRowDsptr pGpEJ;
FMatDsptr ppGpEJpEJ;
int iqXJminusOnePlusAxis = -1, iqEJ = -1;
size_t iqXJminusOnePlusAxis = SIZE_MAX, iqEJ = SIZE_MAX;
};
}

View File

@@ -12,7 +12,7 @@
using namespace MbD;
AtPointConstraintIqctJqc::AtPointConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi) :
AtPointConstraintIqctJqc::AtPointConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi) :
AtPointConstraintIqcJqc(frmi, frmj, axisi)
{
}

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpt ppGpEIpt ppGptpt
public:
AtPointConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi);
AtPointConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi);
void calcPostDynCorrectorIteration() override;
void fillAccICIterError(FColDsptr col) override;

View File

@@ -18,7 +18,7 @@ void BasicIntegrator::initializeLocally()
_continue = true;
}
void BasicIntegrator::iStep(int integer)
void BasicIntegrator::iStep(size_t integer)
{
istep = integer;
opBDF->setiStep(integer);
@@ -64,7 +64,7 @@ void BasicIntegrator::incrementTime()
{
tpast->insert(tpast->begin(), t);
if ((int)tpast->size() > (orderMax + 1)) { tpast->pop_back(); }
if (tpast->size() > (orderMax + 1)) { tpast->pop_back(); }
auto istepNew = istep + 1;
this->iStep(istepNew);
this->setorder(orderNew);
@@ -129,7 +129,7 @@ void BasicIntegrator::reportStats()
{
}
void BasicIntegrator::setorder(int o)
void BasicIntegrator::setorder(size_t o)
{
order = o;
opBDF->setorder(o);

View File

@@ -26,7 +26,7 @@ namespace MbD {
void initialize() override;
void initializeGlobally() override;
void initializeLocally() override;
void iStep(int i) override;
void iStep(size_t i) override;
void postFirstStep() override;
void postStep() override;
void postRun() override;
@@ -40,17 +40,17 @@ namespace MbD {
void setSystem(Solver* sys) override;
void logString(std::string& str) override;
virtual void setorder(int o);
virtual void setorder(size_t o);
virtual void settnew(double t);
virtual void sett(double t);
void settime(double t);
double tprevious();
IntegratorInterface* system;
int istep = 0, iTry = 0, maxTry = 0;
size_t istep = 0, iTry = 0, maxTry = 0;
std::shared_ptr<std::vector<double>> tpast;
double t = 0.0, tnew = 0.0, h = 0, hnew = 0.0;
int order = 0, orderNew = 0, orderMax = 0;
size_t order = 0, orderNew = 0, orderMax = 0;
std::shared_ptr<DifferenceOperator> opBDF;
bool _continue = false;
};

View File

@@ -38,12 +38,12 @@ namespace MbD {
inst->initialize();
return inst;
}
static std::shared_ptr<T> With(int n) {
static std::shared_ptr<T> With(size_t n) {
auto inst = std::make_shared<T>(n);
inst->initialize();
return inst;
}
static std::shared_ptr<T> With(int m, int n) {
static std::shared_ptr<T> With(size_t m, size_t n) {
auto inst = std::make_shared<T>(m, n);
inst->initialize();
return inst;
@@ -58,17 +58,17 @@ namespace MbD {
inst->initialize();
return inst;
}
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axis) {
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, size_t axis) {
auto inst = std::make_shared<T>(frmi, frmj, axis);
inst->initialize();
return inst;
}
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, std::shared_ptr<EndFramec> frmk, int axisk) {
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, std::shared_ptr<EndFramec> frmk, size_t axisk) {
auto inst = std::make_shared<T>(frmi, frmj, frmk, axisk);
inst->initialize();
return inst;
}
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axis) {
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, size_t axis) {
std::shared_ptr<Constraint> inst;
std::string str = typeid(T(frmi, frmj, axis)).name();
if (str.find("AtPointConstraintIJ") != std::string::npos) {
@@ -90,12 +90,12 @@ namespace MbD {
inst->initialize();
return inst;
}
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axisi, int axisj) {
static std::shared_ptr<T> With(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, size_t axisi, size_t axisj) {
auto inst = std::make_shared<T>(frmi, frmj, axisi, axisj);
inst->initialize();
return inst;
}
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axisi, int axisj) {
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, size_t axisi, size_t axisj) {
std::shared_ptr<Constraint> inst;
std::string str = typeid(T(frmi, frmj, axisi, axisj)).name();
if (str.find("DirectionCosineConstraintIJ") != std::string::npos) {

View File

@@ -31,17 +31,17 @@ void MbD::ConstVelConstraintIqcJc::calcPostDynCorrectorIteration()
auto aA10IeqcJec = std::dynamic_pointer_cast<DirectionCosineIeqcJec>(aA10IeJe);
auto& pA10IeJepEI = aA10IeqcJec->pAijIeJepEI;
auto& ppA10IeJepEIpEI = aA10IeqcJec->ppAijIeJepEIpEI;
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
pGpEI->atiput(i, pA01IeJepEI->at(i) + pA10IeJepEI->at(i));
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto& ppGpEIpEIi = ppGpEIpEI->at(i);
auto& ppA01IeJepEIpEIi = ppA01IeJepEIpEI->at(i);
auto& ppA10IeJepEIpEIi = ppA10IeJepEIpEI->at(i);
ppGpEIpEIi->atiput(i, ppA01IeJepEIpEIi->at(i) + ppA10IeJepEIpEIi->at(i));
for (int j = i + 1; j < 4; j++)
for (size_t j = i + 1; j < 4; j++)
{
auto ppGpEIpEIij = ppA01IeJepEIpEIi->at(j) + ppA10IeJepEIpEIi->at(j);
ppGpEIpEIi->atiput(j, ppGpEIpEIij);

View File

@@ -30,6 +30,6 @@ namespace MbD {
FRowDsptr pGpEI;
FMatDsptr ppGpEIpEI;
int iqEI = -1;
size_t iqEI = SIZE_MAX;
};
}

View File

@@ -31,28 +31,28 @@ void MbD::ConstVelConstraintIqcJqc::calcPostDynCorrectorIteration()
auto& pA10IeJepEJ = aA10IeqcJeqc->pAijIeJepEJ;
auto& ppA10IeJepEIpEJ = aA10IeqcJeqc->ppAijIeJepEIpEJ;
auto& ppA10IeJepEJpEJ = aA10IeqcJeqc->ppAijIeJepEJpEJ;
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
pGpEJ->atiput(i, pA01IeJepEJ->at(i) + pA10IeJepEJ->at(i));
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto& ppGpEIpEJi = ppGpEIpEJ->at(i);
auto& ppA01IeJepEIpEJi = ppA01IeJepEIpEJ->at(i);
auto& ppA10IeJepEIpEJi = ppA10IeJepEIpEJ->at(i);
for (int j = 0; j < 4; j++)
for (size_t j = 0; j < 4; j++)
{
auto ppGpEIpEJij = ppA01IeJepEIpEJi->at(j) + ppA10IeJepEIpEJi->at(j);
ppGpEIpEJi->atiput(j, ppGpEIpEJij);
}
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto& ppGpEJpEJi = ppGpEJpEJ->at(i);
auto& ppA01IeJepEJpEJi = ppA01IeJepEJpEJ->at(i);
auto& ppA10IeJepEJpEJi = ppA10IeJepEJpEJ->at(i);
ppGpEJpEJi->atiput(i, ppA01IeJepEJpEJi->at(i) + ppA10IeJepEJpEJi->at(i));
for (int j = i + 1; j < 4; j++)
for (size_t j = i + 1; j < 4; j++)
{
auto ppGpEJpEJij = ppA01IeJepEJpEJi->at(j) + ppA10IeJepEJpEJi->at(j);
ppGpEJpEJi->atiput(j, ppGpEJpEJij);

View File

@@ -31,7 +31,7 @@ namespace MbD {
FRowDsptr pGpEJ;
FMatDsptr ppGpEIpEJ;
FMatDsptr ppGpEJpEJ;
int iqEJ = -1;
size_t iqEJ = SIZE_MAX;
};
}

View File

@@ -40,7 +40,7 @@ void Constraint::postInput()
void Constraint::prePosIC()
{
lam = 0.0;
iG = -1;
iG = SIZE_MAX;
Item::prePosIC();
}
@@ -108,7 +108,7 @@ void Constraint::fillPosICError(FColDsptr col)
col->atiplusNumber(iG, aG);
}
void Constraint::removeRedundantConstraints(std::shared_ptr<std::vector<int>>)
void Constraint::removeRedundantConstraints(std::shared_ptr<std::vector<size_t>>)
{
//My owner should handle this.
assert(false);

View File

@@ -46,14 +46,14 @@ namespace MbD {
void prePosIC() override;
void prePosKine() override;
void reactivateRedundantConstraints() override;
void removeRedundantConstraints(std::shared_ptr<std::vector<int>> redundantEqnNos) override;
void removeRedundantConstraints(std::shared_ptr<std::vector<size_t>> redundantEqnNos) override;
void setConstant(double value);
void setqsudotlam(FColDsptr col) override;
void setqsuddotlam(FColDsptr col) override;
void setqsulam(FColDsptr col) override;
virtual ConstraintType type();
int iG = -1;
size_t iG = SIZE_MAX;
double aG = 0.0; //Constraint function
double aConstant = 0.0;
double lam = 0.0; //Lambda is Lagrange Multiplier

View File

@@ -28,18 +28,18 @@ namespace MbD {
DiagonalMatrix(size_t count) : Array<T>(count) {}
DiagonalMatrix(size_t count, const T& value) : Array<T>(count, value) {}
DiagonalMatrix(std::initializer_list<T> list) : Array<T>{ list } {}
void atiputDiagonalMatrix(int i, std::shared_ptr<DiagonalMatrix<T>> diagMat);
void atiputDiagonalMatrix(size_t i, std::shared_ptr<DiagonalMatrix<T>> diagMat);
DiagMatsptr<T> times(T factor);
FColsptr<T> timesFullColumn(FColsptr<T> fullCol);
FMatsptr<T> timesFullMatrix(FMatsptr<T> fullMat);
int nrow() {
return (int)this->size();
size_t nrow() {
return this->size();
}
int ncol() {
return (int)this->size();
size_t ncol() {
return this->size();
}
double sumOfSquares() override;
int numberOfElements() override;
size_t numberOfElements() override;
void zeroSelf() override;
double maxMagnitude() override;
@@ -49,18 +49,18 @@ namespace MbD {
template<>
inline DiagMatDsptr DiagonalMatrix<double>::times(double factor)
{
auto nrow = (int)this->size();
auto nrow = this->size();
auto answer = std::make_shared<DiagonalMatrix<double>>(nrow);
for (int i = 0; i < nrow; i++)
for (size_t i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * factor;
}
return answer;
}
template<typename T>
inline void DiagonalMatrix<T>::atiputDiagonalMatrix(int i, std::shared_ptr<DiagonalMatrix<T>> diagMat)
inline void DiagonalMatrix<T>::atiputDiagonalMatrix(size_t i, std::shared_ptr<DiagonalMatrix<T>> diagMat)
{
for (int ii = 0; ii < (int)diagMat->size(); ii++)
for (size_t ii = 0; ii < diagMat->size(); ii++)
{
this->at(i + ii) = diagMat->at(ii);
}
@@ -75,9 +75,9 @@ namespace MbD {
{
//"a*b = a(i,j)b(j) sum j."
auto nrow = (int)this->size();
auto nrow = this->size();
auto answer = std::make_shared<FullColumn<T>>(nrow);
for (int i = 0; i < nrow; i++)
for (size_t i = 0; i < nrow; i++)
{
answer->at(i) = this->at(i) * fullCol->at(i);
}
@@ -86,9 +86,9 @@ namespace MbD {
template<typename T>
inline FMatsptr<T> DiagonalMatrix<T>::timesFullMatrix(FMatsptr<T> fullMat)
{
auto nrow = (int)this->size();
auto nrow = this->size();
auto answer = std::make_shared<FullMatrix<T>>(nrow);
for (int i = 0; i < nrow; i++)
for (size_t i = 0; i < nrow; i++)
{
answer->at(i) = fullMat->at(i)->times(this->at(i));
}
@@ -98,7 +98,7 @@ namespace MbD {
inline double DiagonalMatrix<double>::sumOfSquares()
{
double sum = 0.0;
for (int i = 0; i < (int)this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
double element = this->at(i);
sum += element * element;
@@ -106,15 +106,15 @@ namespace MbD {
return sum;
}
template<typename T>
inline int DiagonalMatrix<T>::numberOfElements()
inline size_t DiagonalMatrix<T>::numberOfElements()
{
auto n = (int)this->size();
auto n = this->size();
return n * n;
}
template<>
inline void DiagonalMatrix<double>::zeroSelf()
{
for (int i = 0; i < (int)this->size(); i++) {
for (size_t i = 0; i < this->size(); i++) {
this->at(i) = 0.0;
}
}
@@ -122,7 +122,7 @@ namespace MbD {
inline double DiagonalMatrix<double>::maxMagnitude()
{
double max = 0.0;
for (int i = 0; i < (int)this->size(); i++)
for (size_t i = 0; i < this->size(); i++)
{
double element = this->at(i);
if (element < 0.0) element = -element;
@@ -141,7 +141,7 @@ namespace MbD {
{
s << "DiagMat[";
s << this->at(0);
for (int i = 1; i < (int)this->size(); i++)
for (size_t i = 1; i < this->size(); i++)
{
s << ", " << this->at(i);
}

View File

@@ -18,7 +18,7 @@ using namespace MbD;
FRowDsptr DifferenceOperator::OneOverFactorials = []() {
auto oneOverFactorials = std::make_shared<FullRow<double>>(10);
for (int i = 0; i < (int)oneOverFactorials->size(); i++)
for (size_t i = 0; i < oneOverFactorials->size(); i++)
{
oneOverFactorials->at(i) = 1.0 / std::tgamma(i + 1);
}
@@ -50,12 +50,12 @@ void MbD::DifferenceOperator::initializeLocally()
assert(false);
}
void DifferenceOperator::setiStep(int i)
void DifferenceOperator::setiStep(size_t i)
{
iStep = i;
}
void DifferenceOperator::setorder(int o)
void DifferenceOperator::setorder(size_t o)
{
order = o;
}
@@ -67,21 +67,21 @@ void DifferenceOperator::instantiateTaylorMatrix()
}
}
void DifferenceOperator::formTaylorRowwithTimeNodederivative(int i, int ii, int k)
void DifferenceOperator::formTaylorRowwithTimeNodederivative(size_t i, size_t ii, size_t k)
{
//| rowi hi hipower aij |
auto& rowi = taylorMatrix->at(i);
for (int j = 0; j < k; j++)
for (size_t j = 0; j < k; j++)
{
rowi->at(j) = 0.0;
}
rowi->at(k) = 1.0;
auto hi = timeNodes->at(ii) - time;
auto hipower = 1.0;
for (int j = k + 1; j < order + 1; j++)
for (size_t j = k + 1; j < order + 1; j++)
{
hipower = hipower * hi;
auto aij = hipower * OneOverFactorials->at((int)j - k);
auto aij = hipower * OneOverFactorials->at(j - k);
rowi->atiput(j, aij);
}
}

View File

@@ -21,14 +21,14 @@ namespace MbD {
void calcOperatorMatrix();
virtual void initialize();
virtual void initializeLocally();
virtual void setiStep(int i);
virtual void setorder(int o);
virtual void setiStep(size_t i);
virtual void setorder(size_t o);
virtual void formTaylorMatrix() = 0;
virtual void instantiateTaylorMatrix();
virtual void formTaylorRowwithTimeNodederivative(int i, int ii, int k);
virtual void formTaylorRowwithTimeNodederivative(size_t i, size_t ii, size_t k);
void settime(double t);
int iStep = 0, order = 0;
size_t iStep = 0, order = 0;
FMatDsptr taylorMatrix, operatorMatrix;
double time = 0.0;
std::shared_ptr<std::vector<double>> timeNodes; //"Row of past times in order of increasing past."

View File

@@ -11,7 +11,7 @@
using namespace MbD;
MbD::DifferentiatedGeneralSpline::DifferentiatedGeneralSpline(Symsptr arg, Symsptr spline, int derivOrder) : AnyGeneralSpline(arg), generalSpline(spline), derivativeOrder(derivOrder)
MbD::DifferentiatedGeneralSpline::DifferentiatedGeneralSpline(Symsptr arg, Symsptr spline, size_t derivOrder) : AnyGeneralSpline(arg), generalSpline(spline), derivativeOrder(derivOrder)
{
}

View File

@@ -16,7 +16,7 @@ namespace MbD {
//derivativeOrder
public:
DifferentiatedGeneralSpline() = default;
DifferentiatedGeneralSpline(Symsptr arg, Symsptr spline, int derivOrder);
DifferentiatedGeneralSpline(Symsptr arg, Symsptr spline, size_t derivOrder);
double getValue() override;
Symsptr differentiateWRTx() override;
Symsptr clonesptr() override;
@@ -24,6 +24,6 @@ namespace MbD {
std::ostream& printOn(std::ostream& s) const override;
Symsptr generalSpline;
int derivativeOrder;
size_t derivativeOrder;
};
}

View File

@@ -13,7 +13,7 @@
using namespace MbD;
DirectionCosineConstraintIJ::DirectionCosineConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineConstraintIJ::DirectionCosineConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
ConstraintIJ(frmi, frmj), axisI(axisi), axisJ(axisj)
{
}

View File

@@ -17,7 +17,7 @@ namespace MbD {
{
//axisI axisJ aAijIeJe
public:
DirectionCosineConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineConstraintIJ(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void calcPostDynCorrectorIteration() override;
virtual void initaAijIeJe();
@@ -32,7 +32,7 @@ namespace MbD {
void simUpdateAll() override;
ConstraintType type() override;
int axisI, axisJ;
size_t axisI, axisJ;
std::shared_ptr<DirectionCosineIecJec> aAijIeJe;
};
}

View File

@@ -13,7 +13,7 @@
using namespace MbD;
DirectionCosineConstraintIqcJc::DirectionCosineConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineConstraintIqcJc::DirectionCosineConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
DirectionCosineConstraintIJ(frmi, frmj, axisi, axisj)
{
}

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpEI ppGpEIpEI iqEI
public:
DirectionCosineConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineConstraintIqcJc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void addToJointTorqueI(FColDsptr col) override;
void calcPostDynCorrectorIteration() override;
@@ -29,7 +29,7 @@ namespace MbD {
FRowDsptr pGpEI;
FMatDsptr ppGpEIpEI;
int iqEI = -1;
size_t iqEI = SIZE_MAX;
};
}

View File

@@ -13,7 +13,7 @@
using namespace MbD;
DirectionCosineConstraintIqcJqc::DirectionCosineConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineConstraintIqcJqc::DirectionCosineConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
DirectionCosineConstraintIqcJc(frmi, frmj, axisi, axisj)
{
}

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpEJ ppGpEIpEJ ppGpEJpEJ iqEJ
public:
DirectionCosineConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineConstraintIqcJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void calcPostDynCorrectorIteration() override;
void fillAccICIterError(FColDsptr col) override;
@@ -29,7 +29,7 @@ namespace MbD {
FRowDsptr pGpEJ;
FMatDsptr ppGpEIpEJ;
FMatDsptr ppGpEJpEJ;
int iqEJ = -1;
size_t iqEJ = SIZE_MAX;
};
}

View File

@@ -12,7 +12,7 @@
using namespace MbD;
DirectionCosineConstraintIqctJqc::DirectionCosineConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineConstraintIqctJqc::DirectionCosineConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
DirectionCosineConstraintIqcJqc(frmi, frmj, axisi, axisj)
{
}

View File

@@ -15,7 +15,7 @@ namespace MbD {
{
//pGpt ppGpEIpt ppGpEJpt ppGptpt
public:
DirectionCosineConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineConstraintIqctJqc(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void fillAccICIterError(FColDsptr col) override;
void fillVelICError(FColDsptr col) override;
@@ -24,9 +24,9 @@ namespace MbD {
void preVelIC() override;
ConstraintType type() override;
double pGpt;
double pGpt = std::numeric_limits<double>::min();
FRowDsptr ppGpEIpt;
FRowDsptr ppGpEJpt;
double ppGptpt;
double ppGptpt = std::numeric_limits<double>::min();
};
}

View File

@@ -16,7 +16,7 @@ using namespace MbD;
DirectionCosineIecJec::DirectionCosineIecJec()
= default;
DirectionCosineIecJec::DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineIecJec::DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
KinematicIeJe(frmi, frmj), axisI(axisi), axisJ(axisj)
{

View File

@@ -20,12 +20,12 @@ namespace MbD {
//aAijIeJe axisI axisJ aAjOIe aAjOJe
public:
DirectionCosineIecJec();
DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineIecJec(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void calcPostDynCorrectorIteration() override;
double value() override;
int axisI{}, axisJ{}; //0, 1, 2 = x, y, z
size_t axisI{}, axisJ{}; //0, 1, 2 = x, y, z
double aAijIeJe{};
FColDsptr aAjOIe, aAjOJe;
};

View File

@@ -15,7 +15,7 @@ DirectionCosineIeqcJec::DirectionCosineIeqcJec()
{
}
DirectionCosineIeqcJec::DirectionCosineIeqcJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj) :
DirectionCosineIeqcJec::DirectionCosineIeqcJec(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj) :
DirectionCosineIecJec(frmi, frmj, axisi, axisj)
{
}
@@ -46,15 +46,15 @@ void DirectionCosineIeqcJec::calcPostDynCorrectorIteration()
{
DirectionCosineIecJec::calcPostDynCorrectorIteration();
pAjOIepEIT = std::static_pointer_cast<EndFrameqc>(frmI)->pAjOepET(axisI);
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
pAijIeJepEI->at(i) = pAjOIepEIT->at(i)->dot(aAjOJe);
}
for (int i = 0; i < 4; i++)
for (size_t i = 0; i < 4; i++)
{
auto& ppAijIeJepEIipEI = ppAijIeJepEIpEI->at(i);
auto& ppAjOIepEIipEI = ppAjOIepEIpEI->at(i);
for (int j = 0; j < 4; j++)
for (size_t j = 0; j < 4; j++)
{
ppAijIeJepEIipEI->at(j) = ppAjOIepEIipEI->at(j)->dot(aAjOJe);
}

View File

@@ -16,7 +16,7 @@ namespace MbD {
//pAijIeJepEI ppAijIeJepEIpEI pAjOIepEIT ppAjOIepEIpEI
public:
DirectionCosineIeqcJec();
DirectionCosineIeqcJec(EndFrmsptr frmi, EndFrmsptr frmj, int axisi, int axisj);
DirectionCosineIeqcJec(EndFrmsptr frmi, EndFrmsptr frmj, size_t axisi, size_t axisj);
void calcPostDynCorrectorIteration() override;
void initialize() override;

Some files were not shown because too many files have changed in this diff Show More