tonly register contacts for enabled grains - granular - granular dynamics simulation (HTM) git clone git://src.adamsgaard.dk/granular (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit b60ee39cf043b8660bf185e351259f9186c4c331 (DIR) parent 6bfe4343c4a35003808fb1b3bdf94480a7c7d216 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 21 Apr 2021 10:32:39 +0200 only register contacts for enabled grains Diffstat: M simulation.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) --- (DIR) diff --git a/simulation.c b/simulation.c t@@ -121,10 +121,13 @@ sim_check_add_contact(struct simulation *sim, size_t i, size_t j) overlap = euclidean_norm(centerdist, 3) - (sim->grains[i].radius + sim->grains[j].radius); - grain_register_contact(&sim->grains[i], j, i, centerdist, overlap); - grain_register_contact(&sim->grains[j], i, j, centerdistinv, overlap); + if (sim->grains[i].enabled) + grain_register_contact(&sim->grains[i], j, i, centerdist, overlap); + if (sim->grains[j].enabled) + grain_register_contact(&sim->grains[j], i, j, centerdistinv, overlap); } +/* TODO: add grid sorting */ void sim_detect_contacts(struct simulation *sim) { t@@ -137,12 +140,24 @@ sim_detect_contacts(struct simulation *sim) } void +sim_resolve_interactions(struct simulation *sim) +{ + size_t i; + int ic; + + for (i = 0; i < sim->ng; i++) + for (ic = 0; ic < MAXCONTACTS; ic++) + if (sim->grains[i].contacts[ic].active) + continue; +} + +void sim_step_time(struct simulation *sim) { size_t i; sim_detect_contacts(sim); - /* sim_resolve_interactions(sim); */ + sim_resolve_interactions(sim); for (i = 0; i < sim->ng; i++) grain_temporal_integration(&sim->grains[i], sim->dt);