|
hydrobricks
|
#include <RiverNetwork.h>
Public Member Functions | |
| ModelResult | Initialize (SettingsBasin &basinSettings) |
| int | GetSubbasinCount () const |
| Subbasin * | GetSubbasin (size_t index) const |
| Subbasin * | GetSubbasinById (int id) const |
| Subbasin * | GetOutlet () const |
| const std::vector< Subbasin * > & | GetProcessingOrder () const |
| const std::vector< Subbasin * > & | GetUpstreamSubbasins (const Subbasin *subbasin) const |
| void | TransferInflow (Subbasin *subbasin, double timeStepInDays) |
| void | SetChannelRouting (const ChannelRoutingSettings &settings) |
| ModelResult | AssignFractions (SettingsBasin &basinSettings) |
| void | Reset () |
| void | SaveAsInitialState () |
| Reach * | GetReach (size_t index) const |
| HydroUnit * | GetHydroUnitById (int id) const |
| int | GetHydroUnitCount () const |
| vecInt | GetSubbasinIds () const |
| vecInt | GetSubbasinDownstreamIds () const |
| vecDouble | GetSubbasinLocalAreas () const |
| vecDouble | GetSubbasinDrainedAreas () const |
| double | GetTotalArea () const |
Protected Attributes | |
| std::vector< std::unique_ptr< Subbasin > > | _subbasins |
| std::unordered_map< int, Subbasin * > | _subbasinMap |
| std::unordered_map< int, HydroUnit * > | _hydroUnitMap |
| std::vector< Subbasin * > | _order |
| Subbasin * | _outlet = nullptr |
| std::vector< std::unique_ptr< Reach > > | _reaches |
| std::unordered_map< const Subbasin *, std::vector< Subbasin * > > | _upstream |
The river network: the tree of subbasins of a catchment. Each subbasin drains into at most one downstream subbasin; exactly one subbasin (the outlet) is terminal. A model without declared subbasins gets a network of one implicit subbasin holding every hydro unit.
The network owns the subbasins and their reaches, keeps the subbasins in processing order (upstream first) and knows the drained area at every outlet. Within a time step, the subbasins are processed in that order: before a subbasin is processed, the outlet volumes of its upstream neighbours (computed earlier in the same step) are routed through its reach and deposited as its inflow (TransferInflow).
|
nodiscard |
Assign the land cover fractions of every hydro unit from the basin settings.
| basinSettings | The basin settings. |
|
nodiscard |
Get a hydro unit by ID, searching every subbasin.
| id | The ID of the hydro unit. |
|
nodiscard |
Get the number of hydro units over all the subbasins.
|
inlinenodiscard |
Get the terminal subbasin (the catchment outlet).
|
inlinenodiscard |
Get the subbasins in processing order: every subbasin comes after all the subbasins draining into it.
|
nodiscard |
Get the reach of a subbasin by index, in declaration order.
| index | The index of the subbasin. |
|
nodiscard |
Get a subbasin by index, in declaration order.
| index | The index of the subbasin. |
|
nodiscard |
Get a subbasin by ID.
| id | The ID of the subbasin. |
|
inlinenodiscard |
Get the number of subbasins.
|
nodiscard |
Get the downstream subbasin IDs (0: the outlet), in declaration order.
|
nodiscard |
Get the areas drained at the subbasin outlets (own plus upstream) [m2], in declaration order.
|
nodiscard |
Get the subbasin IDs, in declaration order.
|
nodiscard |
Get the local areas of the subbasins (their own hydro units) [m2], in declaration order.
|
nodiscard |
Get the total area of the catchment [m2] (the area drained at the outlet).
|
nodiscard |
Get the subbasins draining directly into the given one.
| subbasin | The receiving subbasin. |
|
nodiscard |
Build the subbasins and their hydro units from the basin settings, then the processing order and the drained areas. Validates the network first.
| basinSettings | The basin settings. |
| void RiverNetwork::Reset | ( | ) |
Reset the reaches (the subbasins are reset by the model).
| void RiverNetwork::SaveAsInitialState | ( | ) |
Save the state of the reaches as the initial state restored by Reset().
| void RiverNetwork::SetChannelRouting | ( | const ChannelRoutingSettings & | settings | ) |
Set the channel routing scheme and parameters of every reach.
| settings | The channel routing settings of the model. |
| void RiverNetwork::TransferInflow | ( | Subbasin * | subbasin, |
| double | timeStepInDays ) |
Route the outlet volumes of the upstream subbasins through the reach of the given subbasin and set the result as its inflow for the current time step. Must be called before the subbasin is processed and after its upstream neighbours were.
| subbasin | The receiving subbasin. |
| timeStepInDays | The time step [days]. |