File atm_field_data_provider.hpp
File List > components > emulator_comps > eatm > src > impl > atm_field_data_provider.hpp
Go to the documentation of this file
#ifndef ATM_FIELD_DATA_PROVIDER_HPP
#define ATM_FIELD_DATA_PROVIDER_HPP
#include "../../../common/src/emulator_output_stream.hpp"
#include "atm_field_manager.hpp"
#include <regex>
#include <set>
#include <string>
#include <vector>
namespace emulator {
namespace impl {
class AtmFieldDataProvider : public FieldDataProvider {
public:
AtmFieldDataProvider(AtmFieldManager &fields, int ncols_local);
~AtmFieldDataProvider() override = default;
const std::vector<double> *get_field(const std::string &name) const override;
std::vector<std::string> get_field_names() const override;
int get_ncols() const override { return m_ncols; }
int get_field_nlevs(const std::string &name) const override;
void detect_stacked_fields();
bool is_stacked_field(const std::string &name) const;
const std::vector<double> &
get_stacked_field(const std::string &basename) const;
private:
AtmFieldManager &m_fields;
int m_ncols;
// Stacked field detection and caching
// Maps basename → list of level indices found
mutable std::map<std::string, std::vector<int>> m_stacked_field_levels;
// Cache for stacked field data
mutable std::map<std::string, std::vector<double>> m_stacked_cache;
// Set of all known field names (for get_field_names)
mutable std::set<std::string> m_all_field_names;
mutable bool m_field_names_cached = false;
bool parse_slice_pattern(const std::string &name, std::string &basename,
int &level_idx) const;
void build_stacked_cache(const std::string &basename) const;
};
} // namespace impl
} // namespace emulator
#endif // ATM_FIELD_DATA_PROVIDER_HPP