feat(thermal): certify exact binary64 time grids
This commit is contained in:
@@ -1,11 +1,44 @@
|
||||
#ifndef FESA_ANALYSIS_THERMAL_TIME_GRID_H_
|
||||
#define FESA_ANALYSIS_THERMAL_TIME_GRID_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
|
||||
namespace fesa {
|
||||
class ThermalTimeGrid final { public:
|
||||
static Result<ThermalTimeGrid> Create(double period,double increment,std::uint32_t maximum);
|
||||
std::uint32_t Count() const noexcept; double Time(std::uint32_t index) const noexcept; double Delta(std::uint32_t index) const noexcept;
|
||||
private: ThermalTimeGrid(double p,double d,std::uint32_t n,bool close):period_(p),increment_(d),count_(n),close_(close){} double period_,increment_; std::uint32_t count_; bool close_; };
|
||||
}
|
||||
#endif
|
||||
|
||||
/// @brief Carries one stored time and its actual integration coefficient.
|
||||
struct ThermalTimeFrame {
|
||||
double time;
|
||||
double delta;
|
||||
};
|
||||
|
||||
/// @brief Stores an O(1) fixed-increment grid with exact input-cell endpoint tests.
|
||||
class ThermalTimeGrid final {
|
||||
public:
|
||||
/// @brief Checks finite positive controls and the uint32 INC bound before use.
|
||||
static Result<ThermalTimeGrid> Create(double period, double increment,
|
||||
std::uint32_t maximum = 100U);
|
||||
/// @brief Returns the number of completed increments, excluding initial time.
|
||||
std::uint32_t Count() const noexcept;
|
||||
/// @brief Returns fl(index * nominal increment), or the exact final input time.
|
||||
/// @pre index is in [0, Count()].
|
||||
double Time(std::uint32_t index) const noexcept;
|
||||
/// @brief Returns the actual coefficient, never a difference of stored times.
|
||||
/// @pre index is in [1, Count()].
|
||||
double Delta(std::uint32_t index) const noexcept;
|
||||
/// @brief Checks index, finite values and strict increase for one frame in O(1).
|
||||
Result<ThermalTimeFrame> Frame(std::uint32_t index) const;
|
||||
|
||||
private:
|
||||
/// @brief Stores controls only after count and terminal interval validation.
|
||||
ThermalTimeGrid(double period, double increment, std::uint32_t count,
|
||||
double final_delta);
|
||||
double period_;
|
||||
double increment_;
|
||||
std::uint32_t count_;
|
||||
double final_delta_;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
#endif // FESA_ANALYSIS_THERMAL_TIME_GRID_H_
|
||||
|
||||
Reference in New Issue
Block a user