diff --git a/CMakeLists.txt b/CMakeLists.txt index ee3c9b8..0533690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,9 @@ cmake_minimum_required(VERSION 3.16) -project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -include(GNUInstallDirs) - -file(GLOB ONDSELSOLVER_SOURCES "OndselSolver/*.cpp") -file(GLOB ONDSELSOLVER_HEADERS "OndselSolver/*.h") -add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) -target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) - -configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) -install(TARGETS OndselSolver - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) -install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) +add_subdirectory(OndselSolver) +add_subdirectory(testapp) diff --git a/OndselSolver/CMakeLists.txt b/OndselSolver/CMakeLists.txt new file mode 100644 index 0000000..73738f7 --- /dev/null +++ b/OndselSolver/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.16) + +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +include(GNUInstallDirs) + +file(GLOB ONDSELSOLVER_SOURCES "*.cpp") +file(GLOB ONDSELSOLVER_HEADERS "*.h") +add_library(OndselSolver STATIC ${ONDSELSOLVER_SOURCES} ${ONDSELSOLVER_HEADERS}) +target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}) + +#target_include_directories(OndselSolver PUBLIC ${CMAKE_SOURCE_DIR}/OndselSolver) + +#configure_file(OndselSolver.pc.in ${CMAKE_BINARY_DIR}/OndselSolver.pc @ONLY) +#install(TARGETS OndselSolver +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OndselSolver) +#install(FILES ${CMAKE_BINARY_DIR}/OndselSolver.pc +# DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) diff --git a/OndselSolver/EulerAngles.h b/OndselSolver/EulerAngles.h index ef3a678..1a8fa81 100644 --- a/OndselSolver/EulerAngles.h +++ b/OndselSolver/EulerAngles.h @@ -33,7 +33,9 @@ namespace MbD { std::shared_ptr> rotOrder; FColFMatDsptr cA; FMatDsptr aA; - }; +// // NOTE: do NOT instantiate EulerAngles as a whole as differentiateWRT breaks +// template <> +// void EulerAngles::setRotOrder(int, int, int); } diff --git a/OndselSolver/MBDynNode.cpp b/OndselSolver/MBDynNode.cpp index 675f5fa..49f114a 100644 --- a/OndselSolver/MBDynNode.cpp +++ b/OndselSolver/MBDynNode.cpp @@ -20,28 +20,29 @@ void MbD::MBDynNode::outputLine(int i, std::ostream& os) auto x = asmtPart->xs->at(i); auto y = asmtPart->ys->at(i); auto z = asmtPart->zs->at(i); - auto bryantAngles = std::make_shared>(); - bryantAngles->setRotOrder(1, 2, 3); - bryantAngles->at(0) = asmtPart->bryxs->at(i); - bryantAngles->at(1) = asmtPart->bryys->at(i); - bryantAngles->at(2) = asmtPart->bryzs->at(i); - bryantAngles->calc(); - auto aA = bryantAngles->aA; - auto vx = asmtPart->vxs->at(i); - auto vy = asmtPart->vys->at(i); - auto vz = asmtPart->vzs->at(i); - auto omex = asmtPart->omexs->at(i); - auto omey = asmtPart->omeys->at(i); - auto omez = asmtPart->omezs->at(i); - os << id << " "; - os << x << " " << y << " " << z << " "; - auto row = aA->at(0); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - row = aA->at(1); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - row = aA->at(2); - os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; - os << vx << " " << vy << " " << vz << " "; - os << omex << " " << omey << " " << omez << " "; + // TODO: undo the breaking I just did on purpose +// auto bryantAngles = std::make_shared>(); +// bryantAngles->setRotOrder(1, 2, 3); +// bryantAngles->at(0) = asmtPart->bryxs->at(i); +// bryantAngles->at(1) = asmtPart->bryys->at(i); +// bryantAngles->at(2) = asmtPart->bryzs->at(i); +// bryantAngles->calc(); +// auto aA = bryantAngles->aA; +// auto vx = asmtPart->vxs->at(i); +// auto vy = asmtPart->vys->at(i); +// auto vz = asmtPart->vzs->at(i); +// auto omex = asmtPart->omexs->at(i); +// auto omey = asmtPart->omeys->at(i); +// auto omez = asmtPart->omezs->at(i); +// os << id << " "; +// os << x << " " << y << " " << z << " "; +// auto row = aA->at(0); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// row = aA->at(1); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// row = aA->at(2); +// os << row->at(0) << " " << row->at(1) << " " << row->at(2) << " "; +// os << vx << " " << vy << " " << vz << " "; +// os << omex << " " << omey << " " << omez << " "; os << std::endl; } diff --git a/OndselSolver/00backhoe.asmt b/testapp/00backhoe.asmt similarity index 100% rename from OndselSolver/00backhoe.asmt rename to testapp/00backhoe.asmt diff --git a/testapp/CMakeLists.txt b/testapp/CMakeLists.txt new file mode 100644 index 0000000..f75fd3d --- /dev/null +++ b/testapp/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.16) + +project(OndselSolverLibrary VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibody Dynamics code") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +add_executable(testapp OndselSolver.cpp) +target_link_libraries(testapp OndselSolver) +target_include_directories(testapp PUBLIC "../OndselSolver") diff --git a/OndselSolver/OndselSolver.cpp b/testapp/OndselSolver.cpp similarity index 59% rename from OndselSolver/OndselSolver.cpp rename to testapp/OndselSolver.cpp index 9b88d4f..0e6e2b3 100644 --- a/OndselSolver/OndselSolver.cpp +++ b/testapp/OndselSolver.cpp @@ -13,33 +13,33 @@ *********************************************************************/ #include -#include "CADSystem.h" -#include "CREATE.h" -#include "GESpMatParPvPrecise.h" -#include "ASMTAssembly.h" -#include "MBDynSystem.h" -#include "MomentOfInertiaSolver.h" +#include "../OndselSolver/CADSystem.h" +#include "../OndselSolver/CREATE.h" +#include "../OndselSolver/GESpMatParPvPrecise.h" +#include "../OndselSolver/ASMTAssembly.h" +#include "../OndselSolver/MBDynSystem.h" +#include "../OndselSolver/MomentOfInertiaSolver.h" using namespace MbD; void runSpMat(); int main() { - ASMTAssembly::readWriteFile("piston.asmt"); - MBDynSystem::runFile("MBDynCase.mbd"); //To be completed - MBDynSystem::runFile("crank_slider.mbd"); //To be completed - //ASMTAssembly::runSinglePendulumSuperSimplified(); //Mass is missing - //ASMTAssembly::runSinglePendulumSuperSimplified2(); //DOF has infinite acceleration due to zero mass and inertias - ASMTAssembly::runSinglePendulumSimplified(); - ASMTAssembly::runSinglePendulum(); - ASMTAssembly::runFile("piston.asmt"); - ASMTAssembly::runFile("00backhoe.asmt"); - //ASMTAssembly::runFile("circular.asmt"); //Needs checking - //ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine. - //ASMTAssembly::runFile("engine1.asmt"); //Needs checking - ASMTAssembly::runFile("fourbar.asmt"); - //ASMTAssembly::runFile("fourbot.asmt"); //Very large but works - ASMTAssembly::runFile("wobpump.asmt"); +// // ASMTAssembly::readWriteFile("piston.asmt"); +// MBDynSystem::runFile("MBDynCase.mbd"); //To be completed +// MBDynSystem::runFile("crank_slider.mbd"); //To be completed +// //ASMTAssembly::runSinglePendulumSuperSimplified(); //Mass is missing +// //ASMTAssembly::runSinglePendulumSuperSimplified2(); //DOF has infinite acceleration due to zero mass and inertias +// ASMTAssembly::runSinglePendulumSimplified(); +// ASMTAssembly::runSinglePendulum(); +// ASMTAssembly::runFile("piston.asmt"); +// ASMTAssembly::runFile("00backhoe.asmt"); +// //ASMTAssembly::runFile("circular.asmt"); //Needs checking +// //ASMTAssembly::runFile("cirpendu.asmt"); //Under constrained. Testing ICKine. +// //ASMTAssembly::runFile("engine1.asmt"); //Needs checking +// ASMTAssembly::runFile("fourbar.asmt"); +// //ASMTAssembly::runFile("fourbot.asmt"); //Very large but works +// ASMTAssembly::runFile("wobpump.asmt"); auto cadSystem = std::make_shared(); cadSystem->runOndselSinglePendulum(); diff --git a/OndselSolver/OndselSolver.h b/testapp/OndselSolver.h similarity index 100% rename from OndselSolver/OndselSolver.h rename to testapp/OndselSolver.h diff --git a/OndselSolver/assembly.asmt b/testapp/assembly.asmt similarity index 100% rename from OndselSolver/assembly.asmt rename to testapp/assembly.asmt diff --git a/OndselSolver/circular.asmt b/testapp/circular.asmt similarity index 100% rename from OndselSolver/circular.asmt rename to testapp/circular.asmt diff --git a/OndselSolver/cirpendu.asmt b/testapp/cirpendu.asmt similarity index 100% rename from OndselSolver/cirpendu.asmt rename to testapp/cirpendu.asmt diff --git a/OndselSolver/engine1.asmt b/testapp/engine1.asmt similarity index 100% rename from OndselSolver/engine1.asmt rename to testapp/engine1.asmt diff --git a/OndselSolver/fourbar.asmt b/testapp/fourbar.asmt similarity index 100% rename from OndselSolver/fourbar.asmt rename to testapp/fourbar.asmt diff --git a/OndselSolver/fourbot.asmt b/testapp/fourbot.asmt similarity index 100% rename from OndselSolver/fourbot.asmt rename to testapp/fourbot.asmt diff --git a/OndselSolver/gyro.asmt b/testapp/gyro.asmt similarity index 100% rename from OndselSolver/gyro.asmt rename to testapp/gyro.asmt diff --git a/OndselSolver/piston.asmt b/testapp/piston.asmt similarity index 100% rename from OndselSolver/piston.asmt rename to testapp/piston.asmt diff --git a/OndselSolver/robot.asmt b/testapp/robot.asmt similarity index 100% rename from OndselSolver/robot.asmt rename to testapp/robot.asmt diff --git a/OndselSolver/wobpump.asmt b/testapp/wobpump.asmt similarity index 100% rename from OndselSolver/wobpump.asmt rename to testapp/wobpump.asmt