changes to class detection
This commit is contained in:
@@ -30,9 +30,12 @@
|
||||
|
||||
using namespace MbD;
|
||||
|
||||
void MbD::ASMTAssembly::runFile(const char* chars)
|
||||
void MbD::ASMTAssembly::runFile(const char* fileName)
|
||||
{
|
||||
std::ifstream stream(chars);
|
||||
std::ifstream stream(fileName);
|
||||
if(stream.fail()) {
|
||||
throw std::invalid_argument("File not found.");
|
||||
}
|
||||
std::string line;
|
||||
std::vector<std::string> lines;
|
||||
while (std::getline(stream, line)) {
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace MbD {
|
||||
{
|
||||
//
|
||||
public:
|
||||
static void runFile(const char* chars);
|
||||
static void runFile(const char* fileName);
|
||||
ASMTAssembly* root() override;
|
||||
void parseASMT(std::vector<std::string>& lines) override;
|
||||
void readNotes(std::vector<std::string>& lines);
|
||||
|
||||
@@ -268,6 +268,7 @@ add_executable(new_target
|
||||
VelSolver.cpp
|
||||
ZRotation.cpp
|
||||
ZTranslation.cpp
|
||||
ASMTAssembly.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -71,15 +71,15 @@ namespace MbD {
|
||||
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axis) {
|
||||
std::shared_ptr<Constraint> inst;
|
||||
std::string str = typeid(T(frmi, frmj, axis)).name();
|
||||
if (str == "class MbD::AtPointConstraintIJ") {
|
||||
if (str.find("AtPointConstraintIJ") >= 0) {
|
||||
if (std::dynamic_pointer_cast<EndFrameqct>(frmi)) {
|
||||
inst = std::make_shared<AtPointConstraintIqctJqc>(frmi, frmj, axis);
|
||||
}
|
||||
else {
|
||||
inst = std::make_shared<AtPointConstraintIqcJqc>(frmi, frmj, axis);
|
||||
}
|
||||
}
|
||||
else if(str == "class MbD::TranslationConstraintIJ") {
|
||||
} // "class MbD::Tran
|
||||
else if(str.find("TranslationConstraintIJ") >= 0) {
|
||||
if (std::dynamic_pointer_cast<EndFrameqct>(frmi)) {
|
||||
inst = std::make_shared<TranslationConstraintIqctJqc>(frmi, frmj, axis);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace MbD {
|
||||
static std::shared_ptr<Constraint> ConstraintWith(std::shared_ptr<EndFramec> frmi, std::shared_ptr<EndFramec> frmj, int axisi, int axisj) {
|
||||
std::shared_ptr<Constraint> inst;
|
||||
std::string str = typeid(T(frmi, frmj, axisi, axisj)).name();
|
||||
if (str == "class MbD::DirectionCosineConstraintIJ") {
|
||||
if (str.find("DirectionCosineConstraintIJ") >= 0) {
|
||||
if (std::dynamic_pointer_cast<EndFrameqct>(frmi)) {
|
||||
inst = std::make_shared<DirectionCosineConstraintIqctJqc>(frmi, frmj, axisi, axisj);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,12 @@ void GESpMatFullPv::backSubstituteIntoDU()
|
||||
double sum, duij, duii;
|
||||
//answerX = rightHandSideB->copyEmpty();
|
||||
assert(m == n);
|
||||
|
||||
// TODO: temp
|
||||
// assert(n > 0);
|
||||
// auto localLen = colOrder->numberOfElements();
|
||||
// assert(n < localLen);
|
||||
|
||||
answerX = std::make_shared<FullColumn<double>>(m);
|
||||
auto jn = colOrder->at(n);
|
||||
answerX->at(jn) = rightHandSideB->at(m) / matrixA->at(m)->at(jn);
|
||||
|
||||
@@ -26,17 +26,17 @@ void runSpMat();
|
||||
|
||||
int main()
|
||||
{
|
||||
ASMTAssembly::runFile("piston.asmt");
|
||||
ASMTAssembly::runFile("00backhoe.asmt");
|
||||
ASMTAssembly::runFile("circular.asmt");
|
||||
ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine.
|
||||
ASMTAssembly::runFile("engine1.asmt");
|
||||
ASMTAssembly::runFile("fourbar.asmt");
|
||||
ASMTAssembly::runFile("fourbot.asmt");
|
||||
ASMTAssembly::runFile("wobpump.asmt");
|
||||
// ASMTAssembly::runFile("piston.asmt");
|
||||
// ASMTAssembly::runFile("00backhoe.asmt");
|
||||
// ASMTAssembly::runFile("circular.asmt");
|
||||
// ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine.
|
||||
// ASMTAssembly::runFile("engine1.asmt");
|
||||
// ASMTAssembly::runFile("fourbar.asmt");
|
||||
// ASMTAssembly::runFile("fourbot.asmt");
|
||||
// ASMTAssembly::runFile("wobpump.asmt");
|
||||
|
||||
auto cadSystem = std::make_shared<CADSystem>();
|
||||
cadSystem->runOndselPiston();
|
||||
// cadSystem->runOndselPiston();
|
||||
cadSystem->runPiston();
|
||||
runSpMat();
|
||||
}
|
||||
|
||||
@@ -103,13 +103,13 @@ void PosICNewtonRaphson::handleSingularMatrix()
|
||||
}
|
||||
else {
|
||||
std::string str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvMarkoFast") {
|
||||
if (str.find("GESpMatParPvMarkoFast") >= 0) {
|
||||
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
|
||||
this->solveEquations();
|
||||
}
|
||||
else {
|
||||
str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvPrecise") {
|
||||
if (str.find("GESpMatParPvPrecise") >= 0) {
|
||||
this->lookForRedundantConstraints();
|
||||
matrixSolver = this->matrixSolverClassNew();
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ void SystemNewtonRaphson::basicSolveEquations()
|
||||
void SystemNewtonRaphson::handleSingularMatrix()
|
||||
{
|
||||
std::string str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvMarkoFast") {
|
||||
if (str.find("GESpMatParPvMarkoFast") >= 0) {
|
||||
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
|
||||
this->solveEquations();
|
||||
}
|
||||
else {
|
||||
str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvPrecise") {
|
||||
if (str.find("GESpMatParPvPrecise") >= 0) {
|
||||
str = "MbD: Singular Matrix Error. ";
|
||||
system->logString(str);
|
||||
matrixSolver = this->matrixSolverClassNew();
|
||||
|
||||
@@ -25,13 +25,13 @@ void VelSolver::basicSolveEquations()
|
||||
void VelSolver::handleSingularMatrix()
|
||||
{
|
||||
std::string str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvMarkoFast") {
|
||||
if (str.find("GESpMatParPvMarkoFast") >= 0) {
|
||||
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
|
||||
this->solveEquations();
|
||||
}
|
||||
else {
|
||||
str = typeid(*matrixSolver).name();
|
||||
if (str == "class GESpMatParPvPrecise") {
|
||||
if (str.find("GESpMatParPvPrecise") >= 0) {
|
||||
this->logSingularMatrixMessage();
|
||||
matrixSolver = this->matrixSolverClassNew();
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
// Define _USE_MATH_DEFINES before including <math.h> to expose these macro
|
||||
// definitions for common math constants. These are placed under an #ifdef
|
||||
// since these commonly-defined names are not part of the C or C++ standards
|
||||
#define M_E 2.71828182845904523536 // e
|
||||
#define M_LOG2E 1.44269504088896340736 // log2(e)
|
||||
#define M_LOG10E 0.434294481903251827651 // log10(e)
|
||||
#define M_LN2 0.693147180559945309417 // ln(2)
|
||||
#define M_LN10 2.30258509299404568402 // ln(10)
|
||||
// #define M_E 2.71828182845904523536 // e
|
||||
// #define M_LOG2E 1.44269504088896340736 // log2(e)
|
||||
// #define M_LOG10E 0.434294481903251827651 // log10(e)
|
||||
// #define M_LN2 0.693147180559945309417 // ln(2)
|
||||
// #define M_LN10 2.30258509299404568402 // ln(10)
|
||||
#define M_PI 3.14159265358979323846 // pi
|
||||
#define M_PI_2 1.57079632679489661923 // pi/2
|
||||
#define M_PI_4 0.785398163397448309616 // pi/4
|
||||
#define M_1_PI 0.318309886183790671538 // 1/pi
|
||||
#define M_2_PI 0.636619772367581343076 // 2/pi
|
||||
// #define M_PI_2 1.57079632679489661923 // pi/2
|
||||
// #define M_PI_4 0.785398163397448309616 // pi/4
|
||||
// #define M_1_PI 0.318309886183790671538 // 1/pi
|
||||
// #define M_2_PI 0.636619772367581343076 // 2/pi
|
||||
#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
|
||||
#define M_SQRT2 1.41421356237309504880 // sqrt(2)
|
||||
#define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
|
||||
// #define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
|
||||
#endif
|
||||
Reference in New Issue
Block a user