|
| | HY_CatchmentArea () |
| |
| | HY_CatchmentArea (std::string catchment_id, std::shared_ptr< realization::Formulation > formulation, std::optional< double > area_sqkm=std::nullopt, std::shared_ptr< const geojson::geometry > bounds=nullptr) |
| |
| | HY_CatchmentArea (std::string catchment_id, std::shared_ptr< realization::Formulation > formulation, const geojson::Feature &feature, hy_features::attributes::AreaSource preferred=hy_features::attributes::AreaSource::attribute) |
| | Realize a catchment from the hydrofabric feature describing it.
|
| |
| virtual | ~HY_CatchmentArea () |
| |
| std::optional< double > | area_sqkm () const override |
| | The areal extent of this feature, in square kilometers, where the perspective has one.
|
| |
| const std::shared_ptr< const geojson::geometry > & | get_bounds () const |
| | The geometry describing this face, empty where no hydrofabric feature backs it.
|
| |
| Response | get_response (time_step_t t_index, time_step_t t_delta) override |
| | The value representing the state of this feature after one time step.
|
| |
| 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.
|
| |
The two-dimensional realization of a catchment: the face it covers.
Topologically a face bounded by catchment divide and flowpath edges, so this is the perspective to ask for an areal extent – the denominator when a value is distributed over the catchment.
| std::optional< double > HY_CatchmentArea::area_sqkm |
( |
| ) |
const |
|
inlineoverridevirtual |
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 from HY_CatchmentRealization.
References area.
| const std::shared_ptr< const geojson::geometry > & HY_CatchmentArea::get_bounds |
( |
| ) |
const |
|
inline |
The geometry describing this face, empty where no hydrofabric feature backs it.
Shared with the feature it was read from rather than copied out of it: a divide runs to thousands of coordinates, and holding one per realization would duplicate what the fabric already has. A handle rather than a reference, so a consumer that outlives this realization – a domain layer resampling onto the catchment – can keep the divide after both this and the feature collection are gone.
The variant, not a polygon: a feature may describe its face as either a Polygon or a MultiPolygon, and narrowing to one of them is what would force a copy of the other.
References bounds.
| 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
-
| inflows | Ids of the nexuses contributing to the catchment. |
| outflows | Ids of the nexuses the catchment contributes to. |
| layer | The hydrofabric layer the catchment belongs to. |
- Returns
- The catchment, newly built or the one this realization already built.
- Exceptions
-
| std::bad_weak_ptr | If 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().