ApertureDataCache class
#include <gtopt/aperture_data_cache.hpp>
In-memory cache for aperture-specific schedule data.
Reads all *.parquet files under a given directory tree at construction time. Each file is expected to have columns:
stage(int32)block(int32)uid:<N>(double) — one per scenario UID
The file stem (e.g. "RAPEL" from "RAPEL.parquet") is used as the element name key. The subdirectory name (e.g. "Flow") is used as the class name key.
Public types
- struct ElementKey
- Outer key: (class_name, element_name) — only ~hundreds of unique pairs.
- struct ElementKeyHash
- Hash for ElementKey using string hashes combined.
- struct InnerKey
- Inner key: pure integer triple — O(1) hashed lookup.
- struct InnerKeyHash
- Hash for InnerKey combining three integer hashes.
- using ElementData = std::unordered_map<InnerKey, double, InnerKeyHash>
- Per-element data: unordered_map (~4800 entries), O(1) lookup.
Constructors, destructors, conversion operators
- ApertureDataCache() defaulted
- ApertureDataCache(const std::filesystem::path& aperture_dir) explicit
Public functions
- auto empty() const -> bool noexcept
- Check if any data was loaded.
- auto lookup(std::string_view class_name, std::string_view element_name, ScenarioUid scenario_uid, StageUid stage_uid, BlockUid block_uid) const -> std::optional< double > -> auto
- auto scenario_uids() const -> std::vector< ScenarioUid > -> auto
- All scenario UIDs loaded across all elements.
Function documentation
gtopt:: ApertureDataCache:: ApertureDataCache(const std::filesystem::path& aperture_dir) explicit
Load all parquet files from the given directory tree. Ignores non-parquet files and missing directories.
auto gtopt:: ApertureDataCache:: lookup(std::string_view class_name,
std::string_view element_name,
ScenarioUid scenario_uid,
StageUid stage_uid,
BlockUid block_uid) const -> std::optional< double >
Look up a value by (class_name, element_name, scenario_uid, stage, block). Returns std::nullopt if any key is not found.