Free Electron
TorsionSpring.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2014 Free Electron Organization
2  Any use of this software requires a license. */
3 
4 /** @file */
5 
6 #ifndef __driveline_TorsionSpring_h__
7 #define __driveline_TorsionSpring_h__
8 
9 #include "datatool/datatool.h"
10 #include "shape/shape.h"
11 #include "solve/solve.h"
12 #include "solve/SemiImplicit.h"
13 
14 namespace fe
15 {
16 namespace ext
17 {
18 
19 class FE_DL_EXPORT TorsionSpring : public DrivelineItem,
20  public CastableAs<TorsionSpring>
21 {
22  public:
23  TorsionSpring(sp<SemiImplicit1D> a_integrator);
24 virtual ~TorsionSpring(void);
25 virtual void accumulate(void);
26 virtual bool validate(void);
27 
28 virtual void compile(sp<RecordGroup> rg_input,
29  std::vector<SemiImplicit1D::Particle> &a_particles,
30  SemiImplicit1D::CompileMatrix &a_compileMatrix);
31 
32 virtual void pairs(sp<RecordGroup> rg_input,
33  SemiImplicit1D::t_pairs &a_pairs);
34 
35 virtual void reconfigure(void);
36 
37  public:
38  class FE_DL_EXPORT Spring
39  {
40  public:
41  t_solve_real m_restlength;
42  t_solve_real m_stiffness;
43  t_solve_real m_damping;
44  t_solve_real *m_location[2];
45  t_solve_real *m_ratio[2];
46  t_solve_real m_prev_distance;
47  t_solve_real *m_velocity[2];
48  t_solve_real *m_force[2];
49  t_solve_real *m_diagonal_dfdx[2];
50  t_solve_real *m_diagonal_dfdv[2];
51  t_solve_real *m_offdiagonal_dfdx;
52  t_solve_real *m_offdiagonal_dfdv;
53  unsigned int m_flags;
54  Record m_r_parent;
55  sp< SemiImplicit1D::t_pair> m_spPair;
56  };
57 
58  Spring *spring(const String &a_name);
59 
60  hp<SemiImplicit1D> m_integrator;
61 
62  std::vector<Spring> m_springs;
63  std::map<String, Spring *> m_springmap;
64 
65  t_solve_real m_perturbation;
66 
67 AsGearTrain m_asGearTrain;
68 };
69 
70 } /* namespace ext */
71 } /* namespace fe */
72 
73 #endif /* __driveline_TorsionSpring_h__ */
kernel
Definition: namespace.dox:3