Granular.jl

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

commit 1fde58d53f2bd69257193f4ee649d6233945dbe9
parent 8d60b817d9aea49606c4825e1bded8bb301abf97
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Mon,  1 May 2017 12:56:02 -0400

add tests using grid-based cell search

Diffstat:
Mtest/contact-search-and-geometry.jl | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/test/contact-search-and-geometry.jl b/test/contact-search-and-geometry.jl @@ -55,3 +55,32 @@ SeaIce.findContacts!(sim) @test 1 == length(sim.contact_pairs) @test_approx_eq [1, 2] sim.contact_pairs[1] @test_approx_eq [-2., 0.] sim.overlaps[1] + +info("Testing findContactsOceanGrid(...)") +sim = deepcopy(sim_copy) +sim.ocean = SeaIce.createRegularOceanGrid([4, 4, 2], [80., 80., 2.]) +SeaIce.sortIceFloesInOceanGrid!(sim) +SeaIce.findContactsOceanGrid!(sim) + +@test 1 == length(sim.overlaps) +@test 1 == length(sim.contact_pairs) +@test_approx_eq [1, 2] sim.contact_pairs[1] +@test_approx_eq [-2., 0.] sim.overlaps[1] + +info("Testing findContacts(...)") +sim = deepcopy(sim_copy) +sim.ocean = SeaIce.createRegularOceanGrid([4, 4, 2], [80., 80., 2.]) +SeaIce.sortIceFloesInOceanGrid!(sim) +SeaIce.findContacts!(sim) + +@test 1 == length(sim.overlaps) +@test 1 == length(sim.contact_pairs) +@test_approx_eq [1, 2] sim.contact_pairs[1] +@test_approx_eq [-2., 0.] sim.overlaps[1] + +@test 1 == length(sim.overlaps) +@test 1 == length(sim.contact_pairs) +@test_approx_eq [1, 2] sim.contact_pairs[1] +@test_approx_eq [-2., 0.] sim.overlaps[1] + +@test_throws ErrorException SeaIce.findContacts!(sim, method="")