tadd test of contact search and geometry - Granular.jl - Julia package for gran… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e900407487fced84a9c86eafc42301d8fa3e555f | |
parent 349a925a01e18af30a53fc4b41f8c28775255a65 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 20 Apr 2017 10:04:34 -0400 | |
add test of contact search and geometry | |
Diffstat: | |
M test/collision-2floes-normal.jl | 4 ++-- | |
A test/contact-search-and-geometry.jl | 28 ++++++++++++++++++++++++++++ | |
M test/runtests.jl | 1 + | |
3 files changed, 31 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/test/collision-2floes-normal.jl b/test/collision-2floes-normal.jl | |
t@@ -9,8 +9,8 @@ import SeaIce | |
info("#### $(basename(@__FILE__)) ####") | |
sim = SeaIce.createSimulation(id="test") | |
-SeaIce.addIceFloeCylindrical(sim, [ 0., 0.], 10., 1.) | |
-SeaIce.addIceFloeCylindrical(sim, [20., 0.], 10., 1.) | |
+SeaIce.addIceFloeCylindrical(sim, [ 0., 0.], 10., 1., verbose=false) | |
+SeaIce.addIceFloeCylindrical(sim, [20., 0.], 10., 1., verbose=false) | |
sim.ice_floes[1].lin_vel[1] = 1. | |
E_kin_lin_init = SeaIce.totalIceFloeKineticTranslationalEnergy(sim) | |
diff --git a/test/contact-search-and-geometry.jl b/test/contact-search-and-geom… | |
t@@ -0,0 +1,28 @@ | |
+#!/usr/bin/env julia | |
+ | |
+# Check the contact search and geometry of a two-particle interaction | |
+import Base.Test | |
+import SeaIce | |
+ | |
+info("#### $(basename(@__FILE__)) ####") | |
+ | |
+info("Testing interIceFloePositionVector(...) and findOverlap(...)") | |
+sim = SeaIce.createSimulation(id="test") | |
+SeaIce.addIceFloeCylindrical(sim, [ 0., 0.], 10., 1., verbose=false) | |
+SeaIce.addIceFloeCylindrical(sim, [18., 0.], 10., 1., verbose=false) | |
+ | |
+position_ij = SeaIce.interIceFloePositionVector(sim, 1, 2) | |
+overlap_ij = SeaIce.findOverlap(sim, 1, 2, position_ij) | |
+ | |
+Base.Test.@test_approx_eq [18., 0.] position_ij | |
+Base.Test.@test_approx_eq -2. overlap_ij | |
+ | |
+ | |
+info("Testing findContactsAllToAll(...)") | |
+sim_copy = deepcopy(sim) | |
+SeaIce.findContactsAllToAll!(sim) | |
+ | |
+Base.Test.@test 1 == length(sim.overlaps) | |
+Base.Test.@test 1 == length(sim.contact_pairs) | |
+Base.Test.@test_approx_eq [1, 2] sim.contact_pairs[1] | |
+Base.Test.@test_approx_eq [-2., 0.] sim.overlaps[1] | |
diff --git a/test/runtests.jl b/test/runtests.jl | |
t@@ -1,4 +1,5 @@ | |
using SeaIce | |
using Base.Test | |
+include("contact-search-and-geometry.jl") | |
include("collision-2floes-normal.jl") |