URI:
       tIPTwoBlockVec.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
       ---
       tIPTwoBlockVec.hh (2020B)
       ---
            1 // Copyright (C) 2012, 2014, 2015, 2017 David Maxwell 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 IPTWOBLOCKVEC_HH
           20 #define IPTWOBLOCKVEC_HH
           21 
           22 #include <petscis.h>
           23 #include <petscvec.h>
           24 
           25 #include "pism/util/petscwrappers/Vec.hh"
           26 #include "pism/util/petscwrappers/IS.hh"
           27 #include "pism/util/petscwrappers/VecScatter.hh"
           28 
           29 namespace pism {
           30 namespace inverse {
           31 
           32 class IPTwoBlockVec {
           33 public:
           34   IPTwoBlockVec(Vec a, Vec b);
           35   ~IPTwoBlockVec();
           36 
           37   IS blockAIndexSet();
           38   IS blockBIndexSet();
           39 
           40   void scatter(Vec a, Vec b);
           41   void scatterToA(Vec a);
           42   void scatterToB(Vec b);
           43 
           44   void scatter(Vec ab, Vec a, Vec b);
           45   void scatterToA(Vec ab, Vec a);
           46   void scatterToB(Vec ab, Vec b);
           47 
           48   void gather(Vec a, Vec b);
           49   void gatherFromA(Vec a);
           50   void gatherFromB(Vec b);
           51 
           52   void gather(Vec a, Vec b, Vec ab);
           53   void gatherFromA(Vec a, Vec ab);
           54   void gatherFromB(Vec b, Vec ab);
           55 
           56   operator Vec () {
           57     return m_ab;
           58   }
           59 
           60 protected:
           61   void scatter_begin_end(VecScatter s, Vec a, Vec b, ScatterMode m);
           62   petsc::Vec m_ab;
           63   
           64   PetscInt m_na_local, m_na_global, m_nb_local, m_nb_global;
           65   
           66   petsc::IS m_a_in_ab;
           67   petsc::IS m_b_in_ab;
           68   
           69   petsc::VecScatter m_scatter_a;
           70   petsc::VecScatter m_scatter_b;
           71 };
           72 
           73 } // end of namespace inverse
           74 } // end of namespace pism
           75 
           76 #endif /* end of include guard: IPTWOBLOCKVEC_HH */