99 typedef MatrixType matrix_type;
102 typedef typename MatrixType::scalar_type scalar_type;
104 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
106 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
108 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
110 typedef typename Container<MatrixType>::node_type node_type;
112 typedef typename Container<MatrixType>::mv_type mv_type;
113 typedef typename Container<MatrixType>::map_type map_type;
114 typedef typename Container<MatrixType>::vector_type vector_type;
115 typedef typename Container<MatrixType>::import_type import_type;
118 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
119 typedef host_view_type HostView;
120 typedef const_host_view_type ConstHostView;
124 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
125 typedef Tpetra::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
127 const Teuchos::Array<Teuchos::Array<local_ordinal_type> > partitions_;
135 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
137 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
138 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
160 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
161 const Teuchos::RCP<const import_type>& importer,
179 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
180 const int n_subparts_per_part = 1,
181 bool overlapCommAndComp =
false,
182 bool useSequentialMethod =
false,
183 const int block_size = -1,
184 const bool explicitConversion =
false);
189 struct ComputeParameters {
196 magnitude_type addRadiallyToDiagonal = KokkosKernels::ArithTraits<magnitude_type>::zero();
200 struct ApplyParameters {
203 bool zeroStartingSolution =
false;
205 scalar_type dampingFactor = KokkosKernels::ArithTraits<scalar_type>::one();
208 int maxNumSweeps = 1;
218 magnitude_type tolerance = KokkosKernels::ArithTraits<magnitude_type>::zero();
226 int checkToleranceEvery = 1;
234 void setParameters(
const Teuchos::ParameterList& List)
override;
236 void clearBlocks()
override;
243 void initialize()
override;
246 void compute()
override;
249 void applyInverseJacobi(
const mv_type& X, mv_type& Y,
250 scalar_type dampingFactor,
251 bool zeroStartingSolution =
false,
252 int numSweeps = 1)
const override;
255 ComputeParameters createDefaultComputeParameters()
const;
268 void compute(
const ComputeParameters& input);
271 ApplyParameters createDefaultApplyParameters()
const;
279 int applyInverseJacobi(
const mv_type& X, mv_type& Y,
280 const ApplyParameters& input)
const;
285 const magnitude_type getNorms0()
const;
289 const magnitude_type getNormsFinal()
const;
294 apply(const_host_view_type X,
297 Teuchos::ETransp mode = Teuchos::NO_TRANS,
298 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
299 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
304 weightedApply(const_host_view_type X,
306 const_host_view_type W,
308 Teuchos::ETransp mode = Teuchos::NO_TRANS,
309 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
310 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
319 std::ostream& print(std::ostream& os)
const override;
326 std::string description()
const override;
330 describe(Teuchos::FancyOStream& out,
331 const Teuchos::EVerbosityLevel verbLevel =
332 Teuchos::Describable::verbLevel_default)
const override;
337 static std::string getName();
344 Teuchos::RCP<BlockTriDiContainerDetails::ImplObject<MatrixType> > impl_;
345 int n_subparts_per_part_;
346 int block_size_ = -1;
349 void initInternal(
const Teuchos::RCP<const row_matrix_type>& matrix,
350 const Teuchos::RCP<const import_type>& importer,
351 const bool overlapCommAndComp,
352 const bool useSeqMethod,
353 const int block_size = -1,
354 const bool explicitConversion =
false);
356 void clearInternal();
359 bool shouldUseFusedBlockJacobi(
360 const Teuchos::RCP<const row_matrix_type>& matrix,
361 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
376 typedef typename MatrixType::scalar_type scalar_type;
377 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
378 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
379 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
381 typedef typename Container<MatrixType>::mv_type mv_type;
382 typedef typename Container<MatrixType>::import_type import_type;
385 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
386 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
388 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
389 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
393 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
394 const Teuchos::RCP<const import_type>& importer,
397 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error: BlockTriDiContainer is not available for this scalar_type");
401 void clearBlocks()
override {}
406 scalar_type dampingFactor,
407 bool zeroStartingSolution =
false,
408 int numSweeps = 1)
const override {}
414 Teuchos::ETransp mode = Teuchos::NO_TRANS,
415 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
416 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
421 const_host_view_type W,
423 Teuchos::ETransp mode = Teuchos::NO_TRANS,
424 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
425 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
427 std::ostream&
print(std::ostream& os)
const override {
428 return os <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
431 std::string description()
const override {
432 return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
436 describe(Teuchos::FancyOStream& out,
437 const Teuchos::EVerbosityLevel verbLevel =
438 Teuchos::Describable::verbLevel_default)
const override {
439 out <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
442 static std::string getName() {
443 return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
void weightedApply(const_host_view_type X, host_view_type Y, const_host_view_type W, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const override
Compute Y := alpha * diag(D) * M^{-1} (diag(D) * X) + beta*Y.
Definition Ifpack2_BlockTriDiContainer_decl.hpp:419