Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_DenseContainer_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4 //
5 // Copyright 2009 NTESS and the Ifpack2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef IFPACK2_DENSECONTAINER_DECL_HPP
11 #define IFPACK2_DENSECONTAINER_DECL_HPP
12 
15 
16 #include "Ifpack2_Container.hpp"
17 #include "Tpetra_MultiVector.hpp"
18 #include "Tpetra_Map.hpp"
19 #include "Tpetra_RowMatrix.hpp"
21 #include "Tpetra_BlockCrsMatrix_decl.hpp"
22 
23 namespace Ifpack2 {
24 
68 
69 template <class MatrixType, class LocalScalarType>
71  : public ContainerImpl<MatrixType, LocalScalarType> {
73 
74  private:
81  using matrix_type = MatrixType;
83  using LSC = LocalScalarType;
84 
86  using typename Container<MatrixType>::SC;
88  using typename Container<MatrixType>::LO;
90  using typename Container<MatrixType>::GO;
92  using typename Container<MatrixType>::NO;
93 
94  using typename Container<MatrixType>::mv_type;
95  using local_mv_type = Tpetra::MultiVector<LSC, LO, GO, NO>;
96  using typename Container<MatrixType>::map_type;
97  using typename Container<MatrixType>::vector_type;
98  using typename Container<MatrixType>::import_type;
99 
100  using typename Container<MatrixType>::ISC;
101  using typename ContainerImpl<MatrixType, LocalScalarType>::LISC;
102  using typename Container<MatrixType>::HostView;
103  using typename ContainerImpl<MatrixType, LocalScalarType>::HostViewLocal;
104  using typename ContainerImpl<MatrixType, LocalScalarType>::HostSubviewLocal;
105  using typename ContainerImpl<MatrixType, LocalScalarType>::ConstHostSubviewLocal;
106 
107  static_assert(std::is_same<MatrixType, Tpetra::RowMatrix<SC, LO, GO, NO>>::value,
108  "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
109 
118  using typename Container<MatrixType>::row_matrix_type;
119 
120  using block_crs_matrix_type = Tpetra::BlockCrsMatrix<SC, LO, GO, NO>;
122 
123  public:
125 
126 
138  const Teuchos::Array<Teuchos::Array<LO>>& partitions,
139  const Teuchos::RCP<const import_type>& importer,
140  bool pointIndexed);
141 
143 
145  virtual ~DenseContainer();
146 
148 
150 
152 
154 
156  virtual void initialize();
157 
159  virtual void compute();
160 
161  void clearBlocks();
162 
164 
166 
170  virtual std::ostream& print(std::ostream& os) const;
171 
173 
175 
177  virtual std::string description() const;
178 
180  virtual void
182  const Teuchos::EVerbosityLevel verbLevel =
184 
186 
188  static std::string getName();
189 
190  private:
192  void extract();
193 
197  void factor();
198 
207  void
208  solveBlock(ConstHostSubviewLocal X,
209  HostSubviewLocal Y,
210  int blockIndex,
211  Teuchos::ETransp mode,
212  const LSC alpha,
213  const LSC beta) const;
214 
216  std::vector<Teuchos::SerialDenseMatrix<int, LSC>> diagBlocks_;
217 
219  mutable Teuchos::Array<int> ipiv_;
220 
222  bool hasBlockCrsMatrix_;
223 
225  Teuchos::Array<LSC> scalars_;
226 
228  Teuchos::Array<GO> scalarOffsets_;
229 };
230 
231 } // namespace Ifpack2
232 
233 #endif // IFPACK2_DENSECONTAINER_DECL_HPP
typename Kokkos::ArithTraits< SC >::val_type ISC
Internal representation of Scalar in Kokkos::View.
Definition: Ifpack2_Container_decl.hpp:101
The implementation of the numerical features of Container (Jacobi, Gauss-Seidel, SGS). This class allows a custom scalar type (LocalScalarType) to be used for storing blocks and solving the block systems. Hiding this template parameter from the Container interface simplifies the BlockRelaxation and ContainerFactory classes.
Definition: Ifpack2_Container_decl.hpp:307
virtual void compute()
Extract the local diagonal block and prepare the solver.
Definition: Ifpack2_DenseContainer_def.hpp:76
static std::string getName()
Get the name of this container type for Details::constructContainer()
Definition: Ifpack2_DenseContainer_def.hpp:366
Store and solve a local dense linear problem.
Definition: Ifpack2_DenseContainer_decl.hpp:70
DenseContainer(const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::Array< Teuchos::Array< LO >> &partitions, const Teuchos::RCP< const import_type > &importer, bool pointIndexed)
Constructor.
virtual std::ostream & print(std::ostream &os) const
Print information about this object to the given output stream.
Definition: Ifpack2_DenseContainer_def.hpp:314
typename mv_type::dual_view_type::t_host HostView
Definition: Ifpack2_Container_decl.hpp:105
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given FancyOStream.
Definition: Ifpack2_DenseContainer_def.hpp:343
virtual ~DenseContainer()
Destructor (declared virtual for memory safety of derived classes).
Definition: Ifpack2_DenseContainer_def.hpp:58
static const EVerbosityLevel verbLevel_default
virtual std::string description() const
A one-line description of this object.
Definition: Ifpack2_DenseContainer_def.hpp:324
virtual void initialize()
Do all set-up operations that only require matrix structure.
Definition: Ifpack2_DenseContainer_def.hpp:62