PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
IPTwoBlockVec.hh
Go to the documentation of this file.
1 // Copyright (C) 2012, 2014, 2015, 2017, 2021 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 
33 public:
34  IPTwoBlockVec(Vec a, Vec b);
35  ~IPTwoBlockVec() = default;
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);
63 
65 
68 
71 };
72 
73 } // end of namespace inverse
74 } // end of namespace pism
75 
76 #endif /* end of include guard: IPTWOBLOCKVEC_HH */
petsc::VecScatter m_scatter_a
petsc::VecScatter m_scatter_b
void scatter(Vec a, Vec b)
void scatter_begin_end(VecScatter s, Vec a, Vec b, ScatterMode m)