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

#include <ProcessRoutingDelay.h>

Inheritance diagram for ProcessRoutingDelay:
ProcessOutflow Process

Public Member Functions

 ProcessRoutingDelay (WaterContainer *container)
 
bool IsValid () const override
 
void SetParameters (const ProcessSettings &processSettings) override
 
void Reset () override
 
void Finalize () override
 
const vecDouble & GetChangeRates () override
 
double * GetValuePointer (std::string_view name) override
 
- Public Member Functions inherited from ProcessOutflow
 ProcessOutflow (WaterContainer *container)
 
int GetConnectionCount () const override
 
- Public Member Functions inherited from Process
 Process (WaterContainer *container)
 
virtual void Validate () const
 
const float * GetParameterValuePointer (const ProcessSettings &processSettings, std::string_view name)
 
void SetParentContext (HydroUnit *unit, Brick *brick)
 
virtual void SetHydroUnitProperties (HydroUnit *unit, Brick *brick)
 
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 RequiresDailyTimeStep () const
 
virtual bool NeedsTargetBrickLinking () const
 
virtual bool NeedsGateBrickLinking () const
 
virtual bool HasConstraintPriority () const
 
virtual void StoreInOutgoingFlux (double *rate, int index)
 
void ApplyChange (int connectionIndex, double rate, double timeStepInDays)
 
virtual vecDoublePt GetStateVariables ()
 
const string & GetName () const
 
void SetName (const string &name)
 
void SetTimeMachine (TimeMachine *timeMachine)
 
WaterContainerGetWaterContainer () const
 
virtual void SetTargetBrick (Brick *)
 
virtual void AddGateBrick (Brick *)
 
virtual bool LinksMultipleTargets () const
 
virtual void AddTargetBrickWithWeights (Brick *, const std::vector< Brick * > &)
 
virtual bool IsLateralProcess () const noexcept
 
virtual bool HasLinearResponse () const
 
virtual double GetLinearResponseRate () const
 
virtual double GetLinearResponseOffset () const
 
bool HasOutputFluxes () const noexcept
 
bool HasWaterContainer () const noexcept
 

Static Public Member Functions

static void RegisterProcessSettings (SettingsModel *modelSettings)
 
- Static Public Member Functions inherited from ProcessOutflow
static void RegisterProcessSettings (SettingsModel *modelSettings)
 
- Static Public Member Functions inherited from Process
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)
 

Protected Member Functions

const vecDouble & GetRates () override
 
void _recomputeOrdinates ()
 
- Protected Member Functions inherited from Process
double GetForcingRate (Forcing *forcing) const
 
double GetTimeStepInDays () const
 
int GetCurrentDayOfYear () const
 
const vecDouble & StoreRates (std::initializer_list< double > rates)
 
double GetSumChangeRatesOtherProcesses () const
 

Protected Attributes

const float * _delay
 
vecDouble _schedule
 
vecDouble _ordinates
 
double _lastDelay
 
double _lastTimeStep
 
double _previousContent
 
double _processStorage
 
- Protected Attributes inherited from Process
string _name
 
WaterContainer_container
 
TimeMachine_timeMachine {nullptr}
 
HydroUnit_hydroUnit {nullptr}
 
string _parentBrickName
 
std::vector< std::unique_ptr< Flux > > _outputs
 
vecDouble _changeRates
 

Detailed Description

Pure translation: the inflow of the routing brick leaves it unchanged in shape, a fixed duration later (the translation element of PREVAH's glacier reservoirs).

The delay [d] is a duration whatever the time step. On the grid of time steps it is d = delay / timestep steps; the water received during a step is a block one step long, and shifting that block by d steps lands a share (1 - f) of it in step floor(d) and f in the next one, f being the fractional part of d. A delay that is a whole number of steps is therefore an exact shift, and a delay shorter than a step (a one-hour translation on a daily step) spreads a matching share onto the next step instead of being dropped. A zero delay behaves exactly like a pass-through.

GetRates() is read-only: it returns what is scheduled for this step plus the same-step share of the water arriving now, read as it enters during the solve (the upstream rates and this step's forcing and instantaneous amounts), so a zero delay makes the brick transparent. Finalize() measures the water that actually arrived, schedules the rest of it, and carries any undelivered amount over so no water is stranded in the brick.

Member Function Documentation

◆ _recomputeOrdinates()

void ProcessRoutingDelay::_recomputeOrdinates ( )
protected

Recompute the ordinates and resize the schedule for the current delay and step.

◆ Finalize()

void ProcessRoutingDelay::Finalize ( )
overridevirtual

Advance the delivery schedule once per time step, using the committed amounts.

Reimplemented from Process.

◆ GetChangeRates()

const vecDouble & ProcessRoutingDelay::GetChangeRates ( )
inlinenodiscardoverridevirtual

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.

Bypasses the empty-container shortcut of the base class, as routing:hbv does: the scheduled delivery usually drains the whole content within the step.

Reimplemented from Process.

◆ GetRates()

const vecDouble & ProcessRoutingDelay::GetRates ( )
overrideprotectedvirtual

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.

Read-only: the delivery due this step, from the current schedule.

Implements Process.

◆ GetValuePointer()

double * ProcessRoutingDelay::GetValuePointer ( std::string_view name)
overridevirtual

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 from ProcessOutflow.

◆ IsValid()

bool ProcessRoutingDelay::IsValid ( ) const
nodiscardoverridevirtual

Check that everything is correctly defined.

Returns
true if everything is correctly defined.

Reimplemented from ProcessOutflow.

◆ RegisterProcessSettings()

void ProcessRoutingDelay::RegisterProcessSettings ( SettingsModel * modelSettings)
static

Register the process settings (parameters and logging defaults) in the settings model.

Parameters
modelSettingsThe settings model to register the parameters in.

◆ Reset()

void ProcessRoutingDelay::Reset ( )
overridevirtual

Reset all the fluxes connected to the process.

Reimplemented from Process.

◆ SetParameters()

void ProcessRoutingDelay::SetParameters ( const ProcessSettings & processSettings)
overridevirtual

Assign the parameters to the process.

Parameters
processSettingssettings of the process containing the parameters.

Reimplemented from Process.


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