Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add include pairs logic when polygons in point files #374

Merged
merged 2 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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