tadd ocean-grid index to ice floe, and dynamic arrays of ocean-grid cell contents - 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 31de9b70fb547efc6a8f7cf9e203eb82c4824947
 (DIR) parent ff688fa1e18376559fde3c84cd89bd8d46d754bd
 (HTM) Author: Anders Damsgaard <andersd@riseup.net>
       Date:   Sat, 29 Apr 2017 22:35:49 -0400
       
       add ocean-grid index to ice floe, and dynamic arrays of ocean-grid cell contents
       
       Diffstat:
         M src/datatypes.jl                    |       6 ++++--
         M src/grid.jl                         |       1 +
         M src/icefloe.jl                      |       7 +++++--
         M src/ocean.jl                        |      10 +++++++---
       
       4 files changed, 17 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/src/datatypes.jl b/src/datatypes.jl
       t@@ -45,7 +45,7 @@ type IceFloeCylindrical
        
            pressure::float
        
       -    #ocean_grid_pos::Array{Int, 2}
       +    ocean_grid_pos::Array{Int, 1}
        end
        
        # Type for gathering data from ice floe objects into single arrays
       t@@ -130,6 +130,8 @@ https://mom6.readthedocs.io/en/latest/api/generated/pages/Horizontal_indexing.ht
            placement in `[xh, yh, zl, time]`.
        * `e::Array{Float64, Int}`: interface height relative to mean sea level [m],  
            dimensions correspond to placement in `[xh, yh, zi, time]`.
       +* `ice_floe_list::Array{Float64, Int}`: interface height relative to mean sea 
       +    level [m],  dimensions correspond to placement in `[xh, yh, zi, time]`.
        =#
        type Ocean
            input_file::Any
       t@@ -154,7 +156,7 @@ type Ocean
            h::Array{Float64, 4}
            e::Array{Float64, 4}
        
       -    #ice_floe_list::Array{Array{Int, 1}, 2}
       +    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@@ -35,6 +35,7 @@ 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
       +    simulation.ocean.ice_floe_list
        
            for idx in 1:length(simulation.ice_floes)
        
 (DIR) diff --git a/src/icefloe.jl b/src/icefloe.jl
       t@@ -28,7 +28,8 @@ function addIceFloeCylindrical(simulation::Simulation,
                                       pressure::float = 0.,
                                       fixed::Bool = false,
                                       rotating::Bool = true,
       -                               verbose::Bool = true)
       +                               verbose::Bool = true,
       +                               ocean_grid_pos::Array{Int, 1} = [0, 0])
        
            # Check input values
            if length(lin_pos) != 2
       t@@ -97,7 +98,9 @@ function addIceFloeCylindrical(simulation::Simulation,
                                         contact_static_friction,
                                         contact_dynamic_friction,
        
       -                                 pressure
       +                                 pressure,
       +
       +                                 ocean_grid_pos
                                        )
        
            # Overwrite previous placeholder values
 (DIR) diff --git a/src/ocean.jl b/src/ocean.jl
       t@@ -16,7 +16,8 @@ function createEmptyOcean()
                         zeros(1,1,1,1),
                         zeros(1,1,1,1),
                         zeros(1,1,1,1),
       -                 zeros(1,1,1,1))
       +                 zeros(1,1,1,1),
       +                 Array{Array{Int, 1}}(1, 1))
        end
        
        export readOceanNetCDF
       t@@ -57,7 +58,9 @@ function readOceanNetCDF(velocity_file::String, grid_file::String)
                          u,
                          v,
                          h,
       -                  e)
       +                  e,
       +                  Array{Array{Int, 1}}(size(xh, 1), size(xh, 2))
       +                 )
            return ocean
        end
        
       t@@ -236,7 +239,8 @@ function createRegularOceanGrid(n::Array{Int, 1},
                         xq, yq,
                         xh, yh,
                         zl, zi,
       -                 u, v, h, e)
       +                 u, v, h, e,
       +                 Array{Array{Int, 1}}(size(xh, 1), size(xh, 2)))
        end
        
        export addOceanDrag!