URI:
       tPoisson.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
       ---
       tPoisson.hh (1686B)
       ---
            1 /* Copyright (C) 2019, 2020 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 "pism/util/IceGrid.hh"
           21 #include "pism/util/Logger.hh"
           22 #include "pism/util/iceModelVec.hh"
           23 #include "pism/util/petscwrappers/KSP.hh"
           24 #include "pism/util/petscwrappers/Mat.hh"
           25 
           26 namespace pism {
           27 
           28 class Poisson {
           29 public:
           30   Poisson(IceGrid::ConstPtr grid);
           31 
           32   int solve(const IceModelVec2Int& mask, const IceModelVec2S& bc, double rhs,
           33             bool reuse_matrix = false);
           34 
           35   const IceModelVec2S &solution() const;
           36 private:
           37   void assemble_matrix(const IceModelVec2Int &mask, Mat A);
           38   void assemble_rhs(double rhs,
           39                     const IceModelVec2Int &mask,
           40                     const IceModelVec2S &bc,
           41                     IceModelVec2S &b);
           42 
           43   IceGrid::ConstPtr m_grid;
           44   Logger::ConstPtr m_log;
           45   petsc::DM::Ptr m_da;         // dof=1 DA used by the KSP solver
           46   petsc::KSP m_KSP;
           47   petsc::Mat m_A;
           48   IceModelVec2S m_b;
           49   IceModelVec2S m_x;
           50   IceModelVec2Int m_mask;
           51 };
           52 
           53 } // end of namespace pism