FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Collision.h
1#pragma once
2//@group{marine_elements,RMCable,Collision,Cable Collision}
56#include <Eigen/Eigen>
57#pragma warning(push)
58#pragma warning(disable : 4996)
59#include <unsupported/Eigen/SparseExtra>
60#pragma warning(pop)
61
62#include <fhsim/simobject/SimObject.h>
63#ifdef FH_VISUALIZATION
64# include "sfh/ogre/C3DLine.h"
65#endif
66
67namespace RbCable
68{
69class Collision : public SimObject
70{
71public:
72 Collision(const std::string& simObjectName, ISimObjectCreator* const creator);
73 ~Collision();
74 void OdeFcn(const double T, const double* const X, double* const XDot) const override;
75 void AcceptedStep(const double T, const double* const X) override;
76 // void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
77
78 const double* energy(const double T, const double* const X);
79 const double* momentum(const double T, const double* const X);
80
81#ifdef FH_VISUALIZATION
82 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
83 void RenderUpdate(const double T, const double* const X);
84#endif
85
86protected:
87 typedef Eigen::Matrix<double, 3, 3> mat3;
88 typedef Eigen::Matrix<double, 3, 1> vec3;
89
90
91 int m_NUM;
92 int m_CON;
93
94 double m_radius;
95 double m_mass;
96 double m_alpha;
97 double m_beta;
98 double m_epsilon;
99
100 double m_spring;
101 double m_damping;
102
103 struct element
104 {
105 int p;
106 int v;
107 };
108 element* m_el;
109
110 double m_systemEnergy[3];
111 double m_systemMomentum[3];
112
113 struct contact
114 {
115 int a;
116 int b;
117 double D;
118 };
119
120
121 mutable int m_lastNumContact = 0;
122 mutable int m_lastNumContactObjects = 0;
123 mutable double m_lastCollCheck = 0.0;
124 mutable double m_lastNBuild = 0.0;
125 mutable double m_lastBuildBvec = 0.0;
126 mutable double m_lastMatrixMult = 0.0;
127 mutable double m_lastSystemSolve = 0.0;
128 mutable double m_lastSolutionWrite = 0.0;
129 mutable double m_lastOdeTime = 0.0;
130
131#ifdef FH_VISUALIZATION
132 Ogre::SceneNode** m_ManualObjectNodes;
133#endif
134};
135
136} // namespace RbCable
Collision(const std::string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
Definition NewMOC.h:15
Definition Collision.h:114
Definition Collision.h:104