7 #ifndef __tire_ParticleMountSystem_h__ 8 #define __tire_ParticleMountSystem_h__ 35 void initialize(
void) {}
36 virtual void compile(
const t_note_id &a_note_id)
38 sp<Scope> spScope = m_rg_dataset->scope();
40 if(!spScope.isValid()) {
return; }
42 enforce<AsTire,AsTireLive>(m_rg_dataset);
44 m_asPoint.bind(spScope);
45 m_asTireLive.bind(spScope);
46 m_asMount.bind(spScope);
50 RecordDictionary<AsTire> rd_tires(m_rg_dataset);
52 std::vector<Record> mounts;
53 m_asMount.filter(mounts, m_rg_dataset);
55 for(
unsigned int i_mount = 0; i_mount < mounts.size(); i_mount++)
57 Record &r_mount = mounts[i_mount];
59 mount.m_r_parent = r_mount;
60 mount.m_r_p0 = m_asMount.p0(r_mount);
61 mount.m_r_p1 = m_asMount.p1(r_mount);
62 mount.m_r_p2 = m_asMount.p2(r_mount);
63 mount.m_r_tire = rd_tires[m_asMount.tire(r_mount)];
64 if( mount.m_r_p0.isValid() &&
65 mount.m_r_p1.isValid() &&
66 mount.m_r_p2.isValid() &&
67 mount.m_r_tire.isValid() &&
68 m_asPoint.check(mount.m_r_p0) &&
69 m_asPoint.check(mount.m_r_p1) &&
70 m_asPoint.check(mount.m_r_p2) &&
71 m_asTireLive.check(mount.m_r_tire))
76 setIdentity(relative);
78 bool frame_made = makeFrame(frame,
79 m_asPoint.location(mount.m_r_p0),
80 m_asPoint.location(mount.m_r_p1),
81 m_asPoint.location(mount.m_r_p2),
84 invert(mount.m_inv_R, frame);
86 translate(relative, m_asMount.location(r_mount));
87 rotate(relative, m_asMount.inclination(r_mount),
93 mount.m_inv_R = relative * mount.m_inv_R;
95 m_mounts.push_back(mount);
102 for(
unsigned int i_mount = 0; i_mount < m_mounts.size(); i_mount++)
107 WeakRecord &r_tire = m_mounts[i_mount].m_r_tire;
108 WeakRecord &r_mount = m_mounts[i_mount].m_r_parent;
112 setIdentity(relative);
113 bool frame_made = makeFrame(frame,
114 m_asPoint.location(r_p0),
115 m_asPoint.location(r_p1),
116 m_asPoint.location(r_p2),
117 m_mounts[i_mount].m_inv_R);
119 m_asTireLive.transform(r_tire) = frame;
120 invert(m_asMount.transform_inv(r_mount),
121 m_asTireLive.transform(r_tire));
123 t_moa_v3 tire_space_p0_v = rotateVector<3, t_moa_real>
124 (m_asMount.transform_inv(r_mount),
125 m_asPoint.velocity(r_p0));
130 m_asTireLive.velocity(r_tire) = vel;
137 void accumulate(
void)
139 for(
unsigned int i_mount = 0; i_mount < m_mounts.size(); i_mount++)
144 WeakRecord &r_tire = m_mounts[i_mount].m_r_tire;
146 t_moa_xform tire_xform = m_asTireLive.transform(r_tire);
148 t_moa_v3 rig_space_F = rotateVector<3, t_moa_real>
149 (tire_xform, m_asTireLive.force(r_tire));
150 t_moa_v3 rig_space_M = rotateVector<3, t_moa_real>
151 (tire_xform, m_asTireLive.moment(r_tire));
153 t_moa_v3 rig_space_P = tire_xform.translation();
155 applyFMToPoints(rig_space_F, rig_space_M, rig_space_P,
156 m_asPoint, r_p0, r_p1, r_p2);
160 std::vector<Mount> m_mounts;
163 AsParticlesMount m_asMount;
virtual void compile(const t_note_id &a_note_id)
Compile internal structure for dataset.
Definition: ParticleMountSystem.h:36
Tire.
Definition: tireAS.h:36
kernel
Definition: namespace.dox:3
force application point
Definition: shapeAS.h:42
Matrix< 4, 4, T > & invert(Matrix< 4, 4, T > &a_inverted, const Matrix< 4, 4, T > &a_matrix)
4x4 full matrix inversion
Definition: Matrix.h:1033
Time Stepping System.
Definition: Stepper.h:15
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Tire to Particles Connection.
Definition: ParticleMountSystem.h:18
void step(t_moa_real a_dt)
Move system forward in time by a timestep.
Definition: ParticleMountSystem.h:100
Run Time Single Contact Tire Model.
Definition: tireAS.h:49
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17