Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
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"
20#include "Teuchos_SerialDenseMatrix.hpp"
21#include "Tpetra_BlockCrsMatrix_decl.hpp"
22
23namespace Ifpack2 {
24
68
69template<class MatrixType, class LocalScalarType>
71: public ContainerImpl<MatrixType, LocalScalarType>
72{
74
75private:
82 using matrix_type = MatrixType;
84 using LSC = LocalScalarType;
85
87 using typename Container<MatrixType>::SC;
89 using typename Container<MatrixType>::LO;
91 using typename Container<MatrixType>::GO;
93 using typename Container<MatrixType>::NO;
94
95 using typename Container<MatrixType>::mv_type;
96 using local_mv_type = Tpetra::MultiVector<LSC, LO, GO, NO>;
97 using typename Container<MatrixType>::map_type;
98 using typename Container<MatrixType>::vector_type;
99 using typename Container<MatrixType>::import_type;
100
101 using typename Container<MatrixType>::ISC;
102 using typename ContainerImpl<MatrixType, LocalScalarType>::LISC;
103 using typename Container<MatrixType>::HostView;
104 using typename ContainerImpl<MatrixType, LocalScalarType>::HostViewLocal;
105 using typename ContainerImpl<MatrixType, LocalScalarType>::HostSubviewLocal;
106 using typename ContainerImpl<MatrixType, LocalScalarType>::ConstHostSubviewLocal;
107
108 static_assert(std::is_same<MatrixType, Tpetra::RowMatrix<SC, LO, GO, NO>>::value,
109 "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
110
119 using typename Container<MatrixType>::row_matrix_type;
120
121 using block_crs_matrix_type = Tpetra::BlockCrsMatrix<SC, LO, GO, NO>;
123
124public:
126
127
138 DenseContainer (const Teuchos::RCP<const row_matrix_type>& matrix,
139 const Teuchos::Array<Teuchos::Array<LO> >& partitions,
140 const Teuchos::RCP<const import_type>& importer,
141 bool pointIndexed);
142
144
146 virtual ~DenseContainer ();
147
149
151
153
155
157 virtual void initialize ();
158
160 virtual void compute ();
161
162 void clearBlocks();
163
165
167
171 virtual std::ostream& print (std::ostream& os) const;
172
174
176
178 virtual std::string description () const;
179
181 virtual void
182 describe (Teuchos::FancyOStream &out,
183 const Teuchos::EVerbosityLevel verbLevel =
184 Teuchos::Describable::verbLevel_default) const;
185
187
189 static std::string getName();
190
191private:
193 void extract();
194
198 void factor ();
199
208 void
209 solveBlock(ConstHostSubviewLocal X,
210 HostSubviewLocal Y,
211 int blockIndex,
212 Teuchos::ETransp mode,
213 const LSC alpha,
214 const LSC beta) const;
215
217 std::vector<Teuchos::SerialDenseMatrix<int, LSC>> diagBlocks_;
218
220 mutable Teuchos::Array<int> ipiv_;
221
223 bool hasBlockCrsMatrix_;
224
226 Teuchos::Array<LSC> scalars_;
227
229 Teuchos::Array<GO> scalarOffsets_;
230};
231
232} // namespace Ifpack2
233
234#endif // IFPACK2_DENSECONTAINER_DECL_HPP
virtual void extract()=0
Extract the submatrices identified by the local indices set by the constructor. BlockMatrix may be an...
typename Kokkos::ArithTraits< SC >::val_type ISC
Internal representation of Scalar in Kokkos::View.
Definition Ifpack2_Container_decl.hpp:102
typename mv_type::dual_view_type::t_host HostView
Definition Ifpack2_Container_decl.hpp:106
virtual std::string description() const
A one-line description of this object.
Definition Ifpack2_DenseContainer_def.hpp:352
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:375
static std::string getName()
Get the name of this container type for Details::constructContainer().
Definition Ifpack2_DenseContainer_def.hpp:401
virtual std::ostream & print(std::ostream &os) const
Print information about this object to the given output stream.
Definition Ifpack2_DenseContainer_def.hpp:341
virtual void compute()
Extract the local diagonal block and prepare the solver.
Definition Ifpack2_DenseContainer_def.hpp:81
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.
Definition Ifpack2_DenseContainer_def.hpp:28
virtual ~DenseContainer()
Destructor (declared virtual for memory safety of derived classes).
Definition Ifpack2_DenseContainer_def.hpp:60
virtual void initialize()
Do all set-up operations that only require matrix structure.
Definition Ifpack2_DenseContainer_def.hpp:65
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41