MBDyn classes for reading

This commit is contained in:
Aik-Siong Koh
2023-10-05 07:48:48 -06:00
parent 3d43f5dd5b
commit e108538d3e
15 changed files with 223 additions and 338 deletions

View File

@@ -1,4 +1,5 @@
#include "MBDynElements.h"
#include "MBDynBody.h"
using namespace MbD;
@@ -8,5 +9,29 @@ void MbD::MBDynElements::initialize()
void MbD::MBDynElements::parseMBDyn(std::vector<std::string>& lines)
{
assert(false);
elements = std::make_shared<std::vector<std::shared_ptr<MBDynElement>>>();
std::vector<std::string> bodyToken{ "body:" };
std::vector<std::string> jointToken{ "joint:" };
std::vector<std::string>::iterator it;
while (true) {
it = findLineWith(lines, bodyToken);
if (it != lines.end()) {
auto body = std::make_shared<MBDynBody>();
body->owner = this;
body->parseMBDyn(*it);
elements->push_back(body);
lines.erase(it);
continue;
}
it = findLineWith(lines, jointToken);
if (it != lines.end()) {
auto body = std::make_shared<MBDynBody>();
body->owner = this;
body->parseMBDyn(*it);
elements->push_back(body);
lines.erase(it);
continue;
}
break;
}
}