NGen
Loading...
Searching...
No Matches
HY_CartographicRealization Class Reference

#include <HY_CartographicRealization.hpp>

+ Inheritance diagram for HY_CartographicRealization:
+ Collaboration diagram for HY_CartographicRealization:

Public Types

enum class  Quantity {
  depth ,
  volume ,
  volumetric_flow
}
 A quantity a perspective can express its value as, each in one canonical unit. More...
 

Public Member Functions

 HY_CartographicRealization ()
 
virtual ~HY_CartographicRealization ()
 
const std::shared_ptr< realization::Formulation > & get_formulation () const
 The model producing this feature's values, or nullptr where the feature is not modeled.
 
const std::string & get_catchment_id () const
 The id this feature shares with the catchment it realizes.
 
std::shared_ptr< HY_Catchment > realize (std::vector< std::string > inflows, std::vector< std::string > outflows, long layer=0)
 Build the catchment this feature is a perspective of, and bind the two together.
 
std::shared_ptr< HY_Catchment > get_realized_catchment () const
 The catchment this feature realizes, whose inflow and outflow nexuses it shares.
 
virtual std::optional< double > area_sqkm () const
 The areal extent of this feature, in square kilometers, where the perspective has one.
 
virtual Response get_response (time_step_t t_index, time_step_t t_delta)
 Execute the attached model for the given time step, where it is of the specified size, and return the perspective's response.
 

Static Public Attributes

static constexpr std::size_t quantity_count = 3
 How many Quantity there are.
 

Protected Attributes

std::string catchment_id
 
std::shared_ptr< realization::Formulation > formulation
 
unsigned long id_number
 

Private Attributes

std::weak_ptr< HY_Catchment > realized_catchment
 

Member Enumeration Documentation

◆ Quantity

enum class HY_CatchmentRealization::Quantity
stronginherited

A quantity a perspective can express its value as, each in one canonical unit.

Unit conversion should be handled at a higher level, outside of the perspective itself.

Enumerator
depth 

Meters.

volume 

Cubic meters, over the step.

volumetric_flow 

Cubic meters per second.

Constructor & Destructor Documentation

◆ HY_CartographicRealization()

HY_CartographicRealization::HY_CartographicRealization ( )

◆ ~HY_CartographicRealization()

HY_CartographicRealization::~HY_CartographicRealization ( )
virtual

Member Function Documentation

◆ area_sqkm()

virtual std::optional< double > HY_CatchmentRealization::area_sqkm ( ) const
inlinevirtualinherited

The areal extent of this feature, in square kilometers, where the perspective has one.

A face has an area, and so does the edge bounding that face; the edge running through it has a length instead. Empty therefore says the perspective has no extent to give, never that the hydrofabric withheld one: a catchment whose hydrofabric carries no extent is refused when the realization is built, so it does not reach here.

Reimplemented in HY_CatchmentArea.

◆ get_catchment_id()

const std::string & HY_CatchmentRealization::get_catchment_id ( ) const
inlineinherited

The id this feature shares with the catchment it realizes.

References HY_CatchmentRealization::catchment_id.

Referenced by HY_CatchmentArea::get_response(), and HY_CatchmentRealization::get_response().

◆ get_formulation()

const std::shared_ptr< realization::Formulation > & HY_CatchmentRealization::get_formulation ( ) const
inlineinherited

The model producing this feature's values, or nullptr where the feature is not modeled.

References HY_CatchmentRealization::formulation.

◆ get_realized_catchment()

std::shared_ptr< HY_Catchment > HY_CatchmentRealization::get_realized_catchment ( ) const
inherited

The catchment this feature realizes, whose inflow and outflow nexuses it shares.

Null until realize has been called.

References HY_CatchmentRealization::realized_catchment.

◆ get_response()

HY_CatchmentRealization::Response HY_CatchmentRealization::get_response ( time_step_t t_index,
time_step_t t_delta )
virtualinherited

Execute the attached model for the given time step, where it is of the specified size, and return the perspective's response.

A model's value is assumed to be depth by default.

Parameters
t_indexThe index of the time step for which to run model calculations.
t_deltaThe duration, in seconds, of the time step for which to run model calculations.
Returns
This perspective's response for the step, as each Quantity it expresses.
Exceptions
std::runtime_errorIf this feature has no formulation attached.

Reimplemented in HY_CatchmentArea.

References HY_CatchmentRealization::formulation, HY_CatchmentRealization::get_catchment_id(), and realization::Formulation::get_response().

Referenced by HY_CatchmentArea::get_response().

◆ realize()

std::shared_ptr< HY_Catchment > HY_CatchmentRealization::realize ( std::vector< std::string > inflows,
std::vector< std::string > outflows,
long layer = 0 )
inherited

Build the catchment this feature is a perspective of, and bind the two together.

The catchment is given this realization's identity, so the pair cannot disagree about what it names. Each then holds the other: the catchment owns its realization, and the realization reaches back to the catchment for its nexuses.

One realization is one perspective of one catchment. Calling this again returns the catchment already built and does not apply the arguments; realizing a catchment from another perspective means another realization, which builds its own.

Parameters
inflowsIds of the nexuses contributing to the catchment.
outflowsIds of the nexuses the catchment contributes to.
layerThe hydrofabric layer the catchment belongs to.
Returns
The catchment, newly built or the one this realization already built.
Exceptions
std::bad_weak_ptrIf this realization is not already held by a shared_ptr.

References HY_CatchmentRealization::catchment_id, and HY_CatchmentRealization::realized_catchment.

Referenced by HY_CatchmentRealization_Test::SetUp().

Member Data Documentation

◆ catchment_id

std::string HY_CatchmentRealization::catchment_id
protectedinherited

◆ formulation

std::shared_ptr<realization::Formulation> HY_CatchmentRealization::formulation
protectedinherited

◆ id_number

unsigned long HY_CatchmentRealization::id_number
protectedinherited

◆ quantity_count

std::size_t HY_CatchmentRealization::quantity_count = 3
staticconstexprinherited

How many Quantity there are.

◆ realized_catchment

std::weak_ptr<HY_Catchment> HY_CatchmentRealization::realized_catchment
privateinherited

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