NGen
Loading...
Searching...
No Matches
Layer.hpp
1#ifndef __NGEN_LAYER__
2#define __NGEN_LAYER__
3
4#include <NGenConfig.h>
5
6#include "LayerData.hpp"
7#include "Simulation_Time.hpp"
8#include "State_Exception.hpp"
9#include "geojson/FeatureBuilder.hpp"
10#include <boost/core/span.hpp>
11
12namespace hy_features
13{
14 class HY_Features;
15 class HY_Features_MPI;
16}
17
18namespace ngen
19{
20
21 class Layer
22 {
23 public:
24
25 #if NGEN_WITH_MPI
26 using feature_type = hy_features::HY_Features_MPI;
27 #else
29 #endif
30
32 const LayerDescription& desc,
33 const std::vector<std::string>& p_u,
34 const Simulation_Time& s_t,
35 feature_type& f,
37 long idx) :
38 description(desc),
40 simulation_time(s_t),
41 features(f),
44 {
45
46 }
47
57 const LayerDescription& desc,
58 const Simulation_Time& s_t,
59 feature_type& f,
60 long idx) :
61 description(desc),
62 simulation_time(s_t),
63 features(f),
65 {
66
67 }
68
69 virtual ~Layer() {}
70
71
75
76
77
81
82
83
86 int get_id() const { return this->description.id; }
87
88
91 const std::string& get_name() const { return this->description.name; }
92
93
96 const double get_time_step() const { return this->description.time_step; }
97
98
101 const std::string& get_time_step_units() const { return this->description.time_step_units; }
102
103
106 virtual void update_models(boost::span<double> catchment_outflows,
107 std::unordered_map<std::string, int> &catchment_indexes,
108 boost::span<double> nexus_downstream_flows,
109 std::unordered_map<std::string, int> &nexus_indexes,
110 int current_step);
111
112 protected:
113
115 //TODO is this really required at the top level?
116 //See "minimum" constructor above used for DomainLayer impl...
117 const std::vector<std::string> processing_units;
120 //TODO is this really required at the top level? or can this be moved to SurfaceLayer?
123
124 };
125}
126
127#endif
Simulation Time class providing time-series variables and methods to the model.
Definition Simulation_Time.hpp:48
time_t get_current_epoch_time()
Accessor to the the current simulation time.
Definition Simulation_Time.hpp:100
time_t next_timestep_epoch_time(int epoch_time_seconds)
Definition Simulation_Time.hpp:139
Collection interface to HY_Features objects and their associated model formulations.
Definition HY_Features.hpp:44
Definition Layer.hpp:22
const double get_time_step() const
Return this time_step interval used for this layer.
Definition Layer.hpp:96
time_t current_timestep_epoch_time()
Return the last timestep that was processed by this layer in epoch time units.
Definition Layer.hpp:80
long output_time_index
Definition Layer.hpp:122
Layer(const LayerDescription &desc, const Simulation_Time &s_t, feature_type &f, long idx)
Construct a minimum layer object.
Definition Layer.hpp:56
feature_type & features
Definition Layer.hpp:119
const std::string & get_time_step_units() const
Return the units for the time_step value of this layer.
Definition Layer.hpp:101
const geojson::GeoJSON catchment_data
Definition Layer.hpp:121
const std::vector< std::string > processing_units
Definition Layer.hpp:117
const LayerDescription description
Definition Layer.hpp:114
virtual ~Layer()
Definition Layer.hpp:69
Simulation_Time simulation_time
Definition Layer.hpp:118
virtual void update_models(boost::span< double > catchment_outflows, std::unordered_map< std::string, int > &catchment_indexes, boost::span< double > nexus_downstream_flows, std::unordered_map< std::string, int > &nexus_indexes, int current_step)
Run one simulation timestep for each model in this layer.
Definition Layer.cpp:10
time_t next_timestep_epoch_time()
Return the next timestep that will be processed by this layer in epoch time units.
Definition Layer.hpp:74
int get_id() const
Return the numeric id of this layer.
Definition Layer.hpp:86
const std::string & get_name() const
Return the name of this layer.
Definition Layer.hpp:91
Layer(const LayerDescription &desc, const std::vector< std::string > &p_u, const Simulation_Time &s_t, feature_type &f, geojson::GeoJSON cd, long idx)
Definition Layer.hpp:31
std::shared_ptr< FeatureCollection > GeoJSON
Easy short-hand for a smart pointer to a FeatureCollection.
Definition FeatureBuilder.hpp:21
HY_HydroLocation: class representing a hydrologic position.
Definition HY_Features.hpp:16
Definition DomainLayer.hpp:9
A simple structure to hold meta data related to a computational layer.
Definition LayerData.hpp:18
std::string time_step_units
Definition LayerData.hpp:20
double time_step
Definition LayerData.hpp:22
std::string name
Definition LayerData.hpp:19
int id
Definition LayerData.hpp:21