alimaye / sun-fan-delta-model

GNU General Public License v3.0
0 stars 0 forks source link

Channel coding #58

Closed amoodie closed 2 years ago

amoodie commented 2 years ago

summary

Recode channel network storage to 8xLxW logical arrays. This has two advantages: (1) it's much faster than storing the network in cell arrays, and (2) it's easy to implement the max number of branches as a parameter.

details

The new method is similar to the way we have handled searching for neighbors in the past, which is looking at a list of NW-N-NE-E-SE-S-SW-W neighbors. Now, we use these as the fixed indices into a set of 8xLxW arrays. Instead of using a list in a cell array for flowsTo, we use an identity matrix like approach, where a connection between cells is marked by a 1. In practice, we store as logical arrays, because these datatypes are 1-byte per cell, (so very efficient) and allow direct slicing (no conversion to bool necessary).

Some important new arrays are (created in makeGrids.m):

This PR also fixed the bugs in checkNeighborsChannelsCrossover that were allowing crossover channels to form again.

branchLimit change results

branchLimit result water basin result dry basin
2 image image
3 image
8 image image

WRITE UP RESULTS NEEDED HERE Did this fix #53?

todo:

closes #57