PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
NetCDFConfig.hh
Go to the documentation of this file.
1/* Copyright (C) 2014, 2015, 2016, 2017, 2018, 2021, 2024, 2025 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#ifndef _PISM_NETCDF_CONFIG_H_
21#define _PISM_NETCDF_CONFIG_H_
22
23#include <string>
24#include <set>
25
26#include "pism/util/Config.hh"
27#include "pism/util/VariableMetadata.hh"
28
29namespace pism {
30
31class Logger;
32
33//! A class for reading, writing and accessing PISM configuration flags and parameters.
34class NetCDFConfig : public Config {
35public:
36 NetCDFConfig(const std::string &name, units::System::Ptr unit_system);
38
39protected:
40 void read_impl(const File &file);
41
42 bool is_set_impl(const std::string &name) const;
43
44 // doubles
46 double get_number_impl(const std::string &name) const;
47 std::vector<double> get_numbers_impl(const std::string &name) const;
48
49 void set_number_impl(const std::string &name, double value);
50 void set_numbers_impl(const std::string &name,
51 const std::vector<double> &values);
52 // strings
54 std::string get_string_impl(const std::string &name) const;
55 void set_string_impl(const std::string &name, const std::string &value);
56
57 // flags
58 Flags all_flags_impl() const;
59 bool get_flag_impl(const std::string& name) const;
60 void set_flag_impl(const std::string& name, bool value);
61private:
63 //! @brief the name of the file this config database was initialized from
64 std::string m_config_filename;
65};
66
67} // end of namespace pism
68
69#endif /* _PISM_NETCDF_CONFIG_H_ */
std::map< std::string, std::string > Strings
Definition Config.hh:111
std::map< std::string, std::vector< double > > Doubles
Definition Config.hh:96
std::shared_ptr< units::System > unit_system() const
Definition Config.cc:70
std::map< std::string, bool > Flags
Definition Config.hh:118
A class for storing and accessing PISM configuration flags and parameters.
Definition Config.hh:56
High-level PISM I/O class.
Definition File.hh:57
bool get_flag_impl(const std::string &name) const
void set_numbers_impl(const std::string &name, const std::vector< double > &values)
bool is_set_impl(const std::string &name) const
VariableMetadata m_data
Doubles all_doubles_impl() const
void set_number_impl(const std::string &name, double value)
void set_flag_impl(const std::string &name, bool value)
Set a value of a flag flag.
void read_impl(const File &file)
Read flag flags and double parameters from a NetCDF file.
std::string get_string_impl(const std::string &name) const
double get_number_impl(const std::string &name) const
void set_string_impl(const std::string &name, const std::string &value)
Strings all_strings_impl() const
Flags all_flags_impl() const
std::vector< double > get_numbers_impl(const std::string &name) const
std::string m_config_filename
the name of the file this config database was initialized from
A class for reading, writing and accessing PISM configuration flags and parameters.
std::shared_ptr< System > Ptr
Definition Units.hh:47