URI:
       tfactory.cc - 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
       ---
       tfactory.cc (2624B)
       ---
            1 /* Copyright (C) 2017, 2018 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 #include <memory>
           21 
           22 #include "StressBalance.hh"
           23 #include "ShallowStressBalance.hh"
           24 #include "WeertmanSliding.hh"
           25 #include "SSB_Modifier.hh"
           26 #include "pism/regional/SSAFD_Regional.hh"
           27 #include "pism/regional/SIAFD_Regional.hh"
           28 #include "pism/util/pism_utilities.hh"
           29 
           30 namespace pism {
           31 namespace stressbalance {
           32 
           33 std::shared_ptr<StressBalance> create(const std::string &model,
           34                                       IceGrid::ConstPtr grid,
           35                                       bool regional) {
           36   ShallowStressBalance *sliding = NULL;
           37 
           38   if (member(model, {"none", "sia"})) {
           39     sliding = new ZeroSliding(grid);
           40   } else if (member(model, {"prescribed_sliding", "prescribed_sliding+sia"})) {
           41     sliding = new PrescribedSliding(grid);
           42   } else if (member(model, {"weertman_sliding", "weertman_sliding+sia"})) {
           43     sliding = new WeertmanSliding(grid);
           44   } else if (member(model, {"ssa", "ssa+sia"})) {
           45     if (regional) {
           46       sliding = new SSAFD_Regional(grid);
           47     } else {
           48       sliding = new SSAFD(grid);
           49     }
           50   } else {
           51     throw RuntimeError::formatted(PISM_ERROR_LOCATION,
           52                                   "invalid stress balance model: %s", model.c_str());
           53   }
           54 
           55   SSB_Modifier *modifier = NULL;
           56 
           57   if (member(model, {"none", "ssa", "prescribed_sliding", "weertman_sliding"})) {
           58     modifier = new ConstantInColumn(grid);
           59   } else if (member(model, {"prescribed_sliding+sia", "weertman_sliding+sia", "ssa+sia", "sia"})) {
           60     if (regional) {
           61       modifier = new SIAFD_Regional(grid);
           62     } else {
           63       modifier = new SIAFD(grid);
           64     }
           65   } else {
           66     throw RuntimeError::formatted(PISM_ERROR_LOCATION,
           67                                   "invalid stress balance model: %s", model.c_str());
           68   }
           69 
           70   return std::shared_ptr<StressBalance>(new StressBalance(grid, sliding, modifier));
           71 }
           72 
           73 } // end of namespace stressbalance
           74 } // end of namespace pism