Skip to content

Commit

Permalink
integrate simple products
Browse files Browse the repository at this point in the history
  • Loading branch information
aiksiongkoh committed Nov 22, 2023
1 parent 59ab949 commit 06d0019
Show file tree
Hide file tree
Showing 91 changed files with 8,392 additions and 3,081 deletions.
2 changes: 1 addition & 1 deletion OndselSolver/ASMTAnimationParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void MbD::ASMTAnimationParameters::parseASMT(std::vector<std::string>& lines)
{
//int nframe, icurrent, istart, iend, framesPerSecond;
//bool isForward;
size_t pos = lines[0].find_first_not_of("\t");
int pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "nframe"));
lines.erase(lines.begin());
Expand Down
28 changes: 14 additions & 14 deletions OndselSolver/ASMTAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ void MbD::ASMTAssembly::runFile(const char* fileName)
if (lines[0] == "Assembly") {
lines.erase(lines.begin());
auto assembly = CREATE<ASMTAssembly>::With();
assembly->setFilename(fileName);
assembly->parseASMT(lines);
assembly->runKINEMATIC();
}
Expand Down Expand Up @@ -850,16 +851,6 @@ void MbD::ASMTAssembly::outputFor(AnalysisType type)
assert(false);
}

void MbD::ASMTAssembly::logString(std::string& str)
{
assert(false);
}

void MbD::ASMTAssembly::logString(double value)
{
assert(false);
}

void MbD::ASMTAssembly::preMbDrun(std::shared_ptr<System> mbdSys)
{
calcCharacteristicDimensions();
Expand Down Expand Up @@ -890,7 +881,7 @@ double MbD::ASMTAssembly::calcCharacteristicTime()

double MbD::ASMTAssembly::calcCharacteristicMass()
{
auto n = parts->size();
auto n = (int)parts->size();
double sumOfSquares = 0.0;
for (int i = 0; i < n; i++)
{
Expand All @@ -913,7 +904,7 @@ double MbD::ASMTAssembly::calcCharacteristicLength()
auto& mkrJ = markerMap->at(connector->markerJ);
lengths->push_back(mkrJ->rpmp()->length());
}
auto n = lengths->size();
auto n = (int)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));
if (unitLength <= 0) unitLength = 1.0;
Expand Down Expand Up @@ -1276,13 +1267,13 @@ void MbD::ASMTAssembly::storeOnTimeSeries(std::ofstream& os)
if (times->empty()) return;
os << "TimeSeries" << std::endl;
os << "Number\tInput\t";
for (size_t i = 1; i < times->size(); i++)
for (int i = 1; i < times->size(); i++)
{
os << i << '\t';
}
os << std::endl;
os << "Time\tInput\t";
for (size_t i = 1; i < times->size(); i++)
for (int i = 1; i < times->size(); i++)
{
os << times->at(i) << '\t';
}
Expand All @@ -1294,4 +1285,13 @@ void MbD::ASMTAssembly::storeOnTimeSeries(std::ofstream& os)
for (auto& motion : *motions) motion->storeOnTimeSeries(os);
}

void MbD::ASMTAssembly::setFilename(std::string str)
{
std::stringstream ss;
ss << "FileName = " << str << std::endl;
auto str2 = ss.str();
logString(str2);
filename = str;
}


4 changes: 2 additions & 2 deletions OndselSolver/ASMTAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ namespace MbD {
void readMotionSeries(std::vector<std::string>& lines);

void outputFor(AnalysisType type);
void logString(std::string& str);
void logString(double value);
void preMbDrun(std::shared_ptr<System> mbdSys);
void postMbDrun();
void calcCharacteristicDimensions();
Expand Down Expand Up @@ -122,7 +120,9 @@ namespace MbD {
void storeOnLevelMotions(std::ofstream& os, int level);
void storeOnLevelGeneralConstraintSets(std::ofstream& os, int level);
void storeOnTimeSeries(std::ofstream& os) override;
void setFilename(std::string filename);

std::string filename = "";
std::string notes = "(Text string: '' runs: (Core.RunArray runs: #() values: #()))";
std::shared_ptr<std::vector<std::shared_ptr<ASMTPart>>> parts = std::make_shared<std::vector<std::shared_ptr<ASMTPart>>>();
std::shared_ptr<std::vector<std::shared_ptr<ASMTKinematicIJ>>> kinematicIJs = std::make_shared<std::vector<std::shared_ptr<ASMTKinematicIJ>>>();
Expand Down
12 changes: 11 additions & 1 deletion OndselSolver/ASMTItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void MbD::ASMTItem::storeOnLevelBool(std::ofstream& os, int level, bool value)
void MbD::ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<double> array)
{
storeOnLevelTabs(os, level);
for (size_t i = 0; i < array.size(); i++)
for (int i = 0; i < array.size(); i++)
{
os << array[i] << '\t';
}
Expand All @@ -244,3 +244,13 @@ void MbD::ASMTItem::storeOnTimeSeries(std::ofstream& os)
{
assert(false);
}

void MbD::ASMTItem::logString(std::string& str)
{
std::cout << str << std::endl;
}

void MbD::ASMTItem::logString(const char* chars)
{
std::cout << chars << std::endl;
}
4 changes: 3 additions & 1 deletion OndselSolver/ASMTItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace MbD {
void storeOnLevelArray(std::ofstream& os, int level, std::vector<double> array);
void storeOnLevelName(std::ofstream& os, int level);
virtual void storeOnTimeSeries(std::ofstream& os);
void logString(std::string& str);
void logString(const char* chars);

std::string name;
ASMTItem* owner = nullptr;
Expand All @@ -66,7 +68,7 @@ namespace MbD {
//inline void ASMTItem::storeOnLevelArray(std::ofstream& os, int level, std::vector<T> array)
//{
// storeOnLevelTabs(os, level);
// for (size_t i = 0; i < array.size(); i++)
// for (int i = 0; i < array.size(); i++)
// {
// os << array[i] << '\t';
// }
Expand Down
12 changes: 6 additions & 6 deletions OndselSolver/ASMTItemIJ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,37 +108,37 @@ void MbD::ASMTItemIJ::storeOnLevel(std::ofstream& os, int level)
void MbD::ASMTItemIJ::storeOnTimeSeries(std::ofstream& os)
{
os << "FXonI\t";
for (size_t i = 0; i < fxs->size(); i++)
for (int i = 0; i < fxs->size(); i++)
{
os << fxs->at(i) << '\t';
}
os << std::endl;
os << "FYonI\t";
for (size_t i = 0; i < fys->size(); i++)
for (int i = 0; i < fys->size(); i++)
{
os << fys->at(i) << '\t';
}
os << std::endl;
os << "FZonI\t";
for (size_t i = 0; i < fzs->size(); i++)
for (int i = 0; i < fzs->size(); i++)
{
os << fzs->at(i) << '\t';
}
os << std::endl;
os << "TXonI\t";
for (size_t i = 0; i < txs->size(); i++)
for (int i = 0; i < txs->size(); i++)
{
os << txs->at(i) << '\t';
}
os << std::endl;
os << "TYonI\t";
for (size_t i = 0; i < tys->size(); i++)
for (int i = 0; i < tys->size(); i++)
{
os << tys->at(i) << '\t';
}
os << std::endl;
os << "TZonI\t";
for (size_t i = 0; i < tzs->size(); i++)
for (int i = 0; i < tzs->size(); i++)
{
os << tzs->at(i) << '\t';
}
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/ASMTPrincipalMassMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MbD::ASMTPrincipalMassMarker::ASMTPrincipalMassMarker()

void MbD::ASMTPrincipalMassMarker::parseASMT(std::vector<std::string>& lines)
{
size_t pos = lines[0].find_first_not_of("\t");
int pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "Name"));
lines.erase(lines.begin());
Expand Down
2 changes: 1 addition & 1 deletion OndselSolver/ASMTSimulationParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void MbD::ASMTSimulationParameters::parseASMT(std::vector<std::string>& lines)
{
//tstart, tend, hmin, hmax, hout, errorTol;

size_t pos = lines[0].find_first_not_of("\t");
int pos = lines[0].find_first_not_of("\t");
auto leadingTabs = lines[0].substr(0, pos);
assert(lines[0] == (leadingTabs + "tstart"));
lines.erase(lines.begin());
Expand Down
40 changes: 20 additions & 20 deletions OndselSolver/ASMTSpatialContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,116 +601,116 @@ void MbD::ASMTSpatialContainer::storeOnLevelRefSurfaces(std::ofstream& os, int l
void MbD::ASMTSpatialContainer::storeOnTimeSeries(std::ofstream& os)
{
os << "X\t";
for (size_t i = 0; i < xs->size(); i++)
for (int i = 0; i < xs->size(); i++)
{
os << xs->at(i) << '\t';
}
os << std::endl;
os << "Y\t";
for (size_t i = 0; i < ys->size(); i++)
for (int i = 0; i < ys->size(); i++)
{
os << ys->at(i) << '\t';
}
os << std::endl;
os << "Z\t";
for (size_t i = 0; i < zs->size(); i++)
for (int i = 0; i < zs->size(); i++)
{
os << zs->at(i) << '\t';
}
os << std::endl;
os << "Bryantx\t";
for (size_t i = 0; i < bryxs->size(); i++)
for (int i = 0; i < bryxs->size(); i++)
{
os << bryxs->at(i) << '\t';
}
os << std::endl;
os << "Bryanty\t";
for (size_t i = 0; i < bryys->size(); i++)
for (int i = 0; i < bryys->size(); i++)
{
os << bryys->at(i) << '\t';
}
os << std::endl;
os << "Bryantz\t";
for (size_t i = 0; i < bryzs->size(); i++)
for (int i = 0; i < bryzs->size(); i++)
{
os << bryzs->at(i) << '\t';
}
os << std::endl;
os << "VX\t";
for (size_t i = 0; i < vxs->size(); i++)
for (int i = 0; i < vxs->size(); i++)
{
os << vxs->at(i) << '\t';
}
os << std::endl;
os << "VY\t";
for (size_t i = 0; i < vys->size(); i++)
for (int i = 0; i < vys->size(); i++)
{
os << vys->at(i) << '\t';
}
os << std::endl;
os << "VZ\t";
for (size_t i = 0; i < vzs->size(); i++)
for (int i = 0; i < vzs->size(); i++)
{
os << vzs->at(i) << '\t';
}
os << std::endl;
os << "OmegaX\t";
for (size_t i = 0; i < omexs->size(); i++)
for (int i = 0; i < omexs->size(); i++)
{
os << omexs->at(i) << '\t';
}
os << std::endl;
os << "OmegaY\t";
for (size_t i = 0; i < omeys->size(); i++)
for (int i = 0; i < omeys->size(); i++)
{
os << omeys->at(i) << '\t';
}
os << std::endl;
os << "OmegaZ\t";
for (size_t i = 0; i < omezs->size(); i++)
for (int i = 0; i < omezs->size(); i++)
{
os << omezs->at(i) << '\t';
}
os << std::endl;
os << "AX\t";
for (size_t i = 0; i < axs->size(); i++)
for (int i = 0; i < axs->size(); i++)
{
os << axs->at(i) << '\t';
}
os << std::endl;
os << "AY\t";
for (size_t i = 0; i < ays->size(); i++)
for (int i = 0; i < ays->size(); i++)
{
os << ays->at(i) << '\t';
}
os << std::endl;
os << "AZ\t";
for (size_t i = 0; i < azs->size(); i++)
for (int i = 0; i < azs->size(); i++)
{
os << azs->at(i) << '\t';
}
os << std::endl;
os << "AlphaX\t";
for (size_t i = 0; i < alpxs->size(); i++)
for (int i = 0; i < alpxs->size(); i++)
{
os << alpxs->at(i) << '\t';
}
os << std::endl;
os << "AlphaY\t";
for (size_t i = 0; i < alpys->size(); i++)
for (int i = 0; i < alpys->size(); i++)
{
os << alpys->at(i) << '\t';
}
os << std::endl;
os << "AlphaZ\t";
for (size_t i = 0; i < alpzs->size(); i++)
for (int i = 0; i < alpzs->size(); i++)
{
os << alpzs->at(i) << '\t';
}
os << std::endl;
}

FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(size_t i)
FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(int i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, vxs->at(i));
Expand All @@ -719,7 +719,7 @@ FColDsptr MbD::ASMTSpatialContainer::getVelocity3D(size_t i)
return vec3;
}

FColDsptr MbD::ASMTSpatialContainer::getOmega3D(size_t i)
FColDsptr MbD::ASMTSpatialContainer::getOmega3D(int i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, omexs->at(i));
Expand Down
4 changes: 2 additions & 2 deletions OndselSolver/ASMTSpatialContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ namespace MbD {
void storeOnLevelRefCurves(std::ofstream& os, int level);
void storeOnLevelRefSurfaces(std::ofstream& os, int level);
void storeOnTimeSeries(std::ofstream& os) override;
FColDsptr getVelocity3D(size_t i);
FColDsptr getOmega3D(size_t i);
FColDsptr getVelocity3D(int i);
FColDsptr getOmega3D(int i);

FColDsptr velocity3D = std::make_shared<FullColumn<double>>(3);
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);
Expand Down
4 changes: 2 additions & 2 deletions OndselSolver/ASMTSpatialItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void MbD::ASMTSpatialItem::storeOnLevelRotationMatrix(std::ofstream& os, int lev

}

FColDsptr MbD::ASMTSpatialItem::getPosition3D(size_t i)
FColDsptr MbD::ASMTSpatialItem::getPosition3D(int i)
{
auto vec3 = std::make_shared<FullColumn<double>>(3);
vec3->atiput(0, xs->at(i));
Expand All @@ -140,7 +140,7 @@ FColDsptr MbD::ASMTSpatialItem::getPosition3D(size_t i)
return vec3;
}

FMatDsptr MbD::ASMTSpatialItem::getRotationMatrix(size_t i)
FMatDsptr MbD::ASMTSpatialItem::getRotationMatrix(int i)
{
auto bryantAngles = std::make_shared<EulerAngles<double>>();
bryantAngles->setRotOrder(1, 2, 3);
Expand Down
4 changes: 2 additions & 2 deletions OndselSolver/ASMTSpatialItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace MbD {
void storeOnLevel(std::ofstream& os, int level) override;
void storeOnLevelPosition(std::ofstream& os, int level);
void storeOnLevelRotationMatrix(std::ofstream& os, int level);
FColDsptr getPosition3D(size_t i);
FMatDsptr getRotationMatrix(size_t i);
FColDsptr getPosition3D(int i);
FMatDsptr getRotationMatrix(int i);

FColDsptr position3D = std::make_shared<FullColumn<double>>(3);
FMatDsptr rotationMatrix = std::make_shared<FullMatrixDouble>(ListListD{
Expand Down
Loading

0 comments on commit 06d0019

Please sign in to comment.