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

Public Member Functions

void AddHydroUnit (int id, double area, double elevation=-9999, int subbasinId=1)
 
void AddSubbasin (int id, int downstreamId=0, const string &name="")
 
void AddSubbasinPropertyDouble (const string &name, double value, const string &unit="")
 
void AddSubbasinPropertyString (const string &name, const string &value)
 
void SelectSubbasin (int index)
 
ModelResult ValidateNetwork () const
 
void AddLandCover (const string &name, const string &type="", double fraction=1.0)
 
void AddHydroUnitPropertyDouble (const string &name, double value, const string &unit="")
 
void AddHydroUnitPropertyString (const string &name, const string &value)
 
void AddLateralConnection (int giverHydroUnitId, int receiverHydroUnitId, double fraction, const string &type="")
 
void Clear ()
 
void SelectUnit (int index)
 
bool Parse (const string &path)
 
HydroUnitSettings GetHydroUnitSettings (int index) const
 
const SubbasinSettings & GetSubbasinSettings (int index) const
 
const vector< SubbasinSettings > & GetSubbasins () const
 
int GetSubbasinCount () const
 
LandCoverSettings GetLandCoverSettings (int index) const
 
SurfaceComponentSettings GetSurfaceComponentSettings (int index) const
 
vector< LateralConnectionSettings > GetLateralConnections () const
 
int GetHydroUnitCount () const
 
int GetLandCoverCount () const
 
int GetSurfaceComponentCount () const
 
int GetLateralConnectionCount () const
 
double GetTotalArea () const
 

Member Function Documentation

◆ AddHydroUnit()

void SettingsBasin::AddHydroUnit ( int id,
double area,
double elevation = -9999,
int subbasinId = 1 )

Add a new hydro unit.

Parameters
idID of the hydro unit.
areaarea of the hydro unit.
elevationelevation of the hydro unit.
subbasinIdID of the subbasin the unit drains to (1 when no network is declared).

◆ AddHydroUnitPropertyDouble()

void SettingsBasin::AddHydroUnitPropertyDouble ( const string & name,
double value,
const string & unit = "" )

Add a numeric property to the selected hydro unit.

Parameters
namename of the property.
valuevalue of the property.
unitunit of the property.

◆ AddHydroUnitPropertyString()

void SettingsBasin::AddHydroUnitPropertyString ( const string & name,
const string & value )

Add a string property to the selected hydro unit.

Parameters
namename of the property.
valuevalue of the property.

◆ AddLandCover()

void SettingsBasin::AddLandCover ( const string & name,
const string & type = "",
double fraction = 1.0 )

Add a new land cover to the selected hydro unit.

Parameters
namename of the land cover.
typetype of the land cover.
fractionfraction of the land cover.

◆ AddLateralConnection()

void SettingsBasin::AddLateralConnection ( int giverHydroUnitId,
int receiverHydroUnitId,
double fraction,
const string & type = "" )

Add a lateral connection between two hydro units.

Parameters
giverHydroUnitIdID of the hydro unit giving the connection.
receiverHydroUnitIdID of the hydro unit receiving the connection.
fractionThe fraction of the flow that is transferred.
typeThe type of the lateral connection (optional). It is unused in the current implementation, but can be used for future extensions (for example, to differentiate between snow and groundwater).

◆ AddSubbasin()

void SettingsBasin::AddSubbasin ( int id,
int downstreamId = 0,
const string & name = "" )

Add a subbasin to the river network and select it for the following property additions.

Parameters
idID of the subbasin (> 0).
downstreamIdID of the downstream subbasin (0: terminal outlet).
namename of the subbasin (optional, e.g. the gauge name).

◆ AddSubbasinPropertyDouble()

void SettingsBasin::AddSubbasinPropertyDouble ( const string & name,
double value,
const string & unit = "" )

Add a numeric property to the selected subbasin (e.g. the reach length or slope).

Parameters
namename of the property.
valuevalue of the property.
unitunit of the property.

◆ AddSubbasinPropertyString()

void SettingsBasin::AddSubbasinPropertyString ( const string & name,
const string & value )

Add a string property to the selected subbasin.

Parameters
namename of the property.
valuevalue of the property.

◆ Clear()

void SettingsBasin::Clear ( )

Clear all hydro units.

◆ GetHydroUnitCount()

int SettingsBasin::GetHydroUnitCount ( ) const
inline

Get the number of hydro units.

Returns
number of hydro units.

◆ GetHydroUnitSettings()

HydroUnitSettings SettingsBasin::GetHydroUnitSettings ( int index) const
inline

Get hydro unit settings.

Parameters
indexindex of the hydro unit.
Returns
pointer to the selected hydro unit.

◆ GetLandCoverCount()

int SettingsBasin::GetLandCoverCount ( ) const
inline

Get the number of land covers for the selected hydro unit.

Returns
number of land covers.

◆ GetLandCoverSettings()

LandCoverSettings SettingsBasin::GetLandCoverSettings ( int index) const
inline

Get land cover settings for the selected hydro unit.

Parameters
indexindex of the land cover.
Returns
pointer to the selected land cover.

◆ GetLateralConnectionCount()

int SettingsBasin::GetLateralConnectionCount ( ) const
inline

Get the number of lateral connections.

Returns
number of lateral connections.

◆ GetLateralConnections()

vector< LateralConnectionSettings > SettingsBasin::GetLateralConnections ( ) const
inline

Get the lateral connections settings.

Returns
vector of lateral connection settings.

◆ GetSubbasinCount()

int SettingsBasin::GetSubbasinCount ( ) const
inline

Get the number of declared subbasins (0 when no network is declared).

Returns
number of subbasins.

◆ GetSubbasins()

const vector< SubbasinSettings > & SettingsBasin::GetSubbasins ( ) const
inline

Get the settings of all the declared subbasins (empty when no network is declared).

Returns
vector of subbasin settings.

◆ GetSubbasinSettings()

const SubbasinSettings & SettingsBasin::GetSubbasinSettings ( int index) const
inline

Get the settings of a subbasin.

Parameters
indexThe index of the subbasin.
Returns
the subbasin settings.

◆ GetSurfaceComponentCount()

int SettingsBasin::GetSurfaceComponentCount ( ) const
inline

Get the number of surface components for the selected hydro unit.

Returns
number of surface components.

◆ GetSurfaceComponentSettings()

SurfaceComponentSettings SettingsBasin::GetSurfaceComponentSettings ( int index) const
inline

Get surface component settings for the selected hydro unit.

Parameters
indexindex of the surface component.
Returns
pointer to the selected surface component.

◆ GetTotalArea()

double SettingsBasin::GetTotalArea ( ) const
nodiscard

Get the total area of the subbasin (all hydro units).

Returns
total area of the subbasin.

◆ Parse()

bool SettingsBasin::Parse ( const string & path)

Parse a NetCDF file to get the hydro unit settings.

Parameters
pathpath to the NetCDF file.
Returns
true if the file was parsed successfully.

◆ SelectSubbasin()

void SettingsBasin::SelectSubbasin ( int index)

Select a subbasin by index.

Parameters
indexindex of the subbasin.

◆ SelectUnit()

void SettingsBasin::SelectUnit ( int index)

Select a hydro unit.

Parameters
indexindex of the hydro unit to select.

◆ ValidateNetwork()

ModelResult SettingsBasin::ValidateNetwork ( ) const
nodiscard

Check the river network: unique subbasin IDs, one terminal outlet, no cycle, every hydro unit assigned to a declared subbasin and every subbasin holding at least one hydro unit. A model without declared subbasins is valid when all its units drain to subbasin 1 (the implicit single subbasin).

Returns
an empty result when valid, else the description of the first problem found.

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