tremove unused function, initialize force and torque to 0 during initialization… | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 126cdf9bc281c64712cc4cdb5febe0b2f649b456 | |
parent c6e2a96799b3fc1b5c926bace6763524480d5417 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 22 Mar 2016 15:57:53 -0700 | |
remove unused function, initialize force and torque to 0 during initialization | |
Diffstat: | |
M slidergrid/slider.c | 29 ++++++++++++++--------------- | |
M test.c | 1 + | |
2 files changed, 15 insertions(+), 15 deletions(-) | |
--- | |
diff --git a/slidergrid/slider.c b/slidergrid/slider.c | |
t@@ -9,14 +9,6 @@ void print_slider_position(slider s) | |
printf("%f\t%f\t%f\n", s.pos.x, s.pos.y, s.pos.z); | |
} | |
-slider create_slider() | |
-{ | |
- slider s; | |
- | |
- | |
- return s; | |
-} | |
- | |
void initialize_slider_values(slider* s) | |
{ | |
s->pos_future = zeroes_float3(); | |
t@@ -61,6 +53,10 @@ void project_slider_position(slider* s, Float dt, long int … | |
s->angpos.x + s->angvel.x*dt + 0.5*s->angacc.x*dt*dt, | |
s->angpos.y + s->angvel.y*dt + 0.5*s->angacc.y*dt*dt, | |
s->angpos.z + s->angvel.z*dt + 0.5*s->angacc.z*dt*dt); | |
+ | |
+ // reset sum of forces and torques on slider | |
+ s->force = zeroes_float3(); | |
+ s->torque = zeroes_float3(); | |
} | |
/* Explicit temporal integration scheme based on three-term Taylor expansion. | |
t@@ -210,7 +206,8 @@ void slider_interaction(slider* s1, const slider s2, const… | |
s1->neighbor_relative_distance_velocity[idx_neighbor]); | |
// bond-parallel force, counteracts tension and compression | |
- const Float3 f_n = add_float3(f_n_elastic, f_n_viscous); | |
+ const Float3 f_n = multiply_scalar_float3(-1.0, | |
+ add_float3(f_n_elastic, f_n_viscous)); | |
// add bond-parallel force to sum of forces on slider | |
s1->force = add_float3(s1->force, f_n); | |
t@@ -242,9 +239,12 @@ void slider_neighbor_interaction( | |
for (idx_neighbor=0; idx_neighbor<MAX_NEIGHBORS; idx_neighbor++) { | |
// reset sum of forces and torques on slider | |
- s->force = make_float3(0., 0., 0.); | |
- s->torque = make_float3(0., 0., 0.); | |
- //s->mass = 1.0; | |
+ /*s->force.x = 0.; | |
+ s->force.y = 0.; | |
+ s->force.z = 0.; | |
+ s->torque.x = 0.; | |
+ s->torque.y = 0.; | |
+ s->torque.z = 0.;*/ | |
if (s->neighbors[idx_neighbor] != -1) { | |
t@@ -262,9 +262,8 @@ void slider_neighbor_interaction( | |
slider_interaction( | |
s, sliders[s->neighbors[idx_neighbor]], idx_neighbor); | |
- s->force = make_float3(123, 456, 789); | |
- printf("s.force = %f %f %f\n", | |
- s->force.x, s->force.y, s->force.z); | |
+ /*printf("s.force = %f %f %f\n", | |
+ s->force.x, s->force.y, s->force.z);*/ | |
} | |
} | |
} | |
diff --git a/test.c b/test.c | |
t@@ -31,6 +31,7 @@ simulation setup_simulation() | |
sim.sliders[i].mass = 1.0e3; | |
sim.sliders[i].moment_of_inertia = 1.0e3; | |
sim.sliders[i].bond_parallel_stiffness = 1.0e5; | |
+ //sim.sliders[i].bond_parallel_viscosity = 1.0e2; | |
} | |
sim.sliders[0].vel.x = 1.0; |