First commit

This commit is contained in:
Aik-Siong Koh
2023-04-26 17:23:31 -06:00
commit 475b8d16bc
40 changed files with 721 additions and 0 deletions

35
.gitignore vendored Normal file
View File

@@ -0,0 +1,35 @@
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
.vs
x64/

31
MbDCode.sln Normal file
View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbDCode", "MbDCode\MbDCode.vcxproj", "{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Debug|x64.ActiveCfg = Debug|x64
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Debug|x64.Build.0 = Debug|x64
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Debug|x86.ActiveCfg = Debug|Win32
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Debug|x86.Build.0 = Debug|Win32
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Release|x64.ActiveCfg = Release|x64
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Release|x64.Build.0 = Release|x64
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Release|x86.ActiveCfg = Release|Win32
{80F56CBC-B685-4C36-B834-A2DCDF0A98B7}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BD48A6EF-4E93-4C09-BCE1-84F0439DB2D9}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1 @@
#include "AbsConstraint.h"

12
MbDCode/AbsConstraint.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include "Constraint.h"
namespace MbD {
class AbsConstraint :
public Constraint
{
//axis iqXminusOnePlusAxis
int axis;
int iqXminusOnePlusAxis;
};
}

1
MbDCode/Array.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Array.h"

14
MbDCode/Array.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
#include <vector>
namespace MbD {
template <typename T>
class Array : public std::vector<T>
{
public:
Array(){}
Array(int i) : std::vector<T>(i) {}
Array(std::initializer_list<T> list) : std::vector<T>{ list } {}
};
}

View File

@@ -0,0 +1 @@
#include "CartesianFrame.h"

9
MbDCode/CartesianFrame.h Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
#include "Item.h"
namespace MbD {
class CartesianFrame :
public Item
{
};
}

1
MbDCode/Constraint.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Constraint.h"

28
MbDCode/Constraint.h Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <memory>
#include "Item.h"
namespace MbD {
class Constraint : public Item
{
public:
Constraint() : Item() {
iG = -1;
aG = 0.0;
lam = 0.0;
}
void setOwner(std::shared_ptr<Item> x) {
owner = x;
}
std::shared_ptr<Item> getOwner() {
return owner.lock();
}
//iG aG lam mu lamDeriv owner
int iG;
double aG; //Constraint function
double lam; //Lambda is Lagrange Multiplier
std::weak_ptr<Item> owner; //A Joint or PartFrame owns the constraint
};
}

View File

@@ -0,0 +1 @@
#include "EulerConstraint.h"

22
MbDCode/EulerConstraint.h Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include <memory>
#include <vector>
#include "Constraint.h"
#include "FullRow.h"
namespace MbD {
using FullRowDPtr = std::shared_ptr<FullRow<double>>;
class EulerConstraint : public Constraint
{
public:
EulerConstraint() : Constraint() {
pGpE = std::make_shared<FullRow<double>>(4);
}
//pGpE iqE
FullRowDPtr pGpE; //partial derivative of G wrt pE
int iqE;
};
}

1
MbDCode/FullColumn.cpp Normal file
View File

@@ -0,0 +1 @@
#include "FullColumn.h"

11
MbDCode/FullColumn.h Normal file
View File

@@ -0,0 +1,11 @@
#pragma once
#include "Vector.h"
namespace MbD {
template <typename T>
class FullColumn : public Vector<T>
{
public:
FullColumn(std::initializer_list<T> list) : Vector<T>{ list } {}
};
}

1
MbDCode/FullRow.cpp Normal file
View File

@@ -0,0 +1 @@
#include "FullRow.h"

13
MbDCode/FullRow.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
#include "Vector.h"
namespace MbD {
template <typename T>
class FullRow : public Vector<T>
{
public:
FullRow() {}
FullRow(int i) : Vector<T>(i) {}
FullRow(std::initializer_list<T> list) : Vector<T>{ list } {}
};
}

21
MbDCode/Item.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "Item.h"
void MbD::Item::setName(std::string& str)
{
name = str;
}
const std::string& MbD::Item::getName() const
{
return name;
}
//
//void MbD::Item::setMyInt(int val)
//{
// myInt = val;
//}
//
//int MbD::Item::getMyInt()
//{
// return myInt;
//}

14
MbDCode/Item.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
#include <string>
namespace MbD {
class Item
{
public:
Item() {}
void setName(std::string& str);
const std::string& getName() const;
private:
std::string name;
};
}

1
MbDCode/Joint.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Joint.h"

9
MbDCode/Joint.h Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
#include "Item.h"
namespace MbD {
class Joint :
public Item
{
};
}

1
MbDCode/MarkerFrame.cpp Normal file
View File

@@ -0,0 +1 @@
#include "MarkerFrame.h"

9
MbDCode/MarkerFrame.h Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
#include "CartesianFrame.h"
namespace MbD {
class MarkerFrame :
public CartesianFrame
{
};
}

17
MbDCode/MbDCode.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include <iostream>
#include "Item.h"
#include "System.h"
using namespace MbD;
int main()
{
std::cout << "Hello World!\n";
auto& TheSystem = System::getInstance();
std::string str = "TheSystem";
TheSystem.setName(str);
std::cout << TheSystem.getName();
//auto fixedPart = std::make_shared<Part>();
//str = "FixedPart";
//fixedPart->setName(str);
}

169
MbDCode/MbDCode.vcxproj Normal file
View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{80f56cbc-b685-4c36-b834-a2dcdf0a98b7}</ProjectGuid>
<RootNamespace>MbDCode</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AbsConstraint.cpp" />
<ClCompile Include="Array.cpp" />
<ClCompile Include="CartesianFrame.cpp" />
<ClCompile Include="Constraint.cpp" />
<ClCompile Include="EulerConstraint.cpp" />
<ClCompile Include="FullColumn.cpp" />
<ClCompile Include="FullRow.cpp" />
<ClCompile Include="Item.cpp" />
<ClCompile Include="Joint.cpp" />
<ClCompile Include="MarkerFrame.cpp" />
<ClCompile Include="MbDCode.cpp" />
<ClCompile Include="NewtonRaphson.cpp" />
<ClCompile Include="Part.cpp" />
<ClCompile Include="PartFrame.cpp" />
<ClCompile Include="Solver.cpp" />
<ClCompile Include="System.cpp" />
<ClCompile Include="SystemSolver.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AbsConstraint.h" />
<ClInclude Include="Array.h" />
<ClInclude Include="CartesianFrame.h" />
<ClInclude Include="Constraint.h" />
<ClInclude Include="EulerConstraint.h" />
<ClInclude Include="FullColumn.h" />
<ClInclude Include="FullRow.h" />
<ClInclude Include="Item.h" />
<ClInclude Include="Joint.h" />
<ClInclude Include="MarkerFrame.h" />
<ClInclude Include="NewtonRaphson.h" />
<ClInclude Include="Part.h" />
<ClInclude Include="PartFrame.h" />
<ClInclude Include="Solver.h" />
<ClInclude Include="System.h" />
<ClInclude Include="SystemSolver.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="MbDCode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Array.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Item.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Solver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="System.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SystemSolver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NewtonRaphson.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Joint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Part.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FullColumn.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PartFrame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AbsConstraint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CartesianFrame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Constraint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="EulerConstraint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FullRow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MarkerFrame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Array.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Item.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Solver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="System.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SystemSolver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NewtonRaphson.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Joint.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Part.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FullColumn.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PartFrame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AbsConstraint.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CartesianFrame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Constraint.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EulerConstraint.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FullRow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MarkerFrame.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -0,0 +1 @@
#include "NewtonRaphson.h"

9
MbDCode/NewtonRaphson.h Normal file
View File

@@ -0,0 +1,9 @@
#pragma once
#include "Solver.h"
namespace MbD {
class NewtonRaphson :
public Solver
{
};
}

1
MbDCode/Part.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Part.h"

28
MbDCode/Part.h Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <memory>
#include "Item.h"
#include "PartFrame.h"
#include "FullColumn.h"
namespace MbD {
class PartFrame;
class Part : public Item
{
public:
Part() {
partFrame = std::make_shared<PartFrame>();
}
void setqX(FullColumn<double>* x) {
partFrame.get()->setqX(x);
}
FullColumn<double>* getqX() {
return partFrame.get()->getqX();
}
//ToDo: Needed members ipX ipE m aJ partFrame pX pXdot pE pEdot mX mE mEdot pTpE ppTpEpE ppTpEpEdot
std::shared_ptr<PartFrame> partFrame;
};
}

12
MbDCode/PartFrame.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include "PartFrame.h"
#include "AbsConstraint.h"
#include "MarkerFrame.h"
namespace MbD {
PartFrame::PartFrame()
{
aGabs = std::vector<std::shared_ptr<AbsConstraint>>();
markerFrames = std::vector<std::shared_ptr<MarkerFrame>>();
}
}

42
MbDCode/PartFrame.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include <memory>
#include <vector>
#include "CartesianFrame.h"
#include "Part.h"
#include "MarkerFrame.h"
#include "EulerConstraint.h"
#include "AbsConstraint.h"
#include "FullColumn.h"
namespace MbD {
class Part;
class MarkerFrame;
class PartFrame : public CartesianFrame
{
public:
PartFrame();
void setqX(FullColumn<double>* x) {
qX = x;
}
FullColumn<double>* getqX() {
return qX;
}
void setPart(std::shared_ptr<Part> x) {
part = x;
}
std::shared_ptr<Part> getPart() {
return part.lock();
}
//part iqX iqE qX qE qXdot qEdot qXddot qEddot aGeu aGabs markerFrames
std::weak_ptr<Part> part;
int iqX, iqE; //Position index of frame variables qX and qE in system list of variables
FullColumn<double>* qX;
FullColumn<double>* qE;
std::shared_ptr<EulerConstraint> aGeu;
std::vector<std::shared_ptr<AbsConstraint>> aGabs;
std::vector<std::shared_ptr<MarkerFrame>> markerFrames;
};
}

1
MbDCode/Solver.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Solver.h"

7
MbDCode/Solver.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
namespace MbD {
class Solver
{
};
}

1
MbDCode/System.cpp Normal file
View File

@@ -0,0 +1 @@
#include "System.h"

36
MbDCode/System.h Normal file
View File

@@ -0,0 +1,36 @@
#pragma once
#include <memory>
#include <vector>
#include "Item.h"
#include "Part.h"
#include "Joint.h"
#include "SystemSolver.h"
namespace MbD {
class SystemSolver;
class System : public Item
{
//ToDo: Needed members admSystem namedItems mbdTime parts jointsMotions forcesTorques sensors variables hasChanged mbdSystemSolver
public:
static System& getInstance() {
//https://medium.com/@caglayandokme/further-enhancing-the-singleton-pattern-in-c-8278b02b1ac7
static System singleInstance; // Block-scoped static Singleton instance
return singleInstance;
};
std::vector<std::shared_ptr<Part>> parts;
std::vector<std::shared_ptr<Joint>> jointsMotions;
bool hasChanged = false;
std::shared_ptr<SystemSolver> systemSolver;
private:
System() {
parts = std::vector<std::shared_ptr<Part>>();
jointsMotions = std::vector<std::shared_ptr<Joint>>();
systemSolver = std::make_shared<SystemSolver>(*this);
}
//System() = default; // Private constructor
System(const System&) = delete;
System& operator=(const System&) = delete; // Deleted copy assignment
~System() = default; // Private destructor
};
}

1
MbDCode/SystemSolver.cpp Normal file
View File

@@ -0,0 +1 @@
#include "SystemSolver.h"

22
MbDCode/SystemSolver.h Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include <memory>
#include "Solver.h"
#include "System.h"
#include "NewtonRaphson.h"
namespace MbD {
class System;
class SystemSolver : public Solver
{
//system parts jointsMotions forcesTorques sensors variables icTypeSolver setsOfRedundantConstraints errorTolPosKine errorTolAccKine
//iterMaxPosKine iterMaxAccKine basicIntegrator tstartPasts tstart hmin hmax tend toutFirst hout direction corAbsTol corRelTol
//intAbsTol intRelTol iterMaxDyn orderMax translationLimit rotationLimit
public:
SystemSolver(System& x) : system(x) {
}
std::shared_ptr<NewtonRaphson> icTypeSolver;
System& system;
};
}

1
MbDCode/Vector.cpp Normal file
View File

@@ -0,0 +1 @@
#include "Vector.h"

12
MbDCode/Vector.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include "Array.h"
namespace MbD {
template <typename T>
class Vector : public Array<T>
{
public:
Vector(int i) : Array<T>(i) {}
Vector(std::initializer_list<T> list) : Array<T>{ list } {}
};
}