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.");
165 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
166 const Teuchos::RCP<const import_type>& importer,
189 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
190 const int n_subparts_per_part = 1,
191 bool overlapCommAndComp =
false,
192 bool useSequentialMethod =
false,
193 const int block_size = -1,
194 const bool explicitConversion =
false);
199 struct ComputeParameters {
206 magnitude_type addRadiallyToDiagonal = KokkosKernels::ArithTraits<magnitude_type>::zero();
210 struct ApplyParameters {
213 bool zeroStartingSolution =
false;
215 scalar_type dampingFactor = KokkosKernels::ArithTraits<scalar_type>::one();
218 int maxNumSweeps = 1;
228 magnitude_type tolerance = KokkosKernels::ArithTraits<magnitude_type>::zero();
236 int checkToleranceEvery = 1;
244 void setParameters(
const Teuchos::ParameterList& List)
override;
246 void clearBlocks()
override;
253 void initialize()
override;
256 void compute()
override;
259 void applyInverseJacobi(
const mv_type& X, mv_type& Y,
260 scalar_type dampingFactor,
261 bool zeroStartingSolution =
false,
262 int numSweeps = 1)
const override;
265 ComputeParameters createDefaultComputeParameters()
const;
280 void compute(
const ComputeParameters& input);
283 ApplyParameters createDefaultApplyParameters()
const;
291 int applyInverseJacobi(
const mv_type& X, mv_type& Y,
292 const ApplyParameters& input)
const;
297 const magnitude_type getNorms0()
const;
301 const magnitude_type getNormsFinal()
const;
306 apply(const_host_view_type X,
309 Teuchos::ETransp mode = Teuchos::NO_TRANS,
310 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
311 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
316 weightedApply(const_host_view_type X,
318 const_host_view_type W,
320 Teuchos::ETransp mode = Teuchos::NO_TRANS,
321 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
322 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
331 std::ostream& print(std::ostream& os)
const override;
338 std::string description()
const override;
342 describe(Teuchos::FancyOStream& out,
343 const Teuchos::EVerbosityLevel verbLevel =
344 Teuchos::Describable::verbLevel_default)
const override;
349 static std::string getName();
356 Teuchos::RCP<BlockTriDiContainerDetails::ImplObject<MatrixType> > impl_;
357 int n_subparts_per_part_;
358 int block_size_ = -1;
361 void initInternal(
const Teuchos::RCP<const row_matrix_type>& matrix,
362 const Teuchos::RCP<const import_type>& importer,
363 const bool overlapCommAndComp,
364 const bool useSeqMethod,
365 const int block_size = -1,
366 const bool explicitConversion =
false);
368 void clearInternal();
371 bool shouldUseFusedBlockJacobi(
372 const Teuchos::RCP<const row_matrix_type>& matrix,
373 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
388 typedef typename MatrixType::scalar_type scalar_type;
389 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
390 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
391 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
393 typedef typename Container<MatrixType>::mv_type mv_type;
394 typedef typename Container<MatrixType>::import_type import_type;
397 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
398 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
400 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
401 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
405 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
406 const Teuchos::RCP<const import_type>& importer,
409 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error: BlockTriDiContainer is not available for this scalar_type");
413 void clearBlocks()
override {}
418 scalar_type dampingFactor,
419 bool zeroStartingSolution =
false,
420 int numSweeps = 1)
const override {}
426 Teuchos::ETransp mode = Teuchos::NO_TRANS,
427 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
428 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
433 const_host_view_type W,
435 Teuchos::ETransp mode = Teuchos::NO_TRANS,
436 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
437 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
439 std::ostream&
print(std::ostream& os)
const override {
440 return os <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
443 std::string description()
const override {
444 return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
448 describe(Teuchos::FancyOStream& out,
449 const Teuchos::EVerbosityLevel verbLevel =
450 Teuchos::Describable::verbLevel_default)
const override {
451 out <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
454 static std::string getName() {
455 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:431