#ifndef FESA_ANALYSIS_THERMAL_TIME_GRID_H_ #define FESA_ANALYSIS_THERMAL_TIME_GRID_H_ #include #include "fesa/core/status.h" namespace fesa { /// @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 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 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_