PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
ScalarForcing.hh
Go to the documentation of this file.
1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021, 2023 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 #ifndef PISM_SCALARFORCING_H
20 #define PISM_SCALARFORCING_H
21 
22 #include <memory> // std::unique_ptr
23 #include <vector> // std::vector
24 
25 namespace pism {
26 
27 class Context;
28 class File;
29 class Logger;
30 
31 /*!
32  * This class helps with loading and using scalar forcings such as scalar temperature
33  * offsets.
34  *
35  * It processes command-line options, reads data from a file, and gets data corresponding
36  * to a time interval [t, t+dt].
37  */
39 public:
40  ScalarForcing(const Context &ctx,
41  const std::string &option_prefix,
42  const std::string &variable_name,
43  const std::string &units,
44  const std::string &output_units,
45  const std::string &long_name);
46 
47  ScalarForcing(const Context &ctx,
48  const std::string &filename,
49  const std::string &variable_name,
50  const std::string &units,
51  const std::string &output_units,
52  const std::string &long_name,
53  bool periodic);
54 
56 
57  double value(double t) const;
58 
59  double average(double t, double dt) const;
60 
61 private:
62  // disable copy constructor and the assignment operator:
65 
66  void initialize(const Context &ctx,
67  const std::string &filename,
68  const std::string &variable_name,
69  const std::string &units,
70  const std::string &output_units,
71  const std::string &long_name,
72  bool periodic);
73 
74  double integral(double a, double b) const;
75 
76  struct Impl;
78 };
79 
80 } // end of namespace pism
81 
82 #endif /* PISM_SCALARFORCING_H */
ScalarForcing & operator=(const ScalarForcing &)
ScalarForcing(const ScalarForcing &other)
double average(double t, double dt) const
double value(double t) const
void initialize(const Context &ctx, const std::string &filename, const std::string &variable_name, const std::string &units, const std::string &output_units, const std::string &long_name, bool periodic)
ScalarForcing(const Context &ctx, const std::string &option_prefix, const std::string &variable_name, const std::string &units, const std::string &output_units, const std::string &long_name)
double integral(double a, double b) const