Granular.jl

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

commit 4bcc81aef0e6cc34a85a2b8a2632130e22ba48d1
parent 94e04429fe360c2a5fec893229973145516381de
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Wed, 26 Apr 2017 16:03:17 -0400

add corner-order check

Diffstat:
Msrc/grid.jl | 4++++
Mtest/grid.jl | 6++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/grid.jl b/src/grid.jl @@ -146,6 +146,10 @@ function conformalQuadrilateralCoordinates(A::Array{float, 1}, C::Array{float, 1}, D::Array{float, 1}, p::Array{float, 1}) + + if !(A[1] < B[1] && B[2] < C[2] && C[1] > D[1]) + error("corner coordinates are not passed in the correct order") + end alpha = B[1] - A[1] delta = B[2] - A[2] beta = D[1] - A[1] diff --git a/test/grid.jl b/test/grid.jl @@ -38,6 +38,12 @@ info("Testing conformal mapping methods") [5., 3.], [0., 3.], [7.5,-1.5]) ≈ [1.5,-0.5] +@test_throws ErrorException SeaIce.conformalQuadrilateralCoordinates([0., 0.], + [5., 3.], + [0., 3.], + [5., 0.], + [7.5,-1.5]) + info("Checking cell content using conformal mapping methods") @test SeaIce.isPointInCell(ocean, 2, 2, [6.4, 53.4], method="Conformal") == true @test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.5], method="Conformal") == true