tfix force sum, disable debug output - slidergrid - grid of elastic sliders on … | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit be3b8690a7ce4f86cc57cc4d3b31a8941b9a76fb | |
parent ffce95073aabb7c780a4ccb40e3c16cc8cb35a1e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 22 Mar 2016 13:22:47 -0700 | |
fix force sum, disable debug output | |
Diffstat: | |
M slidergrid/debug.h | 7 ++++++- | |
M slidergrid/main.c | 4 ++-- | |
M slidergrid/slider.c | 13 ++++--------- | |
3 files changed, 12 insertions(+), 12 deletions(-) | |
--- | |
diff --git a/slidergrid/debug.h b/slidergrid/debug.h | |
t@@ -7,6 +7,11 @@ | |
// if defined, verbose information to stdout will be shown before the slider | |
// integration | |
-#define DEBUG_SLIDER_FORCE_TORQUE_AND_NEIGHBORS | |
+//#define DEBUG_SLIDER_FORCE_TORQUE_AND_NEIGHBORS | |
+ | |
+ | |
+// if defined, verbose information to stdout will be shown about the individua… | |
+// components of the sum of forces | |
+//#define DEBUG_SLIDER_FORCE_COMPONENTS | |
#endif | |
diff --git a/slidergrid/main.c b/slidergrid/main.c | |
t@@ -138,7 +138,7 @@ int main(int argc, char** argv) | |
#ifdef DEBUG_SLIDER_FORCE_TORQUE_AND_NEIGHBORS | |
int j; | |
- printf("Slider %d: F = %f %f %f, T = %f %f %f, neighbors = ", | |
+ printf("main.c: Slider %d: F = %f %f %f, T = %f %f %f, contacts = … | |
i, | |
sim.sliders[i].force.x, | |
sim.sliders[i].force.y, | |
t@@ -149,7 +149,7 @@ int main(int argc, char** argv) | |
for (j=0; j<MAX_NEIGHBORS; j++) | |
if (sim.sliders[i].neighbors[j] >= 0) | |
printf("%d ", sim.sliders[i].neighbors[j]); | |
- puts(""); | |
+ puts("\n"); | |
#endif | |
// update slider kinematics | |
diff --git a/slidergrid/slider.c b/slidergrid/slider.c | |
t@@ -176,12 +176,13 @@ void slider_interaction(slider* s1, const slider s2, con… | |
s1->neighbor_relative_distance_velocity[idx_neighbor]); | |
// bond-parallel force, counteracts tension and compression | |
- const Float3 f_n = multiply_float3(f_n_elastic, f_n_viscous); | |
+ const Float3 f_n = 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); | |
- printf("f_n = %f %f %f, f_n_elastic = %f %f %f, f_n_viscous = %f %f %f\n", | |
+#ifdef DEBUG_SLIDER_FORCE_COMPONENTS | |
+ printf("slider_interaction: f_n = %f %f %f, f_n_elastic = %f %f %f, f_n_vi… | |
f_n.x, | |
f_n.y, | |
f_n.z, | |
t@@ -191,6 +192,7 @@ void slider_interaction(slider* s1, const slider s2, const… | |
f_n_viscous.x, | |
f_n_viscous.y, | |
f_n_viscous.z); | |
+#endif | |
} | |
t@@ -216,13 +218,6 @@ void slider_neighbor_interaction( | |
slider_interaction( | |
s, sliders[s->neighbors[idx_neighbor]], idx_neighbor); | |
- printf("F = %f %f %f, T = %f %f %f\n\n", | |
- s->force.x, | |
- s->force.y, | |
- s->force.z, | |
- s->torque.x, | |
- s->torque.y, | |
- s->torque.z); | |
} | |
} | |
} |