|
|
string | _name |
| |
|
WaterContainer * | _container |
| |
|
TimeMachine * | _timeMachine {nullptr} |
| |
|
HydroUnit * | _hydroUnit {nullptr} |
| |
|
string | _parentBrickName |
| |
|
std::vector< std::unique_ptr< Flux > > | _outputs |
| |
|
vecDouble | _changeRates |
| |
◆ AddGateBrick()
| virtual void Process::AddGateBrick |
( |
Brick * | | ) |
|
|
inlinevirtual |
◆ 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
-
| target | the target brick. |
| weightSources | the 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
-
| connectionIndex | index of the connection. |
| rate | change rates. |
| timeStepInDays | time step in days. |
◆ AttachFluxOut()
| void Process::AttachFluxOut |
( |
std::unique_ptr< Flux > | flux | ) |
|
|
inline |
Attach outgoing flux.
- Parameters
-
| flux | outgoing flux (ownership transferred) |
◆ AttachForcing()
| virtual void Process::AttachForcing |
( |
Forcing * | | ) |
|
|
inlinevirtual |
Attach forcing to the process.
- Parameters
-
| forcing | forcing to attach. |
Reimplemented in ProcessETExponential, ProcessETGR4J, ProcessETHBV, ProcessETLinear, ProcessETOpenWater, ProcessETPowerLaw, ProcessETSocont, ProcessInterceptionGR4J, ProcessLateralSnowRedistributionFrey, ProcessMeltCemaNeige, ProcessMeltDegreeDay, ProcessMeltDegreeDayAspect, ProcessMeltTemperatureIndex, ProcessOutflowSnowHoldingPrevah, ProcessProductionGR4J, ProcessRefreezeDegreeDay, ProcessSublimationPET, and ProcessSublimationPrevah.
◆ Factory()
Factory method to create a process.
- Parameters
-
| processSettings | settings of the process. |
| brick | the related brick. |
- Returns
- the created process.
◆ Finalize()
| virtual void Process::Finalize |
( |
| ) |
|
|
inlinevirtual |
◆ GetChangeRates()
| const vecDouble & Process::GetChangeRates |
( |
| ) |
|
|
nodiscardvirtual |
◆ GetConnectionCount()
| virtual int Process::GetConnectionCount |
( |
| ) |
const |
|
nodiscardpure virtual |
◆ GetCurrentDayOfYear()
| int Process::GetCurrentDayOfYear |
( |
| ) |
const |
|
nodiscardprotected |
Get the day of the year (1-366) of the current simulation date.
Requires a timer: a process that must also run without one (unit tests) checks _timeMachine itself and applies its own fallback.
- Returns
- current day of the year.
◆ GetForcingRate()
| double Process::GetForcingRate |
( |
Forcing * | forcing | ) |
const |
|
nodiscardprotected |
Read a forcing as the daily rate the processes work with.
A cumulative forcing (precipitation, PET) is given as the amount that falls or is demanded during one time step, so it is divided by the step length; the two coincide at a daily step, which is why this only matters for sub-daily runs. A non-cumulative one (temperature, radiation) is returned untouched: dividing it would be meaningless, and the forcing's own type decides here so that a caller cannot get it wrong.
- Parameters
-
| forcing | the forcing to read. |
- Returns
- the value as a rate [unit/d] for a cumulative forcing, the value itself otherwise.
◆ GetLinearResponseOffset()
| virtual double Process::GetLinearResponseOffset |
( |
| ) |
const |
|
inlinenodiscardvirtual |
Get the constant term of the affine response (rate = k × S − offset), for the reservoirs that drain the content above a threshold θ (offset = k × θ). It is zero for a plain linear reservoir. Only valid when HasLinearResponse() returns true.
- Returns
- the offset of the linear response [mm/d].
Reimplemented in ProcessOutflowLinearThreshold.
◆ GetLinearResponseRate()
| virtual double Process::GetLinearResponseRate |
( |
| ) |
const |
|
inlinenodiscardvirtual |
◆ 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
-
- 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 ) |
Get the value pointer of a parameter. If the process's hydro unit carries a per-unit (spatial) override for this parameter (keyed by the parent brick), the override pointer is returned instead of the shared settings value.
- Parameters
-
| processSettings | settings of the process containing the parameters. |
| name | name of the parameter to get. |
- Returns
- pointer to the value of the parameter.
◆ GetRates()
| virtual const vecDouble & Process::GetRates |
( |
| ) |
|
|
nodiscardprotectedpure virtual |
Get the rates of the process.
Implementations must store their result via StoreRates() (or directly in the _changeRates buffer) and return the reference, to avoid allocating on the hot path.
- Returns
- reference to the reusable buffer holding the rates.
Implemented in ProcessCapillaryHBV, ProcessETExponential, ProcessETGR4J, ProcessETHBV, ProcessETLinear, ProcessETOpenWater, ProcessETOpenWaterPrevah, ProcessETPowerLaw, ProcessETPrevah, ProcessETSocont, ProcessETWetSurfacePrevah, ProcessInfiltrationGR4J, ProcessInfiltrationHBV, ProcessInfiltrationSocont, ProcessInterceptionGR4J, ProcessInterceptionMenzel, ProcessLateralSnowRedistributionFrey, ProcessLateralSnowSlide, ProcessMeltCemaNeige, ProcessMeltDegreeDay, ProcessMeltDegreeDayAspect, ProcessMeltDegreeDaySeasonal, ProcessMeltTemperatureIndex, ProcessOutflowDirect, ProcessOutflowLinear, ProcessOutflowLinearThreshold, ProcessOutflowOverflow, ProcessOutflowRest, ProcessOutflowSlowcomp, ProcessOutflowSnowHolding, ProcessOutflowSnowHoldingPrevah, ProcessOutflowSplit, ProcessOutflowThreshold, ProcessPercolationConstant, ProcessPercolationGR4J, ProcessPercolationPrevah, ProcessProductionGR4J, ProcessRefreezeDegreeDay, ProcessRefreezeSeasonal, ProcessRoutingDelay, ProcessRoutingGR4J, ProcessRoutingGR6J, ProcessRoutingHBV, ProcessRunoffHBV, ProcessRunoffSocont, ProcessSublimationConstant, ProcessSublimationPET, ProcessSublimationPrevah, ProcessTransformSnowToIceConstant, and ProcessTransformSnowToIceSwat.
◆ 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.
◆ GetTimeStepInDays()
| double Process::GetTimeStepInDays |
( |
| ) |
const |
|
nodiscardprotected |
Get the current time step in days.
Falls back on the daily step when no timer is attached (a process built outside a model, as in the unit tests) or when the timer is not initialized yet (it is set up after the structure is built).
- Returns
- the time step length [d].
◆ GetValuePointer()
| double * Process::GetValuePointer |
( |
std::string_view | name | ) |
|
|
nodiscardvirtual |
Get the value pointer for a given element.
- Parameters
-
| name | name of the element to get. |
- Returns
- pointer to the value of the given element.
Reimplemented in ProcessET, ProcessInfiltration, ProcessLateral, ProcessMelt, ProcessOutflow, ProcessRoutingDelay, ProcessRoutingGR4J, ProcessRoutingGR6J, ProcessRoutingHBV, ProcessSublimation, and ProcessTransform.
◆ GetWaterContainer()
Get the water container associated with the process.
- Returns
- pointer to the water container.
◆ HasConstraintPriority()
| virtual bool Process::HasConstraintPriority |
( |
| ) |
const |
|
inlinenodiscardvirtual |
Check if the process takes its demand from the water container with priority when the container cannot satisfy all outgoing rates. Non-priority processes then share the remaining water proportionally. Mirrors sequential (operator-split) reference models such as PREVAH, where snow evaporation is served at the full potential rate before melt.
- Returns
- true if the process has priority on the container constraints.
Reimplemented in ProcessSublimationPrevah.
◆ HasLinearResponse()
| virtual bool Process::HasLinearResponse |
( |
| ) |
const |
|
inlinenodiscardvirtual |
Check if the process rate is affine in the container content (rate = k × S − offset). Processes reporting a linear response can be integrated exactly by the analytic solver.
- Returns
- true if the process rate is linear in the content.
Reimplemented in ProcessOutflowLinear, and ProcessOutflowLinearThreshold.
◆ 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
-
| processSettings | settings of the process containing the parameters. |
| name | name 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 |
◆ IsValid()
| virtual bool Process::IsValid |
( |
| ) |
const |
|
nodiscardpure virtual |
Check that everything is correctly defined.
- Returns
- true if everything is correctly defined.
Implemented in ProcessCapillaryHBV, ProcessET, ProcessETExponential, ProcessETGR4J, ProcessETHBV, ProcessETLinear, ProcessETOpenWater, ProcessETOpenWaterPrevah, ProcessETPowerLaw, ProcessETPrevah, ProcessETSocont, ProcessETWetSurfacePrevah, ProcessInfiltration, ProcessInfiltrationHBV, ProcessInterceptionGR4J, ProcessInterceptionMenzel, ProcessLateral, ProcessLateralSnowRedistributionFrey, ProcessLateralSnowSlide, ProcessMelt, ProcessMeltCemaNeige, ProcessMeltDegreeDay, ProcessMeltDegreeDayAspect, ProcessMeltDegreeDaySeasonal, ProcessMeltTemperatureIndex, ProcessOutflow, ProcessOutflowDirect, ProcessOutflowLinearThreshold, ProcessOutflowSlowcomp, ProcessOutflowSnowHolding, ProcessOutflowSnowHoldingPrevah, ProcessOutflowSplit, ProcessOutflowThreshold, ProcessPercolationPrevah, ProcessProductionGR4J, ProcessRefreezeDegreeDay, ProcessRefreezeSeasonal, ProcessRoutingDelay, ProcessRoutingHBV, ProcessRunoffHBV, ProcessSublimation, ProcessSublimationConstant, ProcessSublimationPET, ProcessSublimationPrevah, and ProcessTransform.
◆ 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.
◆ NeedsGateBrickLinking()
| virtual bool Process::NeedsGateBrickLinking |
( |
| ) |
const |
|
inlinenodiscardvirtual |
Check if the process needs to link a gate brick (a brick whose state modulates the process rate without receiving its flux, e.g. the soil moisture store gating the PREVAH percolation).
- Returns
- true if the process needs to link a gate brick.
Reimplemented in ProcessETWetSurfacePrevah, and ProcessPercolationPrevah.
◆ NeedsTargetBrickLinking()
| virtual bool Process::NeedsTargetBrickLinking |
( |
| ) |
const |
|
inlinenodiscardvirtual |
◆ RegisterSettings()
| bool Process::RegisterSettings |
( |
SettingsModel * | modelSettings, |
|
|
const string & | processType ) |
|
staticnodiscard |
Register the parameters and the needed forcing for the process.
- Parameters
-
| modelSettings | settings of the model. |
| processType | type of process. |
- Returns
- true if everything is correctly defined.
◆ RequiresDailyTimeStep()
| virtual bool Process::RequiresDailyTimeStep |
( |
| ) |
const |
|
inlinenodiscardvirtual |
◆ Reset()
◆ SetHydroUnitProperties()
| void Process::SetHydroUnitProperties |
( |
HydroUnit * | unit, |
|
|
Brick * | brick ) |
|
virtual |
◆ SetName()
| void Process::SetName |
( |
const string & | name | ) |
|
|
inline |
Set the name of the process.
- Parameters
-
◆ SetParameters()
Assign the parameters to the process.
- Parameters
-
| processSettings | settings of the process containing the parameters. |
Reimplemented in ProcessCapillaryHBV, ProcessETExponential, ProcessETHBV, ProcessETOpenWaterPrevah, ProcessETPowerLaw, ProcessETPrevah, ProcessInfiltrationHBV, ProcessInfiltrationSocont, ProcessInterceptionMenzel, ProcessLateralSnowRedistributionFrey, ProcessLateralSnowSlide, ProcessMeltCemaNeige, ProcessMeltDegreeDay, ProcessMeltDegreeDayAspect, ProcessMeltDegreeDaySeasonal, ProcessMeltTemperatureIndex, ProcessOutflowLinear, ProcessOutflowLinearThreshold, ProcessOutflowOverflow, ProcessOutflowSlowcomp, ProcessOutflowSnowHolding, ProcessOutflowSnowHoldingPrevah, ProcessOutflowSplit, ProcessOutflowThreshold, ProcessPercolationConstant, ProcessPercolationPrevah, ProcessRefreezeDegreeDay, ProcessRefreezeSeasonal, ProcessRoutingDelay, ProcessRoutingGR4J, ProcessRoutingGR6J, ProcessRoutingHBV, ProcessRunoffHBV, ProcessRunoffSocont, ProcessSublimationConstant, ProcessSublimationPET, ProcessTransformSnowToIceConstant, and ProcessTransformSnowToIceSwat.
◆ SetParentContext()
Set the parent context (hydro unit and owning brick) of the process. Called by the model builder before SetParameters so per-unit (spatial) parameter overrides can be resolved. Non-virtual so subclass SetHydroUnitProperties overrides cannot bypass it.
- Parameters
-
| unit | the related hydro unit (may be null for sub-basin processes). |
| brick | the brick owning this process. |
◆ SetTargetBrick()
| virtual void Process::SetTargetBrick |
( |
Brick * | | ) |
|
|
inlinevirtual |
◆ 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
-
| timeMachine | pointer 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
-
| rate | change rates. |
| index | index 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
-
| rates | the 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
-
The documentation for this class was generated from the following files:
- /github/workspace/core/src/processes/Process.h
- /github/workspace/core/src/processes/Process.cpp