URI:
       tScalarForcing.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tScalarForcing.hh (1922B)
       ---
            1 // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 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 _SCALARFORCING_H_
           20 #define _SCALARFORCING_H_
           21 
           22 #include <memory>               // std::unique_ptr
           23 
           24 #include "pism/util/Context.hh"
           25 
           26 namespace pism {
           27 
           28 class Timeseries;
           29 
           30 /*!
           31  * This class helps with loading and using scalar forcings such as scalar temperature
           32  * offsets.
           33  *
           34  * It processes command-line options, reads data from a file, and gets data corresponding
           35  * to a time interval [t, t+dt].
           36  */
           37 class ScalarForcing {
           38 public:
           39   ScalarForcing(Context::ConstPtr ctx,
           40                 const std::string &option_prefix,
           41                 const std::string &offset_name,
           42                 const std::string &units,
           43                 const std::string &glaciological_units,
           44                 const std::string &long_name);
           45   ~ScalarForcing();
           46 
           47   void init();
           48   void update(double t, double dt);
           49 
           50   double value() const;
           51   double value(double t) const;
           52 protected:
           53   Context::ConstPtr m_ctx;
           54 
           55   std::unique_ptr<Timeseries> m_data;
           56 
           57   std::string m_prefix;
           58 
           59   // in years
           60   unsigned int m_period;
           61   // in seconds
           62   double m_reference_time;
           63 
           64   double m_current;
           65 };
           66 
           67 
           68 } // end of namespace pism
           69 
           70 #endif /* _SCALARFORCING_H_ */