tContext.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
 (HTM) git clone git://src.adamsgaard.dk/pism
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tContext.hh (2466B)
       ---
            1 /* Copyright (C) 2014, 2015, 2016, 2019 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 _CONTEXT_H_
           21 #define _CONTEXT_H_
           22 
           23 #include <memory>
           24 #include <string>
           25 
           26 #include <mpi.h>
           27 
           28 namespace pism {
           29 
           30 namespace units {
           31 class System;
           32 }
           33 
           34 class Config;
           35 class EnthalpyConverter;
           36 class Time;
           37 class Profiling;
           38 class Logger;
           39 
           40 class Context {
           41 public:
           42   typedef std::shared_ptr<units::System> UnitsSystemPtr;
           43   typedef std::shared_ptr<Config> ConfigPtr;
           44   typedef std::shared_ptr<const Config> ConstConfigPtr;
           45   typedef std::shared_ptr<EnthalpyConverter> EnthalpyConverterPtr;
           46   typedef std::shared_ptr<Time> TimePtr;
           47   typedef std::shared_ptr<const Time> ConstTimePtr;
           48   typedef std::shared_ptr<Logger> LoggerPtr;
           49   typedef std::shared_ptr<const Logger> ConstLoggerPtr;
           50 
           51   typedef std::shared_ptr<Context> Ptr;
           52   typedef std::shared_ptr<const Context> ConstPtr;
           53 
           54   Context(MPI_Comm c, UnitsSystemPtr sys,
           55           ConfigPtr conf, EnthalpyConverterPtr EC, TimePtr t,
           56           LoggerPtr log,
           57           const std::string &p);
           58   ~Context();
           59 
           60   MPI_Comm com() const;
           61   int size() const;
           62   int rank() const;
           63   UnitsSystemPtr unit_system() const;
           64   ConstConfigPtr config() const;
           65   EnthalpyConverterPtr enthalpy_converter() const;
           66   ConstTimePtr time() const;
           67   const std::string& prefix() const;
           68   const Profiling& profiling() const;
           69 
           70   ConstLoggerPtr log() const;
           71   LoggerPtr log();
           72 
           73   ConfigPtr config();
           74   TimePtr time();
           75 
           76   int pio_iosys_id() const;
           77 private:
           78   class Impl;
           79   Impl *m_impl;
           80   // disable copying and assignments
           81   Context(const Context& other);
           82   Context & operator=(const Context &);
           83 };
           84 
           85 //! Create a default context using options.
           86 Context::Ptr context_from_options(MPI_Comm com, const std::string &prefix);
           87 
           88 } // end of namespace pism
           89 
           90 #endif /* _CONTEXT_H_ */