PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
FlowLawFactory.hh
Go to the documentation of this file.
1// Copyright (C) 2009--2015, 2017, 2018, 2021, 2023, 2025 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/Config.hh"
28
29namespace pism {
30namespace 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
40typedef FlowLaw *(*FlowLawCreator)(double, const Config &, std::shared_ptr<EnthalpyConverter>);
41
43public:
44 FlowLawFactory(std::shared_ptr<const Config> conf,
45 std::shared_ptr<EnthalpyConverter> my_EC);
46 ~FlowLawFactory() = default;
47 void add(const std::string &name, FlowLawCreator);
48 void remove(const std::string &name);
49 std::shared_ptr<FlowLaw> create(const std::string &type_name, double exponent);
50private:
51 std::map<std::string, FlowLawCreator> m_flow_laws;
52 std::shared_ptr<const Config> m_config;
53 std::shared_ptr<EnthalpyConverter> m_EC;
54};
55
56
57} // end of namespace rheology
58} // end of namespace pism
59
60#endif // __flowlaw_factory
A class for storing and accessing PISM configuration flags and parameters.
Definition Config.hh:56
std::shared_ptr< const Config > m_config
std::map< std::string, FlowLawCreator > m_flow_laws
void remove(const std::string &name)
std::shared_ptr< FlowLaw > create(const std::string &type_name, double exponent)
std::shared_ptr< EnthalpyConverter > m_EC
void add(const std::string &name, FlowLawCreator)
FlowLaw *(* FlowLawCreator)(double, const Config &, std::shared_ptr< EnthalpyConverter >)