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

Public Member Functions

ModelResult Initialize (SettingsBasin &basinSettings)
 
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 ()
 
HydroUnitGetHydroUnit (size_t index) const
 
bool HasHydroUnits () const noexcept
 
HydroUnitGetHydroUnitById (int id) const
 
vecInt GetHydroUnitIds () const
 
vecDouble GetHydroUnitAreas () const
 
vecInt GetHydroUnitStructureIds () const
 
int GetBrickCount () const
 
int GetSplitterCount () const
 
BrickGetBrick (size_t index) const
 
bool HasBrick (std::string_view name) const
 
BrickGetBrick (std::string_view name) const
 
SplitterGetSplitter (size_t index) const
 
bool HasSplitter (std::string_view name) const
 
SplitterGetSplitter (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 GetArea () const
 

Protected Attributes

double _area
 
double _outletTotal
 
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
 

Member Function Documentation

◆ AddBrick()

void SubBasin::AddBrick ( std::unique_ptr< Brick > brick)

Add a brick to the sub basin.

Parameters
brickThe brick to add (ownership transferred).

◆ AddHydroUnit()

void SubBasin::AddHydroUnit ( std::unique_ptr< HydroUnit > unit)

Add a hydro unit to the sub-basin.

Parameters
unitThe hydro unit to add (ownership transferred).

◆ AddInputConnector()

void SubBasin::AddInputConnector ( Connector * connector)

Add an input connector to the sub-basin.

Parameters
connectorThe input connector to add.

◆ AddOutputConnector()

void SubBasin::AddOutputConnector ( Connector * connector)

Add an output connector to the sub-basin.

Parameters
connectorThe output connector to add.

◆ AddSplitter()

void SubBasin::AddSplitter ( std::unique_ptr< Splitter > splitter)

Add a splitter to the sub-basin.

Parameters
splitterThe splitter to add (ownership transferred).

◆ AssignFractions()

ModelResult SubBasin::AssignFractions ( SettingsBasin & basinSettings)
nodiscard

Assign the fractions of the basin.

Parameters
basinSettingsThe settings to assign the fractions with.
Returns
True if the assignment was successful, false otherwise.

◆ AttachOutletFlux()

void SubBasin::AttachOutletFlux ( Flux * pFlux)

Attach an outlet flux to the sub-basin.

Parameters
pFluxThe outlet flux to attach.

◆ BuildBasin()

void SubBasin::BuildBasin ( SettingsBasin & basinSettings)

Build the basin with the given settings.

Parameters
basinSettingsThe settings to build the basin with.

◆ ComputeOutletDischarge()

bool SubBasin::ComputeOutletDischarge ( )
nodiscard

Compute the outlet discharge for the sub-basin.

Returns
True if the computation was successful, false otherwise.

◆ GetArea()

double SubBasin::GetArea ( ) const
inlinenodiscard

Get the area of the sub-basin.

Returns
The area of the sub-basin in square meters.

◆ GetBrick() [1/2]

Brick * SubBasin::GetBrick ( size_t index) const
nodiscard

Get a brick by its index.

Parameters
indexThe index of the brick to get.
Returns
The brick at the specified index.

◆ GetBrick() [2/2]

Brick * SubBasin::GetBrick ( std::string_view name) const
nodiscard

Get a brick by its name.

Parameters
nameThe name of the brick to get.
Returns
The brick with the specified name.

◆ GetBrickCount()

int SubBasin::GetBrickCount ( ) const
nodiscard

Get the number of bricks in the sub-basin.

Returns
The number of bricks.

◆ GetHydroUnit()

HydroUnit * SubBasin::GetHydroUnit ( size_t index) const
nodiscard

Get a hydro unit by its index.

Parameters
indexThe index of the hydro unit to get.
Returns
The hydro unit at the specified index.

◆ GetHydroUnitAreas()

vecDouble SubBasin::GetHydroUnitAreas ( ) const
nodiscard

Get the areas of all hydro units in the sub-basin.

Returns
A vector of hydro unit areas.

◆ GetHydroUnitById()

HydroUnit * SubBasin::GetHydroUnitById ( int id) const
nodiscard

Get a hydro unit by its ID.

Parameters
idThe ID of the hydro unit to get.
Returns
The hydro unit with the specified ID.

◆ GetHydroUnitCount()

int SubBasin::GetHydroUnitCount ( ) const
nodiscard

Get the number of hydro units in the sub-basin.

Returns
The number of hydro units.

◆ GetHydroUnitIds()

vecInt SubBasin::GetHydroUnitIds ( ) const
nodiscard

Get the IDs of all hydro units in the sub-basin.

Returns
A vector of hydro unit IDs.

◆ GetHydroUnitStructureIds()

vecInt SubBasin::GetHydroUnitStructureIds ( ) const
nodiscard

Get the model-structure ID of each hydro unit in the sub-basin.

Returns
A vector of hydro unit structure IDs (defaults to 1).

◆ GetSplitter() [1/2]

Splitter * SubBasin::GetSplitter ( size_t index) const
nodiscard

Get a splitter by its index.

Parameters
indexThe index of the splitter to get.
Returns
The splitter at the specified index.

◆ GetSplitter() [2/2]

Splitter * SubBasin::GetSplitter ( std::string_view name) const
nodiscard

Get a splitter by its name.

Parameters
nameThe name of the splitter to get.
Returns
The splitter with the specified name.

◆ GetSplitterCount()

int SubBasin::GetSplitterCount ( ) const
nodiscard

Get the number of splitters in the sub-basin.

Returns
The number of splitters.

◆ GetValuePointer()

double * SubBasin::GetValuePointer ( std::string_view name)

Get the value pointer for a specific variable.

Parameters
nameThe name of the variable to get the pointer for.
Returns
A pointer to the variable's value.

◆ HasBrick()

bool SubBasin::HasBrick ( std::string_view name) const
nodiscard

Check if the sub-basin has a brick with a specific name.

Parameters
nameThe name of the brick to check for.
Returns
True if the sub-basin has the brick, false otherwise.

◆ HasHydroUnits()

bool SubBasin::HasHydroUnits ( ) const
inlinenodiscardnoexcept

Check if the sub-basin has any hydro units.

Returns
True if the sub-basin has hydro units, false otherwise.

◆ HasIncomingFlow()

bool SubBasin::HasIncomingFlow ( ) const
nodiscard

Check if the sub-basin has an incoming flow.

Returns
True if the sub-basin has an incoming flow, false otherwise.

◆ HasSplitter()

bool SubBasin::HasSplitter ( std::string_view name) const
nodiscard

Check if the sub-basin has a splitter with a specific name.

Parameters
nameThe name of the splitter to check for.
Returns
True if the sub-basin has the splitter, false otherwise.

◆ Initialize()

ModelResult SubBasin::Initialize ( SettingsBasin & basinSettings)
nodiscard

Initialize the sub-basin with the given settings.

Parameters
basinSettingsThe settings to initialize the sub-basin with.
Returns
True if the initialization was successful, false otherwise.

◆ IsValid()

bool SubBasin::IsValid ( bool checkProcesses = true) const
nodiscard

Check if the sub basin is correctly defined.

Returns
True if everything is correctly defined, false otherwise.

◆ ReserveBricks()

void SubBasin::ReserveBricks ( size_t count)
inline

Reserve space for a number of bricks in the sub-basin.

Parameters
countThe number of bricks to reserve space for.

◆ ReserveHydroUnits()

void SubBasin::ReserveHydroUnits ( size_t count)
inline

Reserve space for a number of hydro units in the sub-basin.

Parameters
countThe number of hydro units to reserve space for.

◆ ReserveInputConnectors()

void SubBasin::ReserveInputConnectors ( size_t count)
inline

Reserve space for a number of input connectors in the sub-basin.

Parameters
countThe number of input connectors to reserve space for.

◆ ReserveLateralConnectionsForUnits()

void SubBasin::ReserveLateralConnectionsForUnits ( SettingsBasin & basinSettings)

Reserve space for a number of lateral connections for hydro units in the sub-basin.

Parameters
basinSettingsThe settings to reserve the lateral connections with.

◆ ReserveOutletFluxes()

void SubBasin::ReserveOutletFluxes ( size_t count)
inline

Reserve space for a number of outlet fluxes in the sub-basin.

Parameters
countThe number of outlet fluxes to reserve space for.

◆ ReserveOutputConnectors()

void SubBasin::ReserveOutputConnectors ( size_t count)
inline

Reserve space for a number of output connectors in the sub-basin.

Parameters
countThe number of output connectors to reserve space for.

◆ ReserveSplitters()

void SubBasin::ReserveSplitters ( size_t count)
inline

Reserve space for a number of splitters in the sub-basin.

Parameters
countThe number of splitters to reserve space for.

◆ Reset()

void SubBasin::Reset ( )

Reset the sub-basin to its initial state.

◆ ResetForcingUpdates()

void SubBasin::ResetForcingUpdates ( )

Reset all dynamic forcing overrides in all hydro units.

◆ RestoreInitialAreaFractions()

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).

◆ SaveAsInitialState()

void SubBasin::SaveAsInitialState ( )

Save the current state of the sub-basin as the initial state.

◆ Validate()

void SubBasin::Validate ( ) const

Validate that the sub basin is correctly defined. Throws an exception if validation fails.

Exceptions
ModelConfigErrorif validation fails.

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