commit c1c29f47904a825bc479ff4c0081661b4b6f54e7
parent a46a20781d6ca83220f5e8d12c6c59bf25dd3928
Author: Anders Damsgaard <andersd@riseup.net>
Date: Mon, 19 Feb 2018 20:19:11 -0500
Add further contact search tests
Diffstat:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/test/contact-search-and-geometry.jl b/test/contact-search-and-geometry.jl
@@ -268,8 +268,9 @@ for i=1:9
@test sim.grains[i].n_contacts == 0
end
+info("Test contact search in regular square grid (all to all)")
sim = Granular.createSimulation()
-nx = 16; ny = 15
+nx = 60; ny = 50
Granular.regularPacking!(sim, [nx, ny], 1., 1., padding_factor=0,
tiling="square")
for grain in sim.grains
@@ -284,4 +285,22 @@ for j=2:(ny-1)
end
end
+info("Test contact search in regular square grid (sorting grid)")
+sim = Granular.createSimulation()
+nx = 60; ny = 50
+Granular.regularPacking!(sim, [nx, ny], 1., 1., padding_factor=0,
+ tiling="square")
+Granular.fitGridToGrains!(sim, sim.ocean, verbose=false)
+for grain in sim.grains
+ grain.contact_radius *= 1.00001
+end
+Granular.findContacts!(sim)
+#Granular.plotGrains(sim)
+for j=2:(ny-1)
+ for i=2:(nx-1)
+ idx = (j - 1)*nx + i
+ @test sim.grains[idx].n_contacts == 4
+ end
+end
+