-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbsystem.h
61 lines (50 loc) · 1.24 KB
/
mbsystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef MBSYSTEM_H
#define MBSYSTEM_H
#include "caams.hpp"
#include "body.h"
#include "constraint.h"
#include "force_element.h"
#include <vector>
class SolverParameters
{
public:
caams::matrix A;
caams::matrix x;
caams::matrix y_lhs;
caams::matrix y_rhs;
SolverParameters(long N_eqn):
A(N_eqn,N_eqn,caams::zeros),
x(N_eqn,1),
y_lhs(N_eqn,1,caams::zeros),
y_rhs(N_eqn,1,caams::zeros){};
~SolverParameters(void){}
};
class System
{
public:
std::vector<Body*> bodies;
std::vector<Constraint*> constraints;
std::vector<ForceElement*> forces;
long N_eqn;
long p_index;
long B_index;
SolverParameters *sp;
System(void);
~System(void);
void AddBody(Body *body);
void AddConstraint(Constraint *constraint);
void AddForce(ForceElement *force);
void InitializeSolver(void);
void rkSolve(void);
void rkPhase1State(double dt);
void rkPhase2State(double dt);
void rkPhase3State(double dt);
void rkPhase4State(double dt);
void rkPhase1Integrate(double dt);
void rkPhase2Integrate(double dt);
void rkPhase3Integrate(double dt);
void rkPhase4Integrate(double dt);
void Integrate(double dt);
void Draw(void);
};
#endif