|
hydrobricks
|
Public Member Functions | |
| ModelResult | Initialize (SettingsBasin &basinSettings) |
| HydroUnit * | AddHydroUnitFromSettings (HydroUnitSettings &unitSettings) |
| void | SetNetworkProperties (const SubbasinSettings &subbasinSettings) |
| void | SetId (int id) |
| int | GetId () const |
| void | SetDownstreamId (int id) |
| int | GetDownstreamId () const |
| bool | IsTerminal () const |
| void | SetName (const string &name) |
| const string & | GetName () const |
| void | SetStructureId (int structureId) |
| int | GetStructureId () const |
| double | GetLocalArea () const |
| void | SetDrainedArea (double area) |
| double | GetDrainedArea () const |
| void | SetHasUpstream (bool value) |
| bool | HasUpstream () const |
| void | SetReach (Reach *reach) |
| Reach * | GetReach () const |
| void | SetInflowVolume (double volume) |
| double | GetInflowVolume () const |
| double | GetLocalOutlet () const |
| double | GetOutletVolume () const |
| double | GetOutletDischarge () const |
| bool | HasHydroUnit (int id) const |
| bool | HasProperty (std::string_view name) const |
| double | GetPropertyDouble (std::string_view name, std::string_view unit="") const |
| string | GetPropertyString (std::string_view name) const |
| void | BuildBasin (SettingsBasin &basinSettings) |
| void | ReserveHydroUnits (size_t count) |
| void | ReserveBricks (size_t count) |
| void | ReserveSplitters (size_t count) |
| void | ReserveInputConnectors (size_t count) |
| void | ReserveOutputConnectors (size_t count) |
| void | ReserveOutletFluxes (size_t count) |
| void | ReserveLateralConnectionsForUnits (SettingsBasin &basinSettings) |
| ModelResult | AssignFractions (SettingsBasin &basinSettings) |
| void | Reset () |
| void | SaveAsInitialState () |
| void | RestoreInitialAreaFractions () |
| bool | IsValid (bool checkProcesses=true) const |
| void | Validate () const |
| void | AddBrick (std::unique_ptr< Brick > brick) |
| void | AddSplitter (std::unique_ptr< Splitter > splitter) |
| void | AddHydroUnit (std::unique_ptr< HydroUnit > unit) |
| int | GetHydroUnitCount () const |
| void | ResetForcingUpdates () |
| HydroUnit * | GetHydroUnit (size_t index) const |
| bool | HasHydroUnits () const noexcept |
| HydroUnit * | GetHydroUnitById (int id) const |
| vecInt | GetHydroUnitIds () const |
| vecDouble | GetHydroUnitAreas () const |
| vecInt | GetHydroUnitStructureIds () const |
| int | GetBrickCount () const |
| int | GetSplitterCount () const |
| Brick * | GetBrick (size_t index) const |
| bool | HasBrick (std::string_view name) const |
| Brick * | GetBrick (std::string_view name) const |
| Splitter * | GetSplitter (size_t index) const |
| bool | HasSplitter (std::string_view name) const |
| Splitter * | GetSplitter (std::string_view name) const |
| bool | HasIncomingFlow () const |
| void | AddInputConnector (Connector *connector) |
| void | AddOutputConnector (Connector *connector) |
| void | AttachOutletFlux (Flux *pFlux) |
| double * | GetValuePointer (std::string_view name) |
| bool | ComputeOutletDischarge (double timeStepInDays) |
| double | GetArea () const |
Protected Attributes | |
| int | _id = 1 |
| int | _downstreamId = 0 |
| string | _name |
| int | _structureId = 1 |
| double | _area |
| double | _drainedArea = 0 |
| bool | _hasUpstream = false |
| Reach * | _reach = nullptr |
| double | _outletTotal |
| double | _inflowVolume = 0 |
| double | _outletVolume = 0 |
| double | _outletDischarge = 0 |
| double | _reachInflow = 0 |
| double | _reachOutflow = 0 |
| double | _reachStorage = 0 |
| std::vector< std::unique_ptr< HydroUnitProperty > > | _properties |
| std::vector< std::unique_ptr< Brick > > | _bricks |
| std::unordered_map< string, Brick * > | _brickMap |
| std::vector< std::unique_ptr< Splitter > > | _splitters |
| std::unordered_map< string, Splitter * > | _splitterMap |
| std::vector< std::unique_ptr< HydroUnit > > | _hydroUnits |
| std::unordered_map< int, HydroUnit * > | _hydroUnitMap |
| std::vector< Connector * > | _inConnectors |
| std::vector< Connector * > | _outConnectors |
| std::vector< Flux * > | _outletFluxes |
| void Subbasin::AddBrick | ( | std::unique_ptr< Brick > | brick | ) |
Add a brick to the subbasin.
| brick | The brick to add (ownership transferred). |
| void Subbasin::AddHydroUnit | ( | std::unique_ptr< HydroUnit > | unit | ) |
Add a hydro unit to the subbasin.
| unit | The hydro unit to add (ownership transferred). |
| HydroUnit * Subbasin::AddHydroUnitFromSettings | ( | HydroUnitSettings & | unitSettings | ) |
Create a hydro unit from its settings and add it to the subbasin.
| unitSettings | The settings of the hydro unit. |
| void Subbasin::AddInputConnector | ( | Connector * | connector | ) |
Add an input connector to the subbasin.
| connector | The input connector to add. |
| void Subbasin::AddOutputConnector | ( | Connector * | connector | ) |
Add an output connector to the subbasin.
| connector | The output connector to add. |
| void Subbasin::AddSplitter | ( | std::unique_ptr< Splitter > | splitter | ) |
Add a splitter to the subbasin.
| splitter | The splitter to add (ownership transferred). |
|
nodiscard |
Assign the fractions of the basin.
| basinSettings | The settings to assign the fractions with. |
| void Subbasin::AttachOutletFlux | ( | Flux * | pFlux | ) |
Attach an outlet flux to the subbasin.
| pFlux | The outlet flux to attach. |
| void Subbasin::BuildBasin | ( | SettingsBasin & | basinSettings | ) |
Build the basin with the given settings.
| basinSettings | The settings to build the basin with. |
|
nodiscard |
Compute the outlet discharge of the current time step: the subbasin's own runoff, routed through half of its reach when the channel routing does so, plus the volume already routed from upstream.
| timeStepInDays | The time step [days]. |
|
inlinenodiscard |
Get the area of the subbasin.
|
nodiscard |
Get a brick by its index.
| index | The index of the brick to get. |
|
nodiscard |
Get a brick by its name.
| name | The name of the brick to get. |
|
nodiscard |
Get the number of bricks in the subbasin.
|
inlinenodiscard |
Get the ID of the downstream subbasin (0: terminal outlet of the network).
|
inlinenodiscard |
Get the area drained at the subbasin outlet [m2]: the local area plus the area of every upstream subbasin. Set by the river network; equals the local area for a single subbasin.
|
nodiscard |
Get a hydro unit by its index.
| index | The index of the hydro unit to get. |
|
nodiscard |
Get the areas of all hydro units in the subbasin.
|
nodiscard |
Get a hydro unit by its ID.
| id | The ID of the hydro unit to get. |
|
nodiscard |
Get the number of hydro units in the subbasin.
|
nodiscard |
Get the IDs of all hydro units in the subbasin.
|
nodiscard |
Get the model-structure ID of each hydro unit in the subbasin.
|
inlinenodiscard |
Get the area of the subbasin's own hydro units [m2] (same as GetArea()).
|
inlinenodiscard |
Get the subbasin's own runoff of the current time step [mm over the local area].
|
inlinenodiscard |
Get the outlet discharge of the current time step [mm over the drained area]. Equals the local outlet total for a subbasin without upstream inflow.
|
inlinenodiscard |
Get the volume leaving the subbasin outlet in the current time step [m3]: the local runoff plus the routed upstream inflow.
|
nodiscard |
Get a numeric property of the subbasin (e.g. the reach length).
| name | The property name. |
| unit | The unit to convert the value to (optional). |
|
nodiscard |
Get a string property of the subbasin.
| name | The property name. |
|
nodiscard |
Get a splitter by its index.
| index | The index of the splitter to get. |
|
nodiscard |
Get a splitter by its name.
| name | The name of the splitter to get. |
|
nodiscard |
Get the number of splitters in the subbasin.
| double * Subbasin::GetValuePointer | ( | std::string_view | name | ) |
Get the value pointer for a specific variable.
| name | The name of the variable to get the pointer for. |
|
nodiscard |
Check if the subbasin has a brick with a specific name.
| name | The name of the brick to check for. |
|
inlinenodiscard |
Check if a hydro unit with the given ID belongs to this subbasin.
| id | The hydro unit ID. |
|
inlinenodiscardnoexcept |
Check if the subbasin has any hydro units.
|
nodiscard |
Check if the subbasin has an incoming flow.
|
nodiscard |
Check if the subbasin has a property with the given name.
| name | The property name. |
|
nodiscard |
Check if the subbasin has a splitter with a specific name.
| name | The name of the splitter to check for. |
|
nodiscard |
Initialize the subbasin with the given settings.
| basinSettings | The settings to initialize the subbasin with. |
|
nodiscard |
Check if the subbasin is correctly defined.
|
inline |
Reserve space for a number of bricks in the subbasin.
| count | The number of bricks to reserve space for. |
|
inline |
Reserve space for a number of hydro units in the subbasin.
| count | The number of hydro units to reserve space for. |
|
inline |
Reserve space for a number of input connectors in the subbasin.
| count | The number of input connectors to reserve space for. |
| void Subbasin::ReserveLateralConnectionsForUnits | ( | SettingsBasin & | basinSettings | ) |
Reserve space for a number of lateral connections for hydro units in the subbasin.
| basinSettings | The settings to reserve the lateral connections with. |
|
inline |
Reserve space for a number of outlet fluxes in the subbasin.
| count | The number of outlet fluxes to reserve space for. |
|
inline |
Reserve space for a number of output connectors in the subbasin.
| count | The number of output connectors to reserve space for. |
|
inline |
Reserve space for a number of splitters in the subbasin.
| count | The number of splitters to reserve space for. |
| void Subbasin::Reset | ( | ) |
Reset the subbasin to its initial state.
| void Subbasin::ResetForcingUpdates | ( | ) |
Reset all dynamic forcing overrides in all hydro units.
| void Subbasin::RestoreInitialAreaFractions | ( | ) |
Restore the area fractions of all land covers to their initial extents without touching the stored contents (used after the spin-up phase).
| void Subbasin::SaveAsInitialState | ( | ) |
Save the current state of the subbasin as the initial state.
|
inline |
Declare whether other subbasins drain into this one (set by the river network). With an upstream inflow, the outlet discharge is expressed over the drained area instead of the local one.
|
inline |
Set the volume routed from the upstream subbasins for the current time step [m3].
| volume | The routed inflow volume. |
| void Subbasin::SetNetworkProperties | ( | const SubbasinSettings & | subbasinSettings | ) |
Set the network properties of the subbasin (ID, downstream link, name, properties).
| subbasinSettings | The settings of the subbasin. |
|
inline |
Set the model-structure variant used to build the subbasin-level components (bricks, splitters).
| structureId | The structure ID (1 = the primary structure). |
| void Subbasin::Validate | ( | ) | const |
Validate that the subbasin is correctly defined. Throws an exception if validation fails.
| ModelConfigError | if validation fails. |