Granular.jl

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

commit 55b6301591042d961a0592758304217d4afc3397
parent a7c5fd7da7e3faec43d02990cb295a366ce8b7d0
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Sun, 30 Apr 2017 09:56:52 -0400

add test of non-dimensional coordinates

Diffstat:
Msrc/grid.jl | 2+-
Mtest/grid.jl | 10++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/grid.jl b/src/grid.jl @@ -86,7 +86,7 @@ function getNonDimensionalCellCoordinates(ocean::Ocean, i::Int, j::Int, sw, se, ne, nw = getCellCornerCoordinates(ocean, i, j) x_tilde, y_tilde = conformalQuadrilateralCoordinates(sw, se, ne, nw, point) - return x_tilde, y_tilde + return [x_tilde, y_tilde] end export isPointInCell diff --git a/test/grid.jl b/test/grid.jl @@ -14,13 +14,23 @@ info("Testing area-determination methods") info("Testing area-based cell content determination") @test SeaIce.isPointInCell(ocean, 2, 2, [6.5, 53.5]) == true +@test SeaIce.getNonDimensionalCellCoordinates(ocean, 2, 2, [6.5, 53.5]) ≈ + [.5, .5] @test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.5]) == true +@test SeaIce.getNonDimensionalCellCoordinates(ocean, 2, 2, [6.1, 53.5]) ≈ + [.1, .5] @test SeaIce.isPointInCell(ocean, 2, 2, [6.0, 53.5]) == true +@test SeaIce.getNonDimensionalCellCoordinates(ocean, 2, 2, [6.0, 53.5]) ≈ + [.0, .5] @test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.7]) == true @test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.9]) == true @test SeaIce.isPointInCell(ocean, 2, 2, [6.1, 53.99999]) == true +@test SeaIce.getNonDimensionalCellCoordinates(ocean, 2, 2, [6.1, 53.99999]) ≈ + [.1, .99999] @test SeaIce.isPointInCell(ocean, 2, 2, [7.5, 53.5]) == false @test SeaIce.isPointInCell(ocean, 2, 2, [0.0, 53.5]) == false +x_tilde, _ = SeaIce.getNonDimensionalCellCoordinates(ocean, 2, 2, [0., 53.5]) +@test x_tilde < 0. info("Testing conformal mapping methods") @test SeaIce.conformalQuadrilateralCoordinates([0., 0.],