tPut particle area into cell containing center - 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 342a88008ca72de30d15bd12570db7e180f928af
 (DIR) parent 48b16722c28c7ac9c9be58bb82f03d4fb94e804a
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Wed, 18 Jul 2018 16:14:36 -0400
       
       Put particle area into cell containing center
       
       Diffstat:
         M src/grid.jl                         |      28 ++++++++++++++++------------
       
       1 file changed, 16 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/src/grid.jl b/src/grid.jl
       t@@ -1095,26 +1095,30 @@ function findPorosity!(sim::Simulation, grid::Any; verbose::Bool=true)
                                r = sim.grains[i].areal_radius
                                A = grainHorizontalSurfaceArea(sim.grains[i])
        
       -                        if sw[1] <= p[1] - r &&
       -                            sw[2] <= p[2] - r &&
       -                            ne[1] >= p[1] + r &&
       -                            ne[2] >= p[2] + r
       +                        #= if sw[1] <= p[1] - r && =#
       +                        #=     sw[2] <= p[2] - r && =#
       +                        #=     ne[1] >= p[1] + r && =#
       +                        #=     ne[2] >= p[2] + r =#
       +                        if sw[1] <= p[1] &&
       +                            sw[2] <= p[2] &&
       +                            ne[1] >= p[1] &&
       +                            ne[2] >= p[2]
                                    # If particle is entirely contained within cell,
                                    # assuming a regular and orthogonal grid
                                    # TODO: Adjust coordinates with conformal mapping
                                    # for irregular grids.
                                    particle_area += A
        
       -                        elseif sw[1] >= p[1] + r ||
       -                            sw[2] >= p[2] + r ||
       -                            ne[1] <= p[1] - r ||
       -                            ne[2] <= p[2] - r
       -                            # particle does not intersect with cell [ix,iy]
       -                            continue
       +                        #= elseif sw[1] >= p[1] + r || =#
       +                        #=     sw[2] >= p[2] + r || =#
       +                        #=     ne[1] <= p[1] - r || =#
       +                        #=     ne[2] <= p[2] - r =#
       +                        #=     # particle does not intersect with cell [ix,iy] =#
       +                        #=     continue =#
        
        
       -                        else
       -                            continue
       +                        #= else =#
       +                        #=     continue =#
                                    # (likely) intersection between grid and grain
        
                                    # 1. There is an intersection if one of the cell