Loading...
Searching...
No Matches
hydrocoupletemporal.h
Go to the documentation of this file.
1
19
20#ifndef HYDROCOUPLETEMPORAL_H
21#define HYDROCOUPLETEMPORAL_H
22
23#include <cstdint>
24#include "hydrocouple.h"
25
26
36#if defined(__GNUC__) || defined(__clang__)
37#pragma GCC visibility push(default)
38#endif
39
40namespace HydroCouple
41{
43 namespace Temporal
44 {
57 constexpr double TIME_EQUALITY_TOLERANCE_DAYS = 1.0e-8;
58
67 constexpr double INTERVAL_LENGTH_CONTIGUOUS = -1.0;
68
93
97 enum class TimeInterpolation : uint8_t
98 {
99 Unknown = 0,
104 };
105
109 enum class TimeExtrapolation : uint8_t
110 {
115 };
116
125 {
126 public:
130 virtual ~IDateTime() = default;
131
135 [[nodiscard]] virtual double julianDay() const = 0;
136
140 [[nodiscard]] virtual double modifiedJulianDay() const = 0;
141
147 [[nodiscard]] virtual double serialDate() const = 0;
148 };
149
156 class ITimeSpan : public virtual IDateTime
157 {
158
159 public:
163 virtual ~ITimeSpan() = default;
164
169 [[nodiscard]] virtual double duration() const = 0;
170
174 [[nodiscard]] virtual double endJulianDay() const = 0;
175 };
176
182 {
183 public:
187 virtual ~ITimeModelComponent() = default;
188
193 [[nodiscard]] virtual IDateTime *currentDateTime() const = 0;
194
199 [[nodiscard]] virtual ITimeSpan *simulationPeriod() const = 0;
200
211 [[nodiscard]] virtual double nextDateTimeJulianDay() const = 0;
212 };
213
223 {
224
225 public:
229 virtual ~ITimeSeriesComponentDataItem() = default;
230
236 [[nodiscard]] virtual const IDateTime *time(int64_t timeIndex) const = 0;
237
242 [[nodiscard]] virtual int64_t timeCount() const = 0;
243
252 [[nodiscard]] virtual std::span<const double> times() const = 0;
253
258 [[nodiscard]] virtual ITimeSpan *timeSpan() const = 0;
259
269 [[nodiscard]] virtual IDimension *timeDimension() const = 0;
270
278 [[nodiscard]] virtual TimeKind timeKind() const = 0;
279
290 [[nodiscard]] virtual double intervalLength() const = 0;
291
300 [[nodiscard]] virtual TimeInterpolation timeInterpolation() const = 0;
301
308 [[nodiscard]] virtual TimeExtrapolation timeExtrapolation() const = 0;
309 };
310
316 {
317
318 public:
323
328 [[nodiscard]] virtual std::vector<std::string> identifiers() const = 0;
329
338 [[nodiscard]] virtual IDimension *identifierDimension() const = 0;
339 };
340
341 }
342}
343
344#if defined(__GNUC__) || defined(__clang__)
345#pragma GCC visibility pop
346#endif
347
348#endif // HYDROCOUPLETEMPORAL_H
IComponentDataItem is a fundamental unit of data for a component.
Definition hydrocouple.h:1844
IDimension provides the properties of one axis of a data item's index space.
Definition hydrocouple.h:1494
IModelComponent interface is the core interface in the HydroCouple standard defining a model componen...
Definition hydrocouple.h:696
IPropertyChanged interface is used to emit signal/event when a property of an object changes.
Definition hydrocouple.h:417
IDateTime interface based on a Julian day.
Definition hydrocoupletemporal.h:125
virtual double julianDay() const =0
Date and time as a Julian day value (days since 4713 BC January 1, 12:00 UTC).
virtual double modifiedJulianDay() const =0
Modified Julian day value: julianDay() - 2400000.5 (days since 1858-11-17 00:00 UTC).
virtual double serialDate() const =0
Serial date number in the MATLAB datenum convention: days since 0000-01-00 in the proleptic Gregorian...
virtual ~IDateTime()=default
~IDateTime destructor.
ITimeIdBasedComponentDataItem is an IComponentDataItem with both temporal and identifier-based dimens...
Definition hydrocoupletemporal.h:316
virtual IDimension * identifierDimension() const =0
identifierDimension associated with this data item.
virtual ~ITimeIdBasedComponentDataItem()=default
~ITimeIdBasedComponentDataItem destructor.
virtual std::vector< std::string > identifiers() const =0
identifiers associated with the identifier dimension.
ITimeModelComponent is an IModelComponent that advances through time during simulation and provides a...
Definition hydrocoupletemporal.h:182
virtual ITimeSpan * simulationPeriod() const =0
simulationPeriod of the model.
virtual double nextDateTimeJulianDay() const =0
The time (Julian day) the next update() will advance currentDateTime() to.
virtual IDateTime * currentDateTime() const =0
Gets the current date and time of the model simulation.
virtual ~ITimeModelComponent()=default
ITimeModelComponent destructor.
ITimeSeriesComponentDataItem is an IComponentItem with a temporal attribute.
Definition hydrocoupletemporal.h:223
virtual double intervalLength() const =0
Length of the averaging or accumulation interval (days).
virtual const IDateTime * time(int64_t timeIndex) const =0
Gets the IDateTime for the given time index.
virtual std::span< const double > times() const =0
Bulk access to all time coordinates as Julian day values.
virtual TimeInterpolation timeInterpolation() const =0
What this item does — or, for an input, accepts — between held instants.
virtual ~ITimeSeriesComponentDataItem()=default
~ITimeSeriesComponentDataItem destructor.
virtual TimeExtrapolation timeExtrapolation() const =0
What this item does — or, for an input, accepts — outside its held range.
virtual TimeKind timeKind() const =0
What each value's time coordinate refers to.
virtual IDimension * timeDimension() const =0
Gets the IDimension of the times.
virtual int64_t timeCount() const =0
Gets the number of times.
virtual ITimeSpan * timeSpan() const =0
Gets the ITimeSpan associated with this data item.
ITimeSpan specifies an interval of time.
Definition hydrocoupletemporal.h:157
virtual double duration() const =0
Duration of the timespan in days; non-negative.
virtual double endJulianDay() const =0
End of the interval as a Julian day: julianDay() + duration().
virtual ~ITimeSpan()=default
~ITimeSpan destructor.
Core interface definitions for the HydroCouple component-based modeling framework.
HydroCouple's interfaces that have a time varying component.
Definition hydrocoupletemporal.h:44
TimeExtrapolation
How a provider produces a value at an instant beyond the last (or before the first) it holds.
Definition hydrocoupletemporal.h:110
@ Refuse
A query outside the held range is refused; the provider must be advanced first.
Definition hydrocoupletemporal.h:112
@ HoldLast
Repeat the boundary value.
Definition hydrocoupletemporal.h:113
constexpr double TIME_EQUALITY_TOLERANCE_DAYS
Two instants are the same instant when their Julian days differ by no more than this (1e-8 days,...
Definition hydrocoupletemporal.h:57
constexpr double INTERVAL_LENGTH_CONTIGUOUS
The intervalLength() a time-series item returns when its intervals are contiguous but not of one leng...
Definition hydrocoupletemporal.h:67
TimeKind
What a value's time coordinate refers to.
Definition hydrocoupletemporal.h:85
@ Instantaneous
A reading at the time coordinate.
Definition hydrocoupletemporal.h:87
@ Accumulated
Total accumulated over that interval.
Definition hydrocoupletemporal.h:91
@ IntervalMean
Mean over the interval ending at the time coordinate.
Definition hydrocoupletemporal.h:88
@ Unknown
Not declared.
Definition hydrocoupletemporal.h:86
@ IntervalMaximum
Maximum over that interval.
Definition hydrocoupletemporal.h:90
@ IntervalMinimum
Minimum over that interval.
Definition hydrocoupletemporal.h:89
TimeInterpolation
How a provider produces a value at an instant that is between two it holds.
Definition hydrocoupletemporal.h:98
@ Linear
Linear in time between neighbours.
Definition hydrocoupletemporal.h:103
@ Nearest
The nearer of the two neighbours.
Definition hydrocoupletemporal.h:102
@ None
Exact match required (within TIME_EQUALITY_TOLERANCE_DAYS); a query at an instant not held is refused...
Definition hydrocoupletemporal.h:100
@ Previous
Hold the most recent earlier value (step function).
Definition hydrocoupletemporal.h:101
HydroCouple namespace contains the core interface specifications for the HydroCouple component-based ...
Definition hydrocouple.h:54