Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log | Files | Refs | README | LICENSE

commit 816d2940705da93523d3b719dc8eea68a28c78cc
parent c5889a172d1134078e47e1df2556fb70d3713787
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Fri, 28 Apr 2017 14:47:16 -0400

check that contacts between fixed ice floes are not registered

Diffstat:
Msrc/contact_search.jl | 7++++++-
Mtest/contact-search-and-geometry.jl | 7+++++++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/contact_search.jl b/src/contact_search.jl @@ -36,7 +36,7 @@ end export findContactsAllToAll """ Perform an O(n^2) all-to-all contact search between all ice floes in the -`simulation` object. +`simulation` object. Contacts between fixed ice floes are ignored. """ function findContactsAllToAll!(simulation::Simulation) @@ -46,6 +46,11 @@ function findContactsAllToAll!(simulation::Simulation) for j = 1:length(simulation.ice_floes) if i < j + if simulation.ice_floes[i].fixed && + simulation.ice_floes[j].fixed + continue + end + # Inter-grain position vector and grain overlap position_ij = interIceFloePositionVector(simulation, i, j) overlap_ij = findOverlap(simulation, i, j, position_ij) diff --git a/test/contact-search-and-geometry.jl b/test/contact-search-and-geometry.jl @@ -37,6 +37,13 @@ SeaIce.findContacts!(sim) @test_throws ErrorException SeaIce.findContacts!(sim, method="") +sim = deepcopy(sim_copy) +sim.ice_floes[1].fixed = true +sim.ice_floes[2].fixed = true +SeaIce.findContacts!(sim) +@test 0 == length(sim.overlaps) +@test 0 == length(sim.contact_pairs) + info("Testing if interact(...) removes contacts correctly") sim = deepcopy(sim_copy)