tClamp interpolation values for better performance with regular grids - Granular.jl - Julia package for granular dynamics simulation
 (HTM) git clone git://src.adamsgaard.dk/Granular.jl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 4cb1c336f00a3cb7613e7ad2efb5a5de5e3cbc16
 (DIR) parent a7fa502a0cabd43a48bc28050cde84c0616e792d
 (HTM) Author: Anders Damsgaard <andersd@riseup.net>
       Date:   Wed,  3 Jan 2018 15:09:17 -0500
       
       Clamp interpolation values for better performance with regular grids
       
       Diffstat:
         M src/atmosphere.jl                   |      12 ++++--------
         M src/ocean.jl                        |       9 ++-------
       
       2 files changed, 6 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/src/atmosphere.jl b/src/atmosphere.jl
       t@@ -174,18 +174,14 @@ function addAtmosphereDrag!(simulation::Simulation)
                                                                    atmosphere,
                                                                    i, j,
                                                                    grain.lin_pos)
       -        if x_tilde < 0. || x_tilde > 1. || y_tilde < 0. || y_tilde > 1.
       -            warn("""
       -                 relative coordinates outside bounds ($(x_tilde), $(y_tilde)),
       -                 pos = $(grain.lin_pos) at i,j = $(i), $(j).
       -
       -                 """)
       -        end
       +        x_tilde = clamp(x_tilde, 0., 1.)
       +        y_tilde = clamp(y_tilde, 0., 1.)
        
                bilinearInterpolation!(uv_interp, u, v, x_tilde, y_tilde, i, j, k, 1)
                applyAtmosphereDragToGrain!(grain, uv_interp[1], uv_interp[2])
                applyAtmosphereVorticityToGrain!(grain,
       -                                      curl(simulation.atmosphere, x_tilde, y_tilde,
       +                                      curl(simulation.atmosphere,
       +                                           x_tilde, y_tilde,
                                                   i, j, k, 1, sw, se, ne, nw))
            end
            nothing
 (DIR) diff --git a/src/ocean.jl b/src/ocean.jl
       t@@ -289,13 +289,8 @@ function addOceanDrag!(simulation::Simulation)
                x_tilde, y_tilde = getNonDimensionalCellCoordinates(simulation.ocean,
                                                                    i, j,
                                                                    grain.lin_pos)
       -        if x_tilde < 0. || x_tilde > 1. || y_tilde < 0. || y_tilde > 1.
       -            warn("""
       -                 relative coordinates outside bounds ($(x_tilde), $(y_tilde)),
       -                 pos = $(grain.lin_pos) at i,j = $(i), $(j).
       -
       -                 """)
       -        end
       +        x_tilde = clamp(x_tilde, 0., 1.)
       +        y_tilde = clamp(y_tilde, 0., 1.)
        
                bilinearInterpolation!(uv_interp, u, v, x_tilde, y_tilde, i, j, k, 1)
                applyOceanDragToGrain!(grain, uv_interp[1], uv_interp[2])