tadd corner-order check - Granular.jl - Julia package for granular dynamics sim… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 4bcc81aef0e6cc34a85a2b8a2632130e22ba48d1 | |
parent 94e04429fe360c2a5fec893229973145516381de | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 26 Apr 2017 16:03:17 -0400 | |
add corner-order check | |
Diffstat: | |
M src/grid.jl | 4 ++++ | |
M test/grid.jl | 6 ++++++ | |
2 files changed, 10 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/grid.jl b/src/grid.jl | |
t@@ -146,6 +146,10 @@ function conformalQuadrilateralCoordinates(A::Array{float… | |
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 | |
t@@ -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") == tr… | |
@test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.5], method="Conformal") == tr… |