125 typedef MatrixType matrix_type;
128 typedef typename MatrixType::scalar_type scalar_type;
130 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
132 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
134 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
136 typedef typename Container<MatrixType>::node_type node_type;
138 typedef typename Container<MatrixType>::mv_type mv_type;
139 typedef typename Container<MatrixType>::map_type map_type;
140 typedef typename Container<MatrixType>::vector_type vector_type;
141 typedef typename Container<MatrixType>::import_type import_type;
144 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
145 typedef host_view_type HostView;
146 typedef const_host_view_type ConstHostView;
150 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
151 typedef Tpetra::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
153 const Teuchos::Array<Teuchos::Array<local_ordinal_type> > partitions_;
161 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
163 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
164 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
186 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
187 const Teuchos::RCP<const import_type>& importer,
205 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
206 const int n_subparts_per_part = 1,
207 bool overlapCommAndComp =
false,
208 bool useSequentialMethod =
false,
209 const int block_size = -1,
210 const bool explicitConversion =
false);
215 struct ComputeParameters {
222 magnitude_type addRadiallyToDiagonal = KokkosKernels::ArithTraits<magnitude_type>::zero();
226 struct ApplyParameters {
229 bool zeroStartingSolution =
false;
231 scalar_type dampingFactor = KokkosKernels::ArithTraits<scalar_type>::one();
234 int maxNumSweeps = 1;
244 magnitude_type tolerance = KokkosKernels::ArithTraits<magnitude_type>::zero();
252 int checkToleranceEvery = 1;
260 void setParameters(
const Teuchos::ParameterList& List)
override;
262 void clearBlocks()
override;
269 void initialize()
override;
272 void compute()
override;
275 void applyInverseJacobi(
const mv_type& X, mv_type& Y,
276 scalar_type dampingFactor,
277 bool zeroStartingSolution =
false,
278 int numSweeps = 1)
const override;
281 ComputeParameters createDefaultComputeParameters()
const;
294 void compute(
const ComputeParameters& input);
297 ApplyParameters createDefaultApplyParameters()
const;
305 int applyInverseJacobi(
const mv_type& X, mv_type& Y,
306 const ApplyParameters& input)
const;
311 const magnitude_type getNorms0()
const;
315 const magnitude_type getNormsFinal()
const;
320 apply(const_host_view_type X,
323 Teuchos::ETransp mode = Teuchos::NO_TRANS,
324 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
325 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
330 weightedApply(const_host_view_type X,
332 const_host_view_type W,
334 Teuchos::ETransp mode = Teuchos::NO_TRANS,
335 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
336 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
345 std::ostream& print(std::ostream& os)
const override;
352 std::string description()
const override;
356 describe(Teuchos::FancyOStream& out,
357 const Teuchos::EVerbosityLevel verbLevel =
358 Teuchos::Describable::verbLevel_default)
const override;
363 static std::string getName();
370 Teuchos::RCP<BlockTriDiContainerDetails::ImplObject<MatrixType> > impl_;
371 int n_subparts_per_part_;
372 int block_size_ = -1;
375 void initInternal(
const Teuchos::RCP<const row_matrix_type>& matrix,
376 const Teuchos::RCP<const import_type>& importer,
377 const bool overlapCommAndComp,
378 const bool useSeqMethod,
379 const int block_size = -1,
380 const bool explicitConversion =
false);
382 void clearInternal();
385 bool shouldUseFusedBlockJacobi(
386 const Teuchos::RCP<const row_matrix_type>& matrix,
387 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
402 typedef typename MatrixType::scalar_type scalar_type;
403 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
404 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
405 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
407 typedef typename Container<MatrixType>::mv_type mv_type;
408 typedef typename Container<MatrixType>::import_type import_type;
411 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
412 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
414 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
415 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
419 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
420 const Teuchos::RCP<const import_type>& importer,
423 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error: BlockTriDiContainer is not available for this scalar_type");
427 void clearBlocks()
override {}
432 scalar_type dampingFactor,
433 bool zeroStartingSolution =
false,
434 int numSweeps = 1)
const override {}
440 Teuchos::ETransp mode = Teuchos::NO_TRANS,
441 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
442 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
447 const_host_view_type W,
449 Teuchos::ETransp mode = Teuchos::NO_TRANS,
450 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
451 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
453 std::ostream&
print(std::ostream& os)
const override {
454 return os <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
457 std::string description()
const override {
458 return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
462 describe(Teuchos::FancyOStream& out,
463 const Teuchos::EVerbosityLevel verbLevel =
464 Teuchos::Describable::verbLevel_default)
const override {
465 out <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
468 static std::string getName() {
469 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:445