PISM, A Parallel Ice Sheet Model  stable v0.5
src/base/rheology/flowlaw_factory.hh
Go to the documentation of this file.
00001 // Copyright (C) 2009--2012 Jed Brown, Ed Bueler and Constantine Khroulev
00002 //
00003 // This file is part of PISM.
00004 //
00005 // PISM is free software; you can redistribute it and/or modify it under the
00006 // terms of the GNU General Public License as published by the Free Software
00007 // Foundation; either version 2 of the License, or (at your option) any later
00008 // version.
00009 //
00010 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013 // details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with PISM; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef __flowlaw_factory
00020 #define __flowlaw_factory
00021 
00022 #include "flowlaws.hh"
00023 #include <map>
00024 #include <string>
00025 
00026 // use namespace std BUT remove trivial namespace browser from doxygen-erated HTML source browser
00028 using namespace std;
00030 
00031 #define ICE_ISOTHERMAL_GLEN  "isothermal_glen" /* Plain isothermal Glen */
00032 #define ICE_PB      "pb"            /* Paterson-Budd (ThermoGlenIce) */
00033 #define ICE_GPBLD   "gpbld"         /* Paterson-Budd-Lliboutry-Duval (PolyThermalGPBLDIce) */
00034 #define ICE_HOOKE   "hooke"         /* Hooke (ThermoGlenIceHooke) */
00035 #define ICE_ARR     "arr"           /* Temperature dependent Arrhenius (either warm or cold) */
00036 #define ICE_GOLDSBY_KOHLSTEDT "gk"  /* Goldsby-Kohlstedt for SIA */
00037 #define ICE_ARRWARM "arrwarm"       /* Temperature dependent Arrhenius (should be refactored into ICE_ARR) */
00038 
00039 typedef PetscErrorCode(*IceFlowLawCreator)(MPI_Comm, const char[],
00040                                            const NCConfigVariable &, EnthalpyConverter*, IceFlowLaw **);
00041 
00042 class IceFlowLawFactory {
00043 public:
00044   IceFlowLawFactory(MPI_Comm, const char prefix[], const NCConfigVariable &conf,
00045                     EnthalpyConverter *my_EC);
00046   ~IceFlowLawFactory();
00047   PetscErrorCode setType(string name);
00048   PetscErrorCode setFromOptions();
00049   PetscErrorCode registerType(string name, IceFlowLawCreator);
00050   PetscErrorCode removeType(string name);
00051   PetscErrorCode create(IceFlowLaw **);
00052 private:
00053   PetscErrorCode registerAll();
00054 private:
00055   MPI_Comm com;
00056   char prefix[256];
00057   string type_name;
00058   map<string, IceFlowLawCreator> flow_laws;
00059   const NCConfigVariable &config;
00060   EnthalpyConverter *EC;
00061 };
00062 
00063 
00064 #endif  // __flowlaw_factory
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines