Marine systems simulation
TrawlCableConstraintSets.h
1#ifndef TRAWLCABLE_CONSTRAINT_SETS_H
2#define TRAWLCABLE_CONSTRAINT_SETS_H
3#include "CEnvironment.h"
4#include "CollisionManager.h"
5#include "JointConstraint.h"
6#include "ThreadPool.h"
7
8namespace CoRiBoDynamics{
9
11public:
13 double AlphaN;
14 double BetaN;
15 double GammaN;
16 Quat AlphaM;
17 Quat BetaM;
18 Quat GammaM;
19 double elementLength;
20 vector<int> elements;
21 };
22
24 size_t AddCableSegment(const CableProperties& cable_properties);
26 virtual void ComputeConstraints(const double T, const double * const X);
27
28 vec3 GetBallJointCouplingForce(int i);
29
30protected:
31 class CableSegmentTask: public ThreadPool::Task{
32 public:
33 CableSegmentTask(int ID, TrawlCableJointConstraint* master, RigidCoupling& data, std::vector<int> elements/*, int start, int end*/):Task(ID){
34 m_master = master;
35 m_CouplingData = data;
36 m_elements = elements;
37 }
38
39 void SetStates(double T, const double* X){
40 m_T = T;
41 m_X = X;
42 }
43
44 void ExecuteTask(){
45 for(int i = 0; i < m_elements.size()-1; ++i){
46 m_CouplingData.elementA = m_elements[i];
47 m_CouplingData.elementB = m_elements[i+1];
48 m_master->ComputeRigidCoupling(m_CouplingData);
49 }
50 }
51
52 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
53 protected:
54 double m_T;
55 const double* m_X;
56 RigidCoupling m_CouplingData;
57 std::vector<int> m_elements;
59 };
60
61 std::vector<CableSegmentTask*> m_CableSegmentTask;
62 //ThreadPool::ThreadManager* m_ThreadManager;
63 CoreBoundThreadPool *m_ThreadManager;
64 int m_ThreadManagerGroupID;
65
66 std::vector<vec3> m_BallJointForces;
67 //vec3 TrawlCableComputeBallJointCoupling( BallJointCoupling& Constraint, const double * const X );
68};
69
71public:
73 double elementLength;
74 double elementRadius;
75 double elementContactStiffness;
76 double frictionCoefficient;
77 double contactDamping;
78 std::vector<int> elements;
79 };
80
81 TrawlCableCollisionManager(ConstraintSolver* solver, double timeConstant);
82 void AddCableSegment(const CableCollisionManagerProperties& properties);
83 void AddMainCableSegment(const CableCollisionManagerProperties& properties);
84
85 double getFrequencyCoefficient() {
86 return m_timeConstant;
87 }
88
89 void setStartTimeCollision(double time) {
90 m_startTimeCollision = time;
91 }
92
94 int ia;
95 int ib;
96 double la;
97 double lb;
99 vec3 Fn;
100 };
101 std::vector<ElementContact>* GetContactPoints();
102
103protected:
104 double m_startTimeCollision;
105 void ComputeConstraints(const double T, const double * const X);
106 struct CableSegment {int start; int end; double elementLength; int firstElementInSegment; int lastElementInSegment;};
107 std::vector<CableSegment> m_CableSegments;
108
109 std::vector<ElementContact> m_ContactPoints;
110 void CollisionTest( InternalObject* objectA, InternalObject* objectB , const double * const X, ElementContact& contact);
111
112public:
113
114};
115
117public:
119 vector<int> elements;
120 double cableRadius;
121 double elementLength;
122 double elementMass;
123 double elementDisplacementVolume;
124 };
125 struct TrawlDoor {
126 double length;
127 double width;
128 double DoorMass;
129 double WeightMass;
130 double displacementVolume;
131 int DoorIndex;
132 int WeightIndex;
133 //vec3 HydroCenter;
134 };
135
136 struct ClumpWeight {
137 double length;
138 double radius;
139 double Mass;
140 int Index;
141 };
142
143 EnvironmentForces(ConstraintSolver* solver, double timeConstant/*, CableSegment Cable*/);
144 void AddNewCableSegment(CableSegment cable);
145 void ComputeConstraints(const double T, const double * const X);
146 void AddTrawlDoor(TrawlDoor Door);
147 void AddClumpWeight(ClumpWeight Weight);
148 void setEnvironmentPointer(CEnvironment* environment);
149protected:
150 std::vector<CableSegment> m_Cables;
151 std::vector<TrawlDoor> m_TrawlDoors;
152 std::vector<ClumpWeight> m_ClumpWeights;
153
154 double m_timeConstant;
155 CEnvironment* m_environment;
156};
157
158}
159
160#endif
Definition: CEnvironment.h:10
Definition: CollisionManager.h:122
Definition: CollisionManager.h:37
Definition: ConstraintSet.h:24
Definition: ConstraintSolver.h:31
Definition: AsynchronousTask.h:15
Definition: TrawlCableConstraintSets.h:116
void ComputeConstraints(const double T, const double *const X)
Definition: JointConstraint.h:17
Definition: TrawlCableConstraintSets.h:70
void ComputeConstraints(const double T, const double *const X)
Definition: TrawlCableConstraintSets.h:31
Definition: TrawlCableConstraintSets.h:10
virtual void ComputeConstraints(const double T, const double *const X)
Definition: CollisionManager.h:6
Definition: TrawlCableConstraintSets.h:118
Definition: TrawlCableConstraintSets.h:136
Definition: TrawlCableConstraintSets.h:125
Definition: JointConstraint.h:125
Definition: TrawlCableConstraintSets.h:106
Definition: TrawlCableConstraintSets.h:93
double MainSegmentPosition
contact point on element B
Definition: TrawlCableConstraintSets.h:98
double la
index of element B
Definition: TrawlCableConstraintSets.h:96
int ib
index of element A
Definition: TrawlCableConstraintSets.h:95
double lb
contact point on element A
Definition: TrawlCableConstraintSets.h:97
Definition: TrawlCableConstraintSets.h:12