Cmake gtest (#79)
* Check rackpin and gear for zero radii * rebase zero-radii-check (#69) * contributing * Update push-freecad.yml updated actions/checkout to v4 * dragging log for debugging * fix calcdxNorm crash * setDebug and remove MBDyn* * Update cmakelists.txt * fix includes for gcc-14 gcc-14 is more disciplined about not including <algorithm> transitively. * fix runDragStep * backhoe files (#65) * Mark unused variables to silence compiler warnings. (#64) * Backhoe issues (#67) * backhoe issues * runDragStep edit * backhoe issues * runDragStep edit * Reduce large drag step progressively until convergence. * Switch to using built-in M_PI, even on MSVC (#68) --------- Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain> Co-authored-by: mosfet80 <realeandrea@yahoo.it> Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com> Co-authored-by: Jed Brown <jed@jedbrown.org> Co-authored-by: sliptonic <shopinthewoods@gmail.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org> * in progress * Gtest added * With changes from Assembly * WinMerge main and this branch * Add flag for GTest * Flag to suppress OndselSolverMain * rebase zero-radii-check (#69) * contributing * Update push-freecad.yml updated actions/checkout to v4 * dragging log for debugging * fix calcdxNorm crash * setDebug and remove MBDyn* * Update cmakelists.txt * fix includes for gcc-14 gcc-14 is more disciplined about not including <algorithm> transitively. * fix runDragStep * backhoe files (#65) * Mark unused variables to silence compiler warnings. (#64) * Backhoe issues (#67) * backhoe issues * runDragStep edit * backhoe issues * runDragStep edit * Reduce large drag step progressively until convergence. * Switch to using built-in M_PI, even on MSVC (#68) --------- Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain> Co-authored-by: mosfet80 <realeandrea@yahoo.it> Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com> Co-authored-by: Jed Brown <jed@jedbrown.org> Co-authored-by: sliptonic <shopinthewoods@gmail.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org> * in progress * Gtest added * With changes from Assembly * Add flag for GTest * Flag to suppress OndselSolverMain --------- Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain> Co-authored-by: mosfet80 <realeandrea@yahoo.it> Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com> Co-authored-by: Jed Brown <jed@jedbrown.org> Co-authored-by: sliptonic <shopinthewoods@gmail.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -39,4 +39,6 @@ assembly.asmt
|
||||
build
|
||||
cmake-build-debug
|
||||
.idea
|
||||
temp/
|
||||
temp/
|
||||
/testapp/draggingBackhoe.log
|
||||
/testapp/runPreDragBackhoe.asmt
|
||||
|
||||
@@ -5,6 +5,9 @@ project(OndselSolver VERSION 1.0.1 DESCRIPTION "Assembly Constraints and Multibo
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
option(ONDSELSOLVER_BUILD_TESTS "Set to ON to build the Google Test-based C++ test suite." OFF)
|
||||
option(ONDSELSOLVER_BUILD_EXE "Set to ON to build the standalone OndselSolver executable." OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if( UNIX )
|
||||
@@ -17,9 +20,14 @@ ENDIF ()
|
||||
|
||||
add_compile_definitions(TEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/testapp")
|
||||
add_subdirectory(OndselSolver)
|
||||
add_subdirectory(OndselSolverMain)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
target_compile_definitions(test_run PUBLIC TEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/testapp")
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OndselSolverMain PROPERTY VS_STARTUP_PROJECT OndselSolverMain)
|
||||
if(ONDSELSOLVER_BUILD_EXE)
|
||||
add_subdirectory(OndselSolverMain)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OndselSolverMain PROPERTY VS_STARTUP_PROJECT OndselSolverMain)
|
||||
endif()
|
||||
|
||||
if(ONDSELSOLVER_BUILD_TESTS)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
target_compile_definitions(test_run PUBLIC TEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/testapp")
|
||||
endif()
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "ASMTLimit.h"
|
||||
#include "ASMTRotationLimit.h"
|
||||
#include "ASMTTranslationLimit.h"
|
||||
#include "ExternalSystem.h"
|
||||
#include <filesystem>
|
||||
|
||||
using namespace MbD;
|
||||
@@ -68,6 +69,7 @@ using namespace MbD;
|
||||
MbD::ASMTAssembly::ASMTAssembly()
|
||||
: ASMTSpatialContainer()
|
||||
{
|
||||
externalSystem = std::make_shared<ExternalSystem>();
|
||||
times = std::make_shared<FullRow<double>>();
|
||||
}
|
||||
|
||||
@@ -1305,6 +1307,11 @@ void MbD::ASMTAssembly::storeOnLevel(std::ofstream& os, size_t level)
|
||||
storeOnTimeSeries(os);
|
||||
}
|
||||
|
||||
size_t MbD::ASMTAssembly::numberOfFrames()
|
||||
{
|
||||
return times->size();
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::solve()
|
||||
{
|
||||
auto simulationParameters = CREATE<ASMTSimulationParameters>::With();
|
||||
@@ -1757,3 +1764,20 @@ void MbD::ASMTAssembly::setDebug(bool todebug)
|
||||
{
|
||||
debug = todebug;
|
||||
}
|
||||
|
||||
void MbD::ASMTAssembly::updateForFrame(size_t index)
|
||||
{
|
||||
ASMTSpatialContainer::updateForFrame(index);
|
||||
for (auto& part : *parts) {
|
||||
part->updateForFrame(index);
|
||||
}
|
||||
//for (auto& joint : *joints) {
|
||||
// joint->updateForFrame(index);
|
||||
//}
|
||||
//for (auto& motion : *motions) {
|
||||
// motion->updateForFrame(index);
|
||||
//}
|
||||
//for (auto& forceTorque : *forcesTorques) {
|
||||
// forceTorque->updateForFrame(index);
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace MbD {
|
||||
class ASMTLimit;
|
||||
class SystemSolver;
|
||||
class ASMTItemIJ;
|
||||
class ExternalSystem;
|
||||
|
||||
class ASMTAssembly : public ASMTSpatialContainer
|
||||
{
|
||||
@@ -91,6 +92,7 @@ namespace MbD {
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
void outputFile(const std::string& filename);
|
||||
void storeOnLevel(std::ofstream& os, size_t level) override;
|
||||
size_t numberOfFrames();
|
||||
|
||||
/* This function performs a one shot solve of the assembly.*/
|
||||
void solve();
|
||||
@@ -133,6 +135,7 @@ namespace MbD {
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
void setFilename(const std::string& filename);
|
||||
void setDebug(bool todebug);
|
||||
void updateForFrame(size_t index) override;
|
||||
|
||||
std::string filename = "";
|
||||
std::string notes = "(Text string: '' runs: (Core.RunArray runs: #() values: #()))";
|
||||
@@ -151,6 +154,7 @@ namespace MbD {
|
||||
std::shared_ptr<Units> mbdUnits = std::make_shared<Units>();
|
||||
std::shared_ptr<System> mbdSystem;
|
||||
bool debug = false;
|
||||
std::shared_ptr<ExternalSystem> externalSystem;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -191,6 +191,21 @@ void MbD::ASMTItem::createMbD(std::shared_ptr<System>, std::shared_ptr<Units>)
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::updateForFrame(size_t index)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::updateFromInitiallyAssembledState()
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::updateFromInputState()
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void MbD::ASMTItem::updateFromMbD()
|
||||
{
|
||||
assert(false);
|
||||
|
||||
@@ -46,8 +46,11 @@ namespace MbD {
|
||||
void readDoublesInto(std::string str, std::string label, FRowDsptr& row);
|
||||
virtual void deleteMbD();
|
||||
virtual void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits);
|
||||
virtual void updateFromMbD();
|
||||
virtual void compareResults(AnalysisType type);
|
||||
virtual void updateForFrame(size_t index);
|
||||
virtual void updateFromInitiallyAssembledState();
|
||||
virtual void updateFromInputState();
|
||||
virtual void updateFromMbD();
|
||||
virtual void compareResults(AnalysisType type);
|
||||
virtual void outputResults(AnalysisType type);
|
||||
std::shared_ptr<Units> mbdUnits();
|
||||
std::shared_ptr<Constant> sptrConstant(double value);
|
||||
|
||||
@@ -78,6 +78,12 @@ void MbD::ASMTSimulationParameters::sethout(double h)
|
||||
void MbD::ASMTSimulationParameters::seterrorTol(double tol)
|
||||
{
|
||||
errorTol = tol;
|
||||
errorTolPosKine = tol;
|
||||
errorTolAccKine = tol;
|
||||
corAbsTol = tol;
|
||||
corRelTol = tol;
|
||||
intAbsTol = tol;
|
||||
intRelTol = tol;
|
||||
}
|
||||
|
||||
void MbD::ASMTSimulationParameters::setmaxIter(size_t maxIter)
|
||||
|
||||
@@ -360,6 +360,26 @@ ASMTSpatialContainer* MbD::ASMTSpatialContainer::partOrAssembly()
|
||||
return this;
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialContainer::updateForFrame(size_t index)
|
||||
{
|
||||
position3D = getPosition3D(index);
|
||||
rotationMatrix = getRotationMatrix(index);
|
||||
velocity3D = getVelocity3D(index);
|
||||
omega3D = getOmega3D(index);
|
||||
acceleration3D = getAcceleration3D(index);
|
||||
alpha3D = getAlpha3D(index);
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialContainer::updateFromInitiallyAssembledState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialContainer::updateFromInputState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MbD::ASMTSpatialContainer::updateFromMbD()
|
||||
{
|
||||
auto mbdUnts = mbdUnits();
|
||||
@@ -372,6 +392,7 @@ void MbD::ASMTSpatialContainer::updateFromMbD()
|
||||
omega3D = omeOPO;
|
||||
auto aOcmO = mbdPart->qXddot()->times(mbdUnts->acceleration);
|
||||
auto alpOPO = mbdPart->alpOpO()->times(mbdUnts->alpha);
|
||||
alpha3D = alpOPO;
|
||||
auto& rPcmP = principalMassMarker->position3D;
|
||||
auto& aAPp = principalMassMarker->rotationMatrix;
|
||||
auto aAOP = aAOp->timesTransposeFullMatrix(aAPp);
|
||||
@@ -384,7 +405,8 @@ void MbD::ASMTSpatialContainer::updateFromMbD()
|
||||
auto vOPO = vOcmO->minusFullColumn(omeOPO->cross(rPcmO));
|
||||
velocity3D = vOPO;
|
||||
auto aOPO = aOcmO->minusFullColumn(alpOPO->cross(rPcmO))->minusFullColumn(omeOPO->cross(omeOPO->cross(rPcmO)));
|
||||
xs->push_back(rOPO->at(0));
|
||||
acceleration3D = aOPO;
|
||||
xs->push_back(rOPO->at(0));
|
||||
ys->push_back(rOPO->at(1));
|
||||
zs->push_back(rOPO->at(2));
|
||||
auto bryantAngles = aAOP->bryantAngles();
|
||||
@@ -764,3 +786,21 @@ FColDsptr MbD::ASMTSpatialContainer::getOmega3D(size_t i)
|
||||
vec3->atiput(2, omezs->at(i));
|
||||
return vec3;
|
||||
}
|
||||
|
||||
FColDsptr MbD::ASMTSpatialContainer::getAcceleration3D(size_t i)
|
||||
{
|
||||
auto vec3 = std::make_shared<FullColumn<double>>(3);
|
||||
vec3->atiput(0, axs->at(i));
|
||||
vec3->atiput(1, ays->at(i));
|
||||
vec3->atiput(2, azs->at(i));
|
||||
return vec3;
|
||||
}
|
||||
|
||||
FColDsptr MbD::ASMTSpatialContainer::getAlpha3D(size_t i)
|
||||
{
|
||||
auto vec3 = std::make_shared<FullColumn<double>>(3);
|
||||
vec3->atiput(0, alpxs->at(i));
|
||||
vec3->atiput(1, alpys->at(i));
|
||||
vec3->atiput(2, alpzs->at(i));
|
||||
return vec3;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace MbD {
|
||||
virtual FColDsptr vOcmO();
|
||||
virtual FColDsptr omeOpO();
|
||||
ASMTSpatialContainer* partOrAssembly() override;
|
||||
void updateFromMbD() override;
|
||||
void updateForFrame(size_t index) override;
|
||||
void updateFromInitiallyAssembledState() override;
|
||||
void updateFromInputState() override;
|
||||
void updateFromMbD() override;
|
||||
void compareResults(AnalysisType type) override;
|
||||
void outputResults(AnalysisType type) override;
|
||||
void addRefPoint(std::shared_ptr<ASMTRefPoint> refPoint);
|
||||
@@ -92,12 +95,16 @@ namespace MbD {
|
||||
void storeOnLevelRefCurves(std::ofstream& os, size_t level);
|
||||
void storeOnLevelRefSurfaces(std::ofstream& os, size_t level);
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
FColDsptr getVelocity3D(size_t i);
|
||||
FColDsptr getOmega3D(size_t i);
|
||||
FColDsptr getVelocity3D(size_t i);
|
||||
FColDsptr getOmega3D(size_t i);
|
||||
FColDsptr getAcceleration3D(size_t i);
|
||||
FColDsptr getAlpha3D(size_t i);
|
||||
|
||||
FColDsptr velocity3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefPoint>>> refPoints;
|
||||
FColDsptr omega3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr acceleration3D = std::make_shared<FullColumn<double>>(3);
|
||||
FColDsptr alpha3D = std::make_shared<FullColumn<double>>(3);
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefPoint>>> refPoints;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefCurve>>> refCurves;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ASMTRefSurface>>> refSurfaces;
|
||||
FRowDsptr vxs, vys, vzs, omexs, omeys, omezs;
|
||||
|
||||
@@ -27,9 +27,15 @@ void MbD::ASMTTranslationalMotion::parseASMT(std::vector<std::string>& lines)
|
||||
|
||||
void MbD::ASMTTranslationalMotion::initMarkers()
|
||||
{
|
||||
auto jt = root()->jointAt(motionJoint);
|
||||
markerI = jt->markerI;
|
||||
markerJ = jt->markerJ;
|
||||
if (motionJoint == "") {
|
||||
assert(markerI != "");
|
||||
assert(markerJ != "");
|
||||
}
|
||||
else {
|
||||
auto jt = root()->jointAt(motionJoint);
|
||||
markerI = jt->markerI;
|
||||
markerJ = jt->markerJ;
|
||||
}
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits)
|
||||
@@ -60,6 +66,11 @@ void MbD::ASMTTranslationalMotion::readMotionJoint(std::vector<std::string>& lin
|
||||
lines.erase(lines.begin());
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::setTranslationZ(std::string tranZ)
|
||||
{
|
||||
translationZ = tranZ;
|
||||
}
|
||||
|
||||
void MbD::ASMTTranslationalMotion::readTranslationZ(std::vector<std::string>& lines)
|
||||
{
|
||||
assert(lines[0].find("TranslationZ") != std::string::npos);
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace MbD {
|
||||
void createMbD(std::shared_ptr<System> mbdSys, std::shared_ptr<Units> mbdUnits) override;
|
||||
std::shared_ptr<ItemIJ> mbdClassNew() override;
|
||||
void readMotionJoint(std::vector<std::string>& lines);
|
||||
void setTranslationZ(std::string tranZ);
|
||||
void readTranslationZ(std::vector<std::string>& lines);
|
||||
void storeOnLevel(std::ofstream& os, size_t level) override;
|
||||
void storeOnTimeSeries(std::ofstream& os) override;
|
||||
|
||||
@@ -297,7 +297,7 @@ set(ONDSELSOLVER_SRC
|
||||
System.cpp
|
||||
SystemNewtonRaphson.cpp
|
||||
SystemSolver.cpp
|
||||
Time.cpp
|
||||
SymTime.cpp
|
||||
TooManyTriesError.cpp
|
||||
TooSmallStepSizeError.cpp
|
||||
Translation.cpp
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "ExternalSystem.h"
|
||||
#include "CADSystem.h"
|
||||
#include "ASMTAssembly.h"
|
||||
//#include <Mod/Assembly/App/AssemblyObject.h>
|
||||
#include "System.h"
|
||||
|
||||
using namespace MbD;
|
||||
@@ -18,10 +19,14 @@ void MbD::ExternalSystem::preMbDrun(std::shared_ptr<System> mbdSys)
|
||||
if (cadSystem) {
|
||||
cadSystem->preMbDrun(mbdSys);
|
||||
}
|
||||
else if (asmtAssembly) {
|
||||
asmtAssembly->preMbDrun(mbdSys);
|
||||
}
|
||||
else {
|
||||
else if (asmtAssembly) {
|
||||
asmtAssembly->preMbDrun(mbdSys);
|
||||
//asmtAssembly->externalSystem->preMbDrun(mbdSys);
|
||||
}
|
||||
else if (freecadAssemblyObject) {
|
||||
//freecadAssemblyObject->preMbDrun();
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +44,10 @@ void MbD::ExternalSystem::updateFromMbD()
|
||||
else if (asmtAssembly) {
|
||||
asmtAssembly->updateFromMbD();
|
||||
}
|
||||
else {
|
||||
else if (freecadAssemblyObject) {
|
||||
//freecadAssemblyObject->updateFromMbD();
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -53,8 +61,12 @@ void MbD::ExternalSystem::outputFor(AnalysisType type)
|
||||
asmtAssembly->updateFromMbD();
|
||||
asmtAssembly->compareResults(type);
|
||||
asmtAssembly->outputResults(type);
|
||||
}
|
||||
else {
|
||||
//asmtAssembly->externalSystem->outputFor(type);
|
||||
}
|
||||
else if (freecadAssemblyObject) {
|
||||
//freecadAssemblyObject->outputResults(type);
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
//#include "ASMTAssembly.h"
|
||||
#include "Part.h"
|
||||
|
||||
namespace Assembly
|
||||
{
|
||||
class AssemblyObject;
|
||||
}
|
||||
|
||||
namespace MbD {
|
||||
class CADSystem;
|
||||
class ASMTAssembly;
|
||||
class System;
|
||||
class System;
|
||||
|
||||
class ExternalSystem
|
||||
{
|
||||
@@ -37,7 +42,8 @@ namespace MbD {
|
||||
|
||||
|
||||
CADSystem* cadSystem;
|
||||
ASMTAssembly* asmtAssembly;
|
||||
ASMTAssembly* asmtAssembly;
|
||||
Assembly::AssemblyObject* freecadAssemblyObject;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void MbD::GeneralSpline::computeDerivatives()
|
||||
else {
|
||||
//"Zero out higher derivatives at node n and node 1 to get the p end equations."
|
||||
unsigned int count = 0;
|
||||
auto npass = 0;
|
||||
unsigned int npass = 0;
|
||||
while (count < p) {
|
||||
matrix->atijput(np - count, np - npass, 1.0);
|
||||
count++;
|
||||
|
||||
32
individual_contributor_license_agrement.md
Normal file
32
individual_contributor_license_agrement.md
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user