From 73f987777954b5fee5b85eef01f80a26e017dd9e Mon Sep 17 00:00:00 2001 From: Paddle Date: Thu, 5 Oct 2023 13:47:45 +0200 Subject: [PATCH] Initialize mass marker and gravity so that they don't need to be defined in assembly. --- OndselSolver/ASMTAssembly.h | 2 +- OndselSolver/ASMTConstantGravity.h | 2 +- OndselSolver/ASMTPrincipalMassMarker.h | 5 +++-- OndselSolver/ASMTSpatialContainer.cpp | 2 +- OndselSolver/ASMTSpatialContainer.h | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OndselSolver/ASMTAssembly.h b/OndselSolver/ASMTAssembly.h index b4a6100..cab0ab5 100644 --- a/OndselSolver/ASMTAssembly.h +++ b/OndselSolver/ASMTAssembly.h @@ -105,7 +105,7 @@ namespace MbD { std::shared_ptr>> joints = std::make_shared>>(); std::shared_ptr>> motions = std::make_shared>>(); std::shared_ptr>> forcesTorques = std::make_shared>>(); - std::shared_ptr constantGravity; + std::shared_ptr constantGravity = std::make_shared(); std::shared_ptr simulationParameters; std::shared_ptr animationParameters; std::shared_ptr> times; diff --git a/OndselSolver/ASMTConstantGravity.h b/OndselSolver/ASMTConstantGravity.h index 89b833c..56045a7 100644 --- a/OndselSolver/ASMTConstantGravity.h +++ b/OndselSolver/ASMTConstantGravity.h @@ -25,7 +25,7 @@ namespace MbD { void setg(double a, double b, double c); - FColDsptr g; + FColDsptr g = std::make_shared>(ListD{ 0.,0.,0. }); }; } diff --git a/OndselSolver/ASMTPrincipalMassMarker.h b/OndselSolver/ASMTPrincipalMassMarker.h index c640f73..0686ae9 100644 --- a/OndselSolver/ASMTPrincipalMassMarker.h +++ b/OndselSolver/ASMTPrincipalMassMarker.h @@ -23,8 +23,9 @@ namespace MbD { // Overloads to simplify syntax. void setMomentOfInertias(double a, double b, double c); - double mass, density; - DiagMatDsptr momentOfInertias; + double mass = 0.0; + double density = 0.0; + DiagMatDsptr momentOfInertias = std::make_shared>(ListD{ 0.,0.,0. }); }; } diff --git a/OndselSolver/ASMTSpatialContainer.cpp b/OndselSolver/ASMTSpatialContainer.cpp index c23d971..9c7d671 100644 --- a/OndselSolver/ASMTSpatialContainer.cpp +++ b/OndselSolver/ASMTSpatialContainer.cpp @@ -13,7 +13,7 @@ #include "ASMTRefPoint.h" #include "ASMTRefCurve.h" #include "ASMTRefSurface.h" -#include "ASMTPrincipalMassMarker.h" +//#include "ASMTPrincipalMassMarker.h" using namespace MbD; diff --git a/OndselSolver/ASMTSpatialContainer.h b/OndselSolver/ASMTSpatialContainer.h index 52c2402..0c72483 100644 --- a/OndselSolver/ASMTSpatialContainer.h +++ b/OndselSolver/ASMTSpatialContainer.h @@ -12,7 +12,7 @@ //#include "ASMTRefPoint.h" //#include "ASMTRefCurve.h" //#include "ASMTRefSurface.h" -//#include "ASMTPrincipalMassMarker.h" +#include "ASMTPrincipalMassMarker.h" //#include "Units.h" //#include "ASMTPart.h" //#include "ASMTJoint.h" @@ -80,7 +80,7 @@ namespace MbD { FRowDsptr inxs, inys, inzs, inbryxs, inbryys, inbryzs; FRowDsptr invxs, invys, invzs, inomexs, inomeys, inomezs; FRowDsptr inaxs, inays, inazs, inalpxs, inalpys, inalpzs; - std::shared_ptr principalMassMarker; + std::shared_ptr principalMassMarker = std::make_shared(); }; }