44#ifndef IFPACK2_ADDITIVE_SCHWARZ_FILTER_DECL_HPP
45#define IFPACK2_ADDITIVE_SCHWARZ_FILTER_DECL_HPP
54#include "Ifpack2_ConfigDefs.hpp"
55#include "Ifpack2_Details_RowMatrix.hpp"
56#include "Ifpack2_OverlappingRowMatrix.hpp"
62 template<
typename MatrixType>
66 typedef typename MatrixType::scalar_type scalar_type;
67 typedef typename Kokkos::ArithTraits<scalar_type>::val_type impl_scalar_type;
68 typedef typename MatrixType::local_ordinal_type local_ordinal_type;
69 typedef typename MatrixType::global_ordinal_type global_ordinal_type;
70 typedef typename MatrixType::node_type node_type;
71 typedef typename MatrixType::global_inds_host_view_type global_inds_host_view_type;
72 typedef typename MatrixType::local_inds_host_view_type local_inds_host_view_type;
73 typedef typename MatrixType::values_host_view_type values_host_view_type;
75 typedef typename MatrixType::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
76 typedef typename MatrixType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
77 typedef typename MatrixType::nonconst_values_host_view_type nonconst_values_host_view_type;
79 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
80 typedef Tpetra::RowMatrix<scalar_type,
83 node_type> row_matrix_type;
84 typedef Tpetra::CrsMatrix<scalar_type,
87 node_type> crs_matrix_type;
88 typedef Tpetra::MultiVector<scalar_type,
92 typedef typename crs_matrix_type::device_type device_type;
93 typedef typename crs_matrix_type::execution_space execution_space;
94 typedef Kokkos::RangePolicy<execution_space> policy_type;
95 typedef Kokkos::MDRangePolicy<execution_space, Kokkos::Rank<2>> policy_2d_type;
97 typedef typename crs_matrix_type::local_matrix_device_type local_matrix_type;
98 typedef typename local_matrix_type::size_type size_type;
99 typedef typename local_matrix_type::row_map_type::non_const_type row_map_type;
100 typedef typename local_matrix_type::index_type entries_type;
101 typedef typename local_matrix_type::values_type values_type;
102 typedef typename row_map_type::HostMirror host_row_map_type;
103 typedef typename entries_type::HostMirror host_entries_type;
104 typedef typename values_type::HostMirror host_values_type;
105 typedef typename local_matrix_type::HostMirror host_local_matrix_type;
107 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.");
109 typedef Tpetra::Map<local_ordinal_type,
113 typedef typename row_matrix_type::mag_type mag_type;
136 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
137 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
138 bool filterSingletons);
141 void updateMatrixValues();
143 Teuchos::RCP<const crs_matrix_type> getFilteredMatrix()
const;
153 virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm()
const;
156 virtual Teuchos::RCP<const map_type> getRowMap()
const;
159 virtual Teuchos::RCP<const map_type> getColMap()
const;
162 virtual Teuchos::RCP<const map_type> getDomainMap()
const;
165 virtual Teuchos::RCP<const map_type> getRangeMap()
const;
168 virtual Teuchos::RCP<const Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > getGraph()
const;
171 virtual global_size_t getGlobalNumRows()
const;
174 virtual global_size_t getGlobalNumCols()
const;
177 virtual size_t getLocalNumRows()
const;
180 virtual size_t getLocalNumCols()
const;
183 virtual global_ordinal_type getIndexBase()
const;
186 virtual global_size_t getGlobalNumEntries()
const;
189 virtual size_t getLocalNumEntries()
const;
197 virtual size_t getNumEntriesInGlobalRow (global_ordinal_type globalRow)
const;
205 virtual size_t getNumEntriesInLocalRow (local_ordinal_type localRow)
const;
208 virtual size_t getGlobalMaxNumRowEntries()
const;
211 virtual size_t getLocalMaxNumRowEntries()
const;
214 virtual bool hasColMap()
const;
217 virtual bool isLocallyIndexed()
const;
220 virtual bool isGloballyIndexed()
const;
223 virtual bool isFillComplete()
const;
226 virtual bool supportsRowViews()
const;
245 getGlobalRowCopy (global_ordinal_type GlobalRow,
246 nonconst_global_inds_host_view_type &Indices,
247 nonconst_values_host_view_type &Values,
248 size_t& NumEntries)
const;
261 getLocalRowCopy (local_ordinal_type LocalRow,
262 nonconst_local_inds_host_view_type &Indices,
263 nonconst_values_host_view_type &Values,
264 size_t& NumEntries)
const;
276 getGlobalRowView (global_ordinal_type GlobalRow,
277 global_inds_host_view_type &indices,
278 values_host_view_type &values)
const;
290 getLocalRowView (local_ordinal_type LocalRow,
291 local_inds_host_view_type & indices,
292 values_host_view_type & values)
const;
296 virtual void getLocalDiagCopy(Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &diag)
const;
312 virtual void leftScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
323 virtual void rightScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
329 virtual mag_type getFrobeniusNorm()
const;
353 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
354 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
355 Teuchos::ETransp mode = Teuchos::NO_TRANS,
356 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
357 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
360 virtual bool hasTransposeApply()
const;
363 void CreateReducedProblem(
364 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingB,
365 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingY,
366 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ReducedReorderedB)
const;
370 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ReducedReorderedY,
371 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingY)
const;
373 void setup(
const Teuchos::RCP<const row_matrix_type>& A_unfiltered,
374 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
375 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
376 bool filterSingletons);
382 void fillLocalMatrix(local_matrix_type localMatrix);
401 mapPairIsFitted (
const map_type& map1,
const map_type& map2);
409 mapPairsAreFitted (
const row_matrix_type& A);
412 Teuchos::RCP<const row_matrix_type> A_unfiltered_;
414 Teuchos::RCP<crs_matrix_type> A_;
416 Kokkos::DualView<local_ordinal_type*, device_type> perm_;
418 Kokkos::DualView<local_ordinal_type*, device_type> reverseperm_;
419 local_ordinal_type numSingletons_;
421 Kokkos::DualView<local_ordinal_type*, device_type> singletons_;
423 Kokkos::DualView<impl_scalar_type*, device_type> singletonDiagonals_;
427 bool FilterSingletons_;
430 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:67
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition Ifpack2_OverlappingRowMatrix_decl.hpp:59
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74