tadd outline of sorting algorithm - 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 30af4dcf37a6204bd9d127ffce9a0763a5d9d1b0
 (DIR) parent ddb4611e8e4fa17f9e08d61a5b5d16ce25bf00e1
 (HTM) Author: Anders Damsgaard <andersd@riseup.net>
       Date:   Tue, 25 Apr 2017 16:20:01 -0400
       
       add outline of sorting algorithm
       
       Diffstat:
         M src/datatypes.jl                    |       4 ++++
         M src/grid.jl                         |      31 +++++++++++++++++++++++++++++++
       
       2 files changed, 35 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/src/datatypes.jl b/src/datatypes.jl
       t@@ -44,6 +44,8 @@ type IceFloeCylindrical
            contact_dynamic_friction::float
        
            pressure::float
       +
       +    #ocean_grid_pos::Array{Int, 2}
        end
        
        # Type for gathering data from ice floe objects into single arrays
       t@@ -151,6 +153,8 @@ type Ocean
            v::Array{Float64, 4}
            h::Array{Float64, 4}
            e::Array{Float64, 4}
       +
       +    #ice_floe_list::Array{Array{Int, 1}, 2}
        end
        
        # Top-level simulation type
 (DIR) diff --git a/src/grid.jl b/src/grid.jl
       t@@ -30,3 +30,34 @@ function bilinearInterpolation(field::Array{Float64, 4},
                error("grid type not understood.")
            end
        end
       +
       +"""
       +Find ice-floe positions in ocean grid, based on their center positions.
       +"""
       +function sortIceFloesInOceanGrid!(simulation::Simulation, verbose=true)
       +
       +    # TODO: initialize empty ice_floe_list before appending to list
       +
       +    for idx in 1:length(simulation.ice_floes)
       +
       +        for i in 1:size(simulation.ocean.xh)[1]
       +            for j in 1:size(simulation.ocean.xh)[2]
       +
       +                if cellContainsIceFloe(simulation.ocean, i, j,
       +                                       simulation.ice_floes[idx])
       +
       +                    # add cell to ice floe
       +                    simulation.ice_floes[idx].ocean_grid_pos = [i, j]
       +
       +                    # add ice floe to cell
       +                    push!(simulation.ice_floe_list[i, j], idx)
       +                end
       +            end
       +        end
       +    end
       +end
       +
       +function cellContainsIceFloe(ocean::Ocean, i::Int, j::Int, 
       +                             icefloe::IceFloeCylindrical)
       +
       +end