Skip to content

Commit

Permalink
Merge pull request #374 from Circuitscape/RA/polyinclude
Browse files Browse the repository at this point in the history
add include pairs logic when polygons in point files
  • Loading branch information
ranjanan authored Dec 29, 2022
2 parents 604aea4 + 45f842a commit 339db4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ end
function IncludeExcludePairs(V)
IncludeExcludePairs(:undef, V[], Matrix{V}(undef,0,0))
end
Base.isempty(x::IncludeExcludePairs) = isempty(x.include_pairs)

struct NetworkData{T,V} <: Data
coords::Tuple{Vector{V},Vector{V},Vector{T}}
Expand Down
7 changes: 7 additions & 0 deletions src/raster/pairwise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,17 @@ function _pt_file_polygons_path(rasterdata::RasterData{T,V},
# construct new graph
# solve for two points
# end


# Data
gmap = rasterdata.cellmap
polymap = rasterdata.polymap
points_rc = rasterdata.points_rc
avg_res = flags.avg_res
four_neighbors = flags.four_neighbors
included_pairs = rasterdata.included_pairs
exclude_pairs = isempty(included_pairs) ? Vector{Tuple{V,V}}() :
generate_exclude_pairs(points_rc, included_pairs)

# Cumulative maps
cum = initialize_cum_maps(gmap, flags.outputflags.write_max_cur_maps)
Expand All @@ -105,6 +109,9 @@ function _pt_file_polygons_path(rasterdata::RasterData{T,V},
pt2 = pts[j]
csinfo("Solving pair $k of $n", cfg["suppress_messages"] in TRUELIST)
k += 1
if (pt1,pt2) in exclude_pairs || (pt2, pt1) in exclude_pairs
continue
end
graphdata = compute_graph_data_polygons(rasterdata, flags, pt1, pt2, cum, cfg)
pairwise_resistance = single_ground_all_pairs(graphdata, flags, cfg, false)
resistances[i,j] = resistances[j,i] = pairwise_resistance[2,3]
Expand Down

0 comments on commit 339db4d

Please sign in to comment.