hydrobricks
Loading...
Searching...
No Matches
ModelBuilder Class Reference

Public Member Functions

 ModelBuilder (Subbasin *subbasin, TimeMachine *timer, Logger *logger, int subbasinIndex=0, int unitOffset=0)
 
void AssignHydroUnitStructures (SettingsModel &modelSettings, SettingsBasin &basinSettings)
 
void AssignSubbasinStructure (SettingsModel &modelSettings, SettingsBasin &basinSettings)
 
void BuildModelStructure (SettingsModel &modelSettings)
 
void UpdateSubbasinParameters (SettingsModel &modelSettings)
 
void UpdateHydroUnitsParameters (SettingsModel &modelSettings)
 
void ConnectLoggerToValues (SettingsModel &modelSettings)
 

Constructor & Destructor Documentation

◆ ModelBuilder()

ModelBuilder::ModelBuilder ( Subbasin * subbasin,
TimeMachine * timer,
Logger * logger,
int subbasinIndex = 0,
int unitOffset = 0 )
Parameters
subbasinThe subbasin to build.
timerThe model timer.
loggerThe model logger.
subbasinIndexThe index of the subbasin in the logger (processing order).
unitOffsetThe index of the subbasin's first hydro unit in the logger.

Member Function Documentation

◆ AssignHydroUnitStructures()

void ModelBuilder::AssignHydroUnitStructures ( SettingsModel & modelSettings,
SettingsBasin & basinSettings )

Assign each hydro unit the structure variant whose land-cover set matches the unit's present land covers (fraction > 0). No-op when a single structure is defined. Must run before BuildModelStructure so units build their variant.

Parameters
modelSettingsthe model settings (defines the structure variants).
basinSettingsthe basin settings (per-unit land covers and fractions).

◆ AssignSubbasinStructure()

void ModelBuilder::AssignSubbasinStructure ( SettingsModel & modelSettings,
SettingsBasin & basinSettings )

Assign the subbasin the structure variant matching the land covers present in its hydro units (the union over the units), with the same rule as the units. The subbasin-level components (e.g. shared glacier reservoirs) are then built from that variant only.

Parameters
modelSettingsThe model settings.
basinSettingsThe basin settings.

◆ BuildModelStructure()

void ModelBuilder::BuildModelStructure ( SettingsModel & modelSettings)

Build the full model structure. The subbasin components are built from the primary structure (1), then each hydro unit builds the structure variant it was assigned by AssignHydroUnitStructures.

Parameters
modelSettingsthe model settings (defines the structure variants).

◆ ConnectLoggerToValues()

void ModelBuilder::ConnectLoggerToValues ( SettingsModel & modelSettings)

Connect the logger entries to the corresponding value pointers in the subbasin and hydro unit components, so logged items are recorded during the simulation.

Parameters
modelSettingsthe model settings (defines the items to log).

◆ UpdateHydroUnitsParameters()

void ModelBuilder::UpdateHydroUnitsParameters ( SettingsModel & modelSettings)

Update the parameters of every hydro unit's bricks, processes and splitters without rebuilding the model. Each unit's assigned structure variant is selected so the updated values match the components that unit was built with.

Parameters
modelSettingsthe model settings holding the updated parameter values.

◆ UpdateSubbasinParameters()

void ModelBuilder::UpdateSubbasinParameters ( SettingsModel & modelSettings)

Update the parameters of the subbasin bricks, their processes and the subbasin splitters from the (primary) structure settings, without rebuilding the model.

Parameters
modelSettingsthe model settings holding the updated parameter values.

The documentation for this class was generated from the following files: