tFlowLawFactory.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
---
tFlowLawFactory.hh (2325B)
---
1 // Copyright (C) 2009--2015, 2017, 2018 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 "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 &,
41 const Config &, EnthalpyConverter::Ptr);
42
43 class FlowLawFactory {
44 public:
45 FlowLawFactory(const std::string &prefix,
46 Config::ConstPtr conf,
47 EnthalpyConverter::Ptr my_EC);
48 ~FlowLawFactory();
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;
56 const Config::ConstPtr m_config;
57 EnthalpyConverter::Ptr m_EC;
58 };
59
60
61 } // end of namespace rheology
62 } // end of namespace pism
63
64 #endif // __flowlaw_factory