Marine systems simulation
LineStructure.h
1#pragma once
2
3#include "JointConstraint.h"
4
5#include "SimObject.h"
6
7#ifdef FH_VISUALIZATION
8#include "sfh/ogre/C3DLine.h"
9#endif
10
11
12namespace CoRiBoDynamics {
13namespace Structures {
14
16public:
17 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
18 struct LineSpec {
19 int num;
20 double Beta;
21 double Alpha;
22 double Length;
23 double Diameter;
24 double EA;
25 vec3 EI;
26 double Inertia[6];
27 };
28
32 LineStructure(ConstraintSolver* solver, ISimObjectCreator* creator, LineSpec spec, string name);
33 virtual ~LineStructure();
34
35 virtual void ComputeConstraints(const double T, const double * const X);
36
40 virtual void InitialConditionSetup(double *const states, const vec3& P1, const vec3& P2 );
41
42#ifdef FH_VISUALIZATION
43 virtual void RenderInit(Ogre::Root* const ogreRoot);
44 virtual void RenderUpdate(const double T, const double* const X);
45 void visualizationDetailed(bool val);
46 bool visualizationDetailed();
47#endif
48
49 RigidElement* getElement(int i){return m_elements[i];}
50 std::vector<RigidElement*> getElements(){return m_elements;}
51 RigidElement* getFirstElement(){return m_elements.front();}
52 RigidElement* getLastElement() {return m_elements.back();}
53 int getNumElements(){return (int)m_elements.size();}
54
55
56 double getLength(){return m_Length;}
57 double GammaN() {return m_base_coupling.GammaN;}
58 double GammaMx(){return m_base_coupling.GammaM.x();}
59 double GammaMy(){return m_base_coupling.GammaM.y();}
60 double GammaT() {return m_base_coupling.GammaM.z();}
61
62
63protected:
64 LineStructure(ConstraintSolver* solver);
65 virtual void Init(ConstraintSolver* solver, ISimObjectCreator* creator, LineSpec spec, std::string name);
66
67 double m_Length;
68 double m_elemLength;
70 std::vector<RigidElement*> m_elements;
71
72 RigidCoupling m_base_coupling;
73
74#ifdef FH_VISUALIZATION
75 bool m_visualizeNice;
76 C3DLine* m_line;
77 std::vector<Ogre::SceneNode*> m_Nodes;
78#endif
79
80};
81
82
83void ComputeInertiaMatrix(LineStructure::LineSpec& linespec, double mass_per_meter);
84
85}
86}
Definition: ConstraintSolver.h:31
Definition: JointConstraint.h:17
Definition: RigidElement.h:15
Definition: LineStructure.h:15
virtual void InitialConditionSetup(double *const states, const vec3 &P1, const vec3 &P2)
double m_elemDiameter
element length [m]
Definition: LineStructure.h:69
int getNumElements()
For use in project MarinSim. Otherwise commented out.
Definition: LineStructure.h:53
LineStructure(ConstraintSolver *solver, ISimObjectCreator *creator, LineSpec spec, string name)
RigidElement * getLastElement()
For use in project MarinSim. Otherwise commented out.
Definition: LineStructure.h:52
virtual void ComputeConstraints(const double T, const double *const X)
Definition: CollisionManager.h:6
Definition: JointConstraint.h:125
double Diameter
Total length of the line [m].
Definition: LineStructure.h:23
double Alpha
Regulator frequency coefficient; [s^-1].
Definition: LineStructure.h:21
double Beta
Number of discrete elements in the line.
Definition: LineStructure.h:20
double Inertia[6]
Bending stiffness around x, y and z axis [Nm].
Definition: LineStructure.h:26
vec3 EI
Axial stiffness [N].
Definition: LineStructure.h:25
double Length
Damping frequency coefficient; [s^-1].
Definition: LineStructure.h:22
double EA
line diameter;
Definition: LineStructure.h:24