hydrobricks
Loading...
Searching...
No Matches
Process Class Referenceabstract
Inheritance diagram for Process:
ProcessET ProcessInfiltration ProcessLateral ProcessMelt ProcessOutflow ProcessSublimation ProcessTransform ProcessETExponential ProcessETGR4J ProcessETHBV ProcessETLinear ProcessETOpenWater ProcessETPowerLaw ProcessETSocont ProcessInterceptionGR4J ProcessInfiltrationGR4J ProcessInfiltrationHBV ProcessInfiltrationSocont ProcessLateralSnowRedistributionFrey ProcessLateralSnowSlide ProcessMeltCemaNeige ProcessMeltDegreeDay ProcessMeltDegreeDayAspect ProcessMeltTemperatureIndex ProcessCapillaryHBV ProcessOutflowDirect ProcessOutflowLinear ProcessOutflowOverflow ProcessOutflowRest ProcessOutflowSnowHolding ProcessOutflowThreshold ProcessPercolationConstant ProcessPercolationGR4J ProcessProductionGR4J ProcessRoutingGR4J ProcessRoutingGR6J ProcessRoutingHBV ProcessRunoffHBV ProcessRunoffSocont ProcessSublimationConstant ProcessSublimationPET ProcessRefreezeDegreeDay ProcessTransformSnowToIceConstant ProcessTransformSnowToIceSwat

Public Member Functions

 Process (WaterContainer *container)
 
virtual void Reset ()
 
virtual bool IsValid () const =0
 
virtual void Validate () const
 
virtual void SetHydroUnitProperties (HydroUnit *unit, Brick *brick)
 
virtual void SetParameters (const ProcessSettings &processSettings)
 
virtual void AttachForcing (Forcing *)
 
void AttachFluxOut (std::unique_ptr< Flux > flux)
 
int GetOutputFluxCount () const
 
FluxGetOutputFlux (size_t index) const
 
virtual bool ToAtmosphere () const
 
virtual bool NeedsTargetBrickLinking () const
 
virtual int GetConnectionCount () const =0
 
virtual const vecDouble & GetChangeRates ()
 
virtual void StoreInOutgoingFlux (double *rate, int index)
 
void ApplyChange (int connectionIndex, double rate, double timeStepInDays)
 
virtual void Finalize ()
 
virtual vecDoublePt GetStateVariables ()
 
virtual double * GetValuePointer (std::string_view name)
 
const string & GetName () const
 
void SetName (const string &name)
 
void SetTimeMachine (TimeMachine *timeMachine)
 
WaterContainerGetWaterContainer () const
 
virtual void SetTargetBrick (Brick *)
 
virtual bool LinksMultipleTargets () const
 
virtual void AddTargetBrickWithWeights (Brick *, const std::vector< Brick * > &)
 
virtual bool IsLateralProcess () const noexcept
 
bool HasOutputFluxes () const noexcept
 
bool HasWaterContainer () const noexcept
 

Static Public Member Functions

static std::unique_ptr< ProcessFactory (const ProcessSettings &processSettings, Brick *brick)
 
static bool RegisterSettings (SettingsModel *modelSettings, const string &processType)
 
static bool HasParameter (const ProcessSettings &processSettings, std::string_view name)
 
static const float * GetParameterValuePointer (const ProcessSettings &processSettings, std::string_view name)
 

Protected Member Functions

const vecDouble & StoreRates (std::initializer_list< double > rates)
 
double GetSumChangeRatesOtherProcesses () const
 
virtual const vecDouble & GetRates ()=0
 

Protected Attributes

string _name
 
WaterContainer_container
 
TimeMachine_timeMachine {nullptr}
 
std::vector< std::unique_ptr< Flux > > _outputs
 
vecDouble _changeRates
 

Member Function Documentation

◆ AddTargetBrickWithWeights()

virtual void Process::AddTargetBrickWithWeights ( Brick * ,
const std::vector< Brick * > &  )
inlinevirtual

Add a target brick together with the bricks whose area fractions weight the flux toward it (used by processes that fan out to several targets).

Parameters
targetthe target brick.
weightSourcesthe bricks (land covers) whose area fractions weight the flux.

Reimplemented in ProcessCapillaryHBV.

◆ ApplyChange()

void Process::ApplyChange ( int connectionIndex,
double rate,
double timeStepInDays )

Apply the change rates to the process.

Parameters
connectionIndexindex of the connection.
ratechange rates.
timeStepInDaystime step in days.

◆ AttachFluxOut()

void Process::AttachFluxOut ( std::unique_ptr< Flux > flux)
inline

Attach outgoing flux.

Parameters
fluxoutgoing flux (ownership transferred)

◆ AttachForcing()

◆ Factory()

std::unique_ptr< Process > Process::Factory ( const ProcessSettings & processSettings,
Brick * brick )
static

Factory method to create a process.

Parameters
processSettingssettings of the process.
brickthe related brick.
Returns
the created process.

◆ Finalize()

virtual void Process::Finalize ( )
inlinevirtual

◆ GetChangeRates()

const vecDouble & Process::GetChangeRates ( )
nodiscardvirtual

Get the change rates of the process.

The returned reference points to a reusable per-process buffer that is overwritten on the next call; consume it before calling again.

Returns
vector of change rates.

Reimplemented in ProcessRoutingGR6J, and ProcessRoutingHBV.

◆ GetConnectionCount()

virtual int Process::GetConnectionCount ( ) const
nodiscardpure virtual

Get the number of connections to the process.

Returns
number of connections to the process.

Implemented in ProcessET, ProcessInfiltration, ProcessLateral, ProcessMelt, ProcessOutflow, ProcessSublimation, and ProcessTransform.

◆ GetName()

const string & Process::GetName ( ) const
inline

Get the name of the process.

Returns
name of the process.

◆ GetOutputFlux()

Flux * Process::GetOutputFlux ( size_t index) const
inline

Get an outgoing flux by its index.

Parameters
indexindex of the flux.
Returns
pointer to the flux.

◆ GetOutputFluxCount()

int Process::GetOutputFluxCount ( ) const
inline

Get the number of outgoing fluxes.

Returns
number of outgoing fluxes.

◆ GetParameterValuePointer()

const float * Process::GetParameterValuePointer ( const ProcessSettings & processSettings,
std::string_view name )
static

Get the value pointer of a parameter.

Parameters
processSettingssettings of the process containing the parameters.
namename of the parameter to get.
Returns
pointer to the value of the parameter.

◆ GetRates()

◆ GetStateVariables()

virtual vecDoublePt Process::GetStateVariables ( )
inlinevirtual

Get pointers to the state variables.

Returns
vector of pointers to the state variables.

◆ GetSumChangeRatesOtherProcesses()

double Process::GetSumChangeRatesOtherProcesses ( ) const
nodiscardprotected

Get the sum of change rates from other processes.

Returns
sum of change rates from other processes.

◆ GetValuePointer()

double * Process::GetValuePointer ( std::string_view name)
nodiscardvirtual

Get the value pointer for a given element.

Parameters
namename of the element to get.
Returns
pointer to the value of the given element.

Reimplemented in ProcessET, ProcessInfiltration, ProcessLateral, ProcessMelt, ProcessOutflow, ProcessRoutingGR4J, ProcessRoutingGR6J, ProcessRoutingHBV, ProcessSublimation, and ProcessTransform.

◆ GetWaterContainer()

WaterContainer * Process::GetWaterContainer ( ) const
inline

Get the water container associated with the process.

Returns
pointer to the water container.

◆ HasOutputFluxes()

bool Process::HasOutputFluxes ( ) const
inlinenodiscardnoexcept

Check if the process has any output fluxes.

Returns
true if the process has at least one output flux.

◆ HasParameter()

bool Process::HasParameter ( const ProcessSettings & processSettings,
std::string_view name )
staticnodiscard

Check if the process has a parameter with the provided name.

Parameters
processSettingssettings of the process containing the parameters.
namename of the parameter to check.
Returns
true if the process has a parameter with the provided name.

◆ HasWaterContainer()

bool Process::HasWaterContainer ( ) const
inlinenodiscardnoexcept

Check if the process has a water container.

Returns
true if the process has a water container.

◆ IsLateralProcess()

virtual bool Process::IsLateralProcess ( ) const
inlinenodiscardvirtualnoexcept

Check if the process is a lateral process.

Returns
true if the process is a lateral process.

Reimplemented in ProcessLateral, ProcessLateralSnowRedistributionFrey, and ProcessLateralSnowSlide.

◆ IsValid()

◆ LinksMultipleTargets()

virtual bool Process::LinksMultipleTargets ( ) const
inlinenodiscardvirtual

Check if the process links several target bricks (instead of a single one).

Returns
true if the process links several target bricks.

Reimplemented in ProcessCapillaryHBV.

◆ NeedsTargetBrickLinking()

virtual bool Process::NeedsTargetBrickLinking ( ) const
inlinenodiscardvirtual

Check if the process needs to link the target brick.

Returns
true if the process needs to link the target brick.

Reimplemented in ProcessCapillaryHBV, and ProcessInfiltration.

◆ RegisterSettings()

bool Process::RegisterSettings ( SettingsModel * modelSettings,
const string & processType )
staticnodiscard

Register the parameters and the needed forcing for the process.

Parameters
modelSettingssettings of the model.
processTypetype of process.
Returns
true if everything is correctly defined.

◆ Reset()

void Process::Reset ( )
virtual

Reset all the fluxes connected to the process.

Reimplemented in ProcessLateralSnowRedistributionFrey, ProcessMeltCemaNeige, ProcessRoutingGR4J, ProcessRoutingGR6J, and ProcessRoutingHBV.

◆ SetHydroUnitProperties()

void Process::SetHydroUnitProperties ( HydroUnit * unit,
Brick * brick )
virtual

Set the properties of the hydro unit.

Parameters
unitthe related hydro unit.
brickthe related brick.

Reimplemented in ProcessLateralSnowRedistributionFrey, ProcessLateralSnowSlide, ProcessMeltDegreeDayAspect, and ProcessRunoffSocont.

◆ SetName()

void Process::SetName ( const string & name)
inline

Set the name of the process.

Parameters
namename of the process.

◆ SetParameters()

◆ SetTargetBrick()

virtual void Process::SetTargetBrick ( Brick * )
inlinevirtual

Set the target brick for the process.

Parameters
bricktarget brick.

Reimplemented in ProcessInfiltration.

◆ SetTimeMachine()

void Process::SetTimeMachine ( TimeMachine * timeMachine)
inline

Set the time machine (non-owning reference). Required by processes that depend on the current simulation date.

Parameters
timeMachinepointer to the time machine.

◆ StoreInOutgoingFlux()

void Process::StoreInOutgoingFlux ( double * rate,
int index )
virtual

Store the water corresponding to the change rates in the outgoing fluxes.

Parameters
ratechange rates.
indexindex of the flux.

Reimplemented in ProcessOutflowOverflow.

◆ StoreRates()

const vecDouble & Process::StoreRates ( std::initializer_list< double > rates)
inlineprotected

Store change rates in the reusable buffer and return a reference to it.

Reuses the buffer's capacity (no heap allocation after the first call), which matters because this is on the per-timestep solver hot path.

Parameters
ratesthe change rates to store.
Returns
reference to the reusable buffer holding the rates.

◆ ToAtmosphere()

virtual bool Process::ToAtmosphere ( ) const
inlinenodiscardvirtual

Check if the process sends water to the atmosphere.

Returns
true if the process sends water to the atmosphere.

Reimplemented in ProcessET, and ProcessSublimation.

◆ Validate()

void Process::Validate ( ) const
virtual

Validate that everything is correctly defined. Throws an exception if validation fails.

Exceptions
ModelConfigErrorif validation fails.

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