PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
FlowLawFactory.hh
Go to the documentation of this file.
1 // Copyright (C) 2009--2015, 2017, 2018, 2021, 2023 Jed Brown, Ed Bueler and Constantine Khroulev
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 __flowlaw_factory
20 #define __flowlaw_factory
21 
22 #include <map>
23 #include <string>
24 #include <memory>
25 
26 #include "pism/rheology/FlowLaw.hh"
27 #include "pism/util/ConfigInterface.hh"
28 
29 namespace pism {
30 namespace rheology {
31 
32 #define ICE_ISOTHERMAL_GLEN "isothermal_glen" /* Plain isothermal Glen */
33 #define ICE_PB "pb" /* Paterson-Budd (PatersonBudd) */
34 #define ICE_GPBLD "gpbld" /* Paterson-Budd-Lliboutry-Duval (GPBLD) */
35 #define ICE_HOOKE "hooke" /* Hooke (Hooke) */
36 #define ICE_ARR "arr" /* Temperature dependent Arrhenius (either warm or cold) */
37 #define ICE_GOLDSBY_KOHLSTEDT "gk" /* Goldsby-Kohlstedt for SIA */
38 #define ICE_ARRWARM "arrwarm" /* Temperature dependent Arrhenius (should be refactored into ICE_ARR) */
39 
40 typedef FlowLaw*(*FlowLawCreator)(const std::string &,
42 
44 public:
45  FlowLawFactory(const std::string &prefix,
46  Config::ConstPtr conf,
48  ~FlowLawFactory() = default;
49  void set_default(const std::string &name);
50  void add(const std::string &name, FlowLawCreator);
51  void remove(const std::string &name);
52  std::shared_ptr<FlowLaw> create();
53 private:
54  std::string m_type_name, m_prefix;
55  std::map<std::string, FlowLawCreator> m_flow_laws;
58 };
59 
60 
61 } // end of namespace rheology
62 } // end of namespace pism
63 
64 #endif // __flowlaw_factory
std::shared_ptr< const Config > ConstPtr
A class for storing and accessing PISM configuration flags and parameters.
std::shared_ptr< EnthalpyConverter > Ptr
std::map< std::string, FlowLawCreator > m_flow_laws
std::shared_ptr< FlowLaw > create()
void remove(const std::string &name)
const Config::ConstPtr m_config
FlowLawFactory(const std::string &prefix, Config::ConstPtr conf, EnthalpyConverter::Ptr my_EC)
EnthalpyConverter::Ptr m_EC
void set_default(const std::string &name)
void add(const std::string &name, FlowLawCreator)
FlowLaw *(* FlowLawCreator)(const std::string &, const Config &, EnthalpyConverter::Ptr)