fixes str.find bug and cmake files

This commit is contained in:
John Dupuy
2023-09-28 13:30:50 -05:00
parent 1f32157513
commit 0a0a1ad547
7 changed files with 20 additions and 28 deletions

View File

@@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.10)
project(MbDCodeLib)
add_executable(MbDCode MbDCode/MbDCode.cpp)
add_subdirectory(MbDCode)
cmake_minimum_required(VERSION 3.26)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# add_library(some_target main.cpp)
add_executable(ondsel-solver MbDCode/MbDCode.cpp)
add_subdirectory(MbDCode)

View File

@@ -1,8 +1,4 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_executable(new_target
MbDCode.cpp
target_sources(ondsel-solver PUBLIC
Abs.cpp
AbsConstraint.cpp
AccICKineNewtonRaphson.cpp
@@ -270,5 +266,3 @@ add_executable(new_target
ZTranslation.cpp
ASMTAssembly.cpp
)

View File

@@ -71,7 +71,7 @@ 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.find("AtPointConstraintIJ") >= 0) {
if (str.find("AtPointConstraintIJ") != std::string::npos) {
if (std::dynamic_pointer_cast<EndFrameqct>(frmi)) {
inst = std::make_shared<AtPointConstraintIqctJqc>(frmi, frmj, axis);
}
@@ -79,7 +79,7 @@ namespace MbD {
inst = std::make_shared<AtPointConstraintIqcJqc>(frmi, frmj, axis);
}
} // "class MbD::Tran
else if(str.find("TranslationConstraintIJ") >= 0) {
else if(str.find("TranslationConstraintIJ") != std::string::npos) {
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.find("DirectionCosineConstraintIJ") >= 0) {
if (str.find("DirectionCosineConstraintIJ") != std::string::npos) {
if (std::dynamic_pointer_cast<EndFrameqct>(frmi)) {
inst = std::make_shared<DirectionCosineConstraintIqctJqc>(frmi, frmj, axisi, axisj);
}

View File

@@ -35,11 +35,11 @@ int main()
//ASMTAssembly::runFile("fourbot.asmt");
//ASMTAssembly::runFile("wobpump.asmt");
// auto cadSystem = std::make_shared<CADSystem>();
// cadSystem->runOndselDoublePendulum();
////cadSystem->runOndselPiston();
//cadSystem->runPiston();
//runSpMat();
auto cadSystem = std::make_shared<CADSystem>();
cadSystem->runOndselDoublePendulum();
cadSystem->runOndselPiston();
cadSystem->runPiston();
runSpMat();
}
void runSpMat() {

View File

@@ -103,13 +103,13 @@ void PosICNewtonRaphson::handleSingularMatrix()
}
else {
std::string str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvMarkoFast") >= 0) {
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
}
else {
str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvPrecise") >= 0) {
if (str.find("GESpMatParPvPrecise") != std::string::npos) {
this->lookForRedundantConstraints();
matrixSolver = this->matrixSolverClassNew();
}

View File

@@ -52,13 +52,13 @@ void SystemNewtonRaphson::basicSolveEquations()
void SystemNewtonRaphson::handleSingularMatrix()
{
std::string str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvMarkoFast") >= 0) {
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
}
else {
str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvPrecise") >= 0) {
if (str.find("GESpMatParPvPrecise") != std::string::npos) {
str = "MbD: Singular Matrix Error. ";
system->logString(str);
matrixSolver = this->matrixSolverClassNew();

View File

@@ -25,13 +25,13 @@ void VelSolver::basicSolveEquations()
void VelSolver::handleSingularMatrix()
{
std::string str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvMarkoFast") >= 0) {
if (str.find("GESpMatParPvMarkoFast") != std::string::npos) {
matrixSolver = CREATE<GESpMatParPvPrecise>::With();
this->solveEquations();
}
else {
str = typeid(*matrixSolver).name();
if (str.find("GESpMatParPvPrecise") >= 0) {
if (str.find("GESpMatParPvPrecise") != std::string::npos) {
this->logSingularMatrixMessage();
matrixSolver = this->matrixSolverClassNew();
}