125 typedef MatrixType matrix_type;
128 typedef typename MatrixType::scalar_type scalar_type;
130#if KOKKOS_VERSION >= 40799
131 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
133 typedef typename Kokkos::ArithTraits<scalar_type>::magnitudeType magnitude_type;
136 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
138 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
140 typedef typename Container<MatrixType>::node_type node_type;
142 typedef typename Container<MatrixType>::mv_type mv_type;
143 typedef typename Container<MatrixType>::map_type map_type;
144 typedef typename Container<MatrixType>::vector_type vector_type;
145 typedef typename Container<MatrixType>::import_type import_type;
148 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
149 typedef host_view_type HostView;
150 typedef const_host_view_type ConstHostView;
154 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
155 typedef Tpetra::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
157 const Teuchos::Array<Teuchos::Array<local_ordinal_type> > partitions_;
165 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
167 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
168 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
190 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
191 const Teuchos::RCP<const import_type>& importer,
209 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
210 const int n_subparts_per_part = 1,
211 bool overlapCommAndComp =
false,
212 bool useSequentialMethod =
false,
213 const int block_size = -1,
214 const bool explicitConversion =
false);
219 struct ComputeParameters {
226#if KOKKOS_VERSION >= 40799
227 magnitude_type addRadiallyToDiagonal = KokkosKernels::ArithTraits<magnitude_type>::zero();
229 magnitude_type addRadiallyToDiagonal = Kokkos::ArithTraits<magnitude_type>::zero();
234 struct ApplyParameters {
237 bool zeroStartingSolution =
false;
239#if KOKKOS_VERSION >= 40799
240 scalar_type dampingFactor = KokkosKernels::ArithTraits<scalar_type>::one();
242 scalar_type dampingFactor = Kokkos::ArithTraits<scalar_type>::one();
246 int maxNumSweeps = 1;
256#if KOKKOS_VERSION >= 40799
257 magnitude_type tolerance = KokkosKernels::ArithTraits<magnitude_type>::zero();
259 magnitude_type tolerance = Kokkos::ArithTraits<magnitude_type>::zero();
268 int checkToleranceEvery = 1;
276 void setParameters(
const Teuchos::ParameterList& List)
override;
278 void clearBlocks()
override;
285 void initialize()
override;
288 void compute()
override;
291 void applyInverseJacobi(
const mv_type& X, mv_type& Y,
292 scalar_type dampingFactor,
293 bool zeroStartingSolution =
false,
294 int numSweeps = 1)
const override;
297 ComputeParameters createDefaultComputeParameters()
const;
310 void compute(
const ComputeParameters& input);
313 ApplyParameters createDefaultApplyParameters()
const;
321 int applyInverseJacobi(
const mv_type& X, mv_type& Y,
322 const ApplyParameters& input)
const;
327 const magnitude_type getNorms0()
const;
331 const magnitude_type getNormsFinal()
const;
336 apply(const_host_view_type X,
339 Teuchos::ETransp mode = Teuchos::NO_TRANS,
340 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
341 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
346 weightedApply(const_host_view_type X,
348 const_host_view_type W,
350 Teuchos::ETransp mode = Teuchos::NO_TRANS,
351 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
352 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override;
361 std::ostream& print(std::ostream& os)
const override;
368 std::string description()
const override;
372 describe(Teuchos::FancyOStream& out,
373 const Teuchos::EVerbosityLevel verbLevel =
374 Teuchos::Describable::verbLevel_default)
const override;
379 static std::string getName();
386 Teuchos::RCP<BlockTriDiContainerDetails::ImplObject<MatrixType> > impl_;
387 int n_subparts_per_part_;
388 int block_size_ = -1;
391 void initInternal(
const Teuchos::RCP<const row_matrix_type>& matrix,
392 const Teuchos::RCP<const import_type>& importer,
393 const bool overlapCommAndComp,
394 const bool useSeqMethod,
395 const int block_size = -1,
396 const bool explicitConversion =
false);
398 void clearInternal();
401 bool shouldUseFusedBlockJacobi(
402 const Teuchos::RCP<const row_matrix_type>& matrix,
403 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
418 typedef typename MatrixType::scalar_type scalar_type;
419#if KOKKOS_VERSION >= 40799
420 typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
422 typedef typename Kokkos::ArithTraits<scalar_type>::magnitudeType magnitude_type;
424 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
425 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
427 typedef typename Container<MatrixType>::mv_type mv_type;
428 typedef typename Container<MatrixType>::import_type import_type;
431 typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
432 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
434 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
435 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
439 const Teuchos::Array<Teuchos::Array<local_ordinal_type> >& partitions,
440 const Teuchos::RCP<const import_type>& importer,
443 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error: BlockTriDiContainer is not available for this scalar_type");
447 void clearBlocks()
override {}
452 scalar_type dampingFactor,
453 bool zeroStartingSolution =
false,
454 int numSweeps = 1)
const override {}
460 Teuchos::ETransp mode = Teuchos::NO_TRANS,
461 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
462 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
467 const_host_view_type W,
469 Teuchos::ETransp mode = Teuchos::NO_TRANS,
470 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
471 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const override {}
473 std::ostream&
print(std::ostream& os)
const override {
474 return os <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
477 std::string description()
const override {
478 return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
482 describe(Teuchos::FancyOStream& out,
483 const Teuchos::EVerbosityLevel verbLevel =
484 Teuchos::Describable::verbLevel_default)
const override {
485 out <<
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
488 static std::string getName() {
489 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:465