Free Electron
LinearSpringForce.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __mechanics_LinearSpringForce_h__
8 #define __mechanics_LinearSpringForce_h__
9 
10 #include "signal/signal.h"
11 #include "datatool/datatool.h"
12 #include "shape/shape.h"
13 #include "solve/solve.h"
14 #include "solve/SemiImplicit.h"
15 #include "mechanicsAS.h"
16 
17 namespace fe
18 {
19 namespace ext
20 {
21 
22 class FE_DL_EXPORT LinearSpringForce : public SemiImplicit::Force,
23  public CastableAs<LinearSpringForce>
24 {
25  public:
26  LinearSpringForce(sp<SemiImplicit> a_integrator);
27 virtual ~LinearSpringForce(void);
28 virtual void clear(void);
29 virtual void accumulate(void);
30 virtual bool validate(void);
31 
32 virtual void compile( sp<RecordGroup> rg_input,
33  std::vector<SemiImplicit::Particle> &a_particles,
34  SemiImplicit::CompileMatrix &a_compileMatrix);
35 
36 virtual void pairs( sp<RecordGroup> rg_input,
37  SemiImplicit::t_pairs &a_pairs);
38 
39  public:
40  class FE_DL_EXPORT Spring
41  {
42  public:
43  t_solve_real m_restlength;
44  t_solve_real m_stiffness;
45  t_solve_real m_damping;
46  t_solve_v3 *m_location[2];
47  //SpatialVector *m_prev_location[2];
48  //Real m_distance;
49  t_solve_real m_prev_distance;
50  t_solve_v3 *m_velocity[2];
51  t_solve_v3 *m_force[2];
52  t_solve_matrix *m_diagonal_dfdx[2];
53  t_solve_matrix *m_diagonal_dfdv[2];
54  t_solve_matrix *m_offdiagonal_dfdx;
55  t_solve_matrix *m_offdiagonal_dfdv;
56  unsigned int m_flags;
57  };
58 
59  hp<SemiImplicit> m_integrator;
60 
61  std::vector<Spring> m_springs;
62 
63  t_solve_real m_perturbation;
64 };
65 
66 } /* namespace */
67 } /* namespace */
68 
69 
70 #endif /* __mechanics_LinearSpringForce_h__ */
kernel
Definition: namespace.dox:3