11#ifndef IFPACK2_ADDITIVE_SCHWARZ_FILTER_DECL_HPP
12#define IFPACK2_ADDITIVE_SCHWARZ_FILTER_DECL_HPP
21#include "Ifpack2_ConfigDefs.hpp"
22#include "Ifpack2_Details_RowMatrix.hpp"
23#include "Ifpack2_OverlappingRowMatrix.hpp"
27template <
typename MatrixType>
30 typedef typename MatrixType::scalar_type scalar_type;
31#if KOKKOS_VERSION >= 40799
32 typedef typename KokkosKernels::ArithTraits<scalar_type>::val_type impl_scalar_type;
34 typedef typename Kokkos::ArithTraits<scalar_type>::val_type impl_scalar_type;
36 typedef typename MatrixType::local_ordinal_type local_ordinal_type;
37 typedef typename MatrixType::global_ordinal_type global_ordinal_type;
38 typedef typename MatrixType::node_type node_type;
39 typedef typename MatrixType::global_inds_host_view_type global_inds_host_view_type;
40 typedef typename MatrixType::local_inds_host_view_type local_inds_host_view_type;
41 typedef typename MatrixType::values_host_view_type values_host_view_type;
43 typedef typename MatrixType::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
44 typedef typename MatrixType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
45 typedef typename MatrixType::nonconst_values_host_view_type nonconst_values_host_view_type;
47 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
48 typedef Tpetra::RowMatrix<scalar_type,
53 typedef Tpetra::CrsMatrix<scalar_type,
58 typedef Tpetra::MultiVector<scalar_type,
63 typedef typename crs_matrix_type::device_type device_type;
64 typedef typename crs_matrix_type::execution_space execution_space;
65 typedef Kokkos::RangePolicy<execution_space> policy_type;
66 typedef Kokkos::MDRangePolicy<execution_space, Kokkos::Rank<2>> policy_2d_type;
68 typedef typename crs_matrix_type::local_matrix_device_type local_matrix_type;
69 typedef typename local_matrix_type::size_type size_type;
70 typedef typename local_matrix_type::row_map_type::non_const_type row_map_type;
71 typedef typename local_matrix_type::index_type entries_type;
72 typedef typename local_matrix_type::values_type values_type;
73 typedef typename row_map_type::host_mirror_type host_row_map_type;
74 typedef typename entries_type::host_mirror_type host_entries_type;
75 typedef typename values_type::host_mirror_type host_values_type;
76#if KOKKOS_VERSION >= 40799
77 typedef typename local_matrix_type::host_mirror_type host_local_matrix_type;
79 typedef typename local_matrix_type::HostMirror host_local_matrix_type;
82 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::AdditiveSchwarzFilter: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore. The constructor can take either a RowMatrix or a CrsMatrix just fine.");
84 typedef Tpetra::Map<local_ordinal_type,
89 typedef typename row_matrix_type::mag_type mag_type;
112 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
113 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
114 bool filterSingletons);
117 void updateMatrixValues();
119 Teuchos::RCP<const crs_matrix_type> getFilteredMatrix()
const;
129 virtual Teuchos::RCP<const Teuchos::Comm<int>> getComm()
const;
132 virtual Teuchos::RCP<const map_type> getRowMap()
const;
135 virtual Teuchos::RCP<const map_type> getColMap()
const;
138 virtual Teuchos::RCP<const map_type> getDomainMap()
const;
141 virtual Teuchos::RCP<const map_type> getRangeMap()
const;
144 virtual Teuchos::RCP<const Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type>> getGraph()
const;
147 virtual local_ordinal_type getBlockSize()
const;
150 virtual global_size_t getGlobalNumRows()
const;
153 virtual global_size_t getGlobalNumCols()
const;
156 virtual size_t getLocalNumRows()
const;
159 virtual size_t getLocalNumCols()
const;
162 virtual global_ordinal_type getIndexBase()
const;
165 virtual global_size_t getGlobalNumEntries()
const;
168 virtual size_t getLocalNumEntries()
const;
176 virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow)
const;
184 virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow)
const;
187 virtual size_t getGlobalMaxNumRowEntries()
const;
190 virtual size_t getLocalMaxNumRowEntries()
const;
193 virtual bool hasColMap()
const;
196 virtual bool isLocallyIndexed()
const;
199 virtual bool isGloballyIndexed()
const;
202 virtual bool isFillComplete()
const;
205 virtual bool supportsRowViews()
const;
224 getGlobalRowCopy(global_ordinal_type GlobalRow,
225 nonconst_global_inds_host_view_type& Indices,
226 nonconst_values_host_view_type& Values,
227 size_t& NumEntries)
const;
240 getLocalRowCopy(local_ordinal_type LocalRow,
241 nonconst_local_inds_host_view_type& Indices,
242 nonconst_values_host_view_type& Values,
243 size_t& NumEntries)
const;
255 getGlobalRowView(global_ordinal_type GlobalRow,
256 global_inds_host_view_type& indices,
257 values_host_view_type& values)
const;
269 getLocalRowView(local_ordinal_type LocalRow,
270 local_inds_host_view_type& indices,
271 values_host_view_type& values)
const;
275 virtual void getLocalDiagCopy(Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& diag)
const;
291 virtual void leftScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
302 virtual void rightScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
308 virtual mag_type getFrobeniusNorm()
const;
332 apply(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
333 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
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;
339 virtual bool hasTransposeApply()
const;
342 void CreateReducedProblem(
343 const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& OverlappingB,
344 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& OverlappingY,
345 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& ReducedReorderedB)
const;
349 const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& ReducedReorderedY,
350 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& OverlappingY)
const;
352 void setup(
const Teuchos::RCP<const row_matrix_type>& A_unfiltered,
353 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
354 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
355 bool filterSingletons);
361 void fillLocalMatrix(local_matrix_type localMatrix);
379 mapPairIsFitted(
const map_type& map1,
const map_type& map2);
387 mapPairsAreFitted(
const row_matrix_type& A);
390 Teuchos::RCP<const row_matrix_type> A_unfiltered_;
392 Teuchos::RCP<crs_matrix_type> A_;
394 Kokkos::DualView<local_ordinal_type*, device_type> perm_;
396 Kokkos::DualView<local_ordinal_type*, device_type> reverseperm_;
397 local_ordinal_type numSingletons_;
399 Kokkos::DualView<local_ordinal_type*, device_type> singletons_;
401 Kokkos::DualView<impl_scalar_type*, device_type> singletonDiagonals_;
405 bool FilterSingletons_;
408 Teuchos::RCP<const map_type> localMap_;
Wraps a Tpetra::CrsMatrix or Ifpack2::OverlappingRowMatrix in a filter that removes off-process edges...
All Ifpack2 implementations of Tpetra::RowMatrix must inherit from this class.
Definition Ifpack2_Details_RowMatrix.hpp:33
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition Ifpack2_OverlappingRowMatrix_decl.hpp:25
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:40