works locally, but imagine it breaks elsewhere

This commit is contained in:
John Dupuy
2023-11-06 16:31:57 -06:00
parent 84ec3cf5e1
commit 87bd168b50
18 changed files with 83 additions and 59 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -33,7 +33,9 @@ namespace MbD {
std::shared_ptr<FullColumn<int>> rotOrder;
FColFMatDsptr cA;
FMatDsptr aA;
};
// // NOTE: do NOT instantiate EulerAngles<double> as a whole as differentiateWRT breaks
// template <>
// void EulerAngles<double>::setRotOrder(int, int, int);
}

View File

@@ -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<EulerAngles<double>>();
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<EulerAngles<double>>();
// 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;
}

10
testapp/CMakeLists.txt Normal file
View File

@@ -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")

View File

@@ -13,33 +13,33 @@
*********************************************************************/
#include <filesystem>
#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>();
cadSystem->runOndselSinglePendulum();