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"
29 template<
typename MatrixType>
33 typedef typename MatrixType::scalar_type scalar_type;
34 typedef typename Kokkos::ArithTraits<scalar_type>::val_type impl_scalar_type;
35 typedef typename MatrixType::local_ordinal_type local_ordinal_type;
36 typedef typename MatrixType::global_ordinal_type global_ordinal_type;
37 typedef typename MatrixType::node_type node_type;
38 typedef typename MatrixType::global_inds_host_view_type global_inds_host_view_type;
39 typedef typename MatrixType::local_inds_host_view_type local_inds_host_view_type;
40 typedef typename MatrixType::values_host_view_type values_host_view_type;
42 typedef typename MatrixType::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
43 typedef typename MatrixType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
44 typedef typename MatrixType::nonconst_values_host_view_type nonconst_values_host_view_type;
46 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
47 typedef Tpetra::RowMatrix<scalar_type,
50 node_type> row_matrix_type;
51 typedef Tpetra::CrsMatrix<scalar_type,
54 node_type> crs_matrix_type;
55 typedef Tpetra::MultiVector<scalar_type,
59 typedef typename crs_matrix_type::device_type device_type;
60 typedef typename crs_matrix_type::execution_space execution_space;
61 typedef Kokkos::RangePolicy<execution_space> policy_type;
62 typedef Kokkos::MDRangePolicy<execution_space, Kokkos::Rank<2>> policy_2d_type;
64 typedef typename crs_matrix_type::local_matrix_device_type local_matrix_type;
65 typedef typename local_matrix_type::size_type size_type;
66 typedef typename local_matrix_type::row_map_type::non_const_type row_map_type;
67 typedef typename local_matrix_type::index_type entries_type;
68 typedef typename local_matrix_type::values_type values_type;
69 typedef typename row_map_type::HostMirror host_row_map_type;
70 typedef typename entries_type::HostMirror host_entries_type;
71 typedef typename values_type::HostMirror host_values_type;
72 typedef typename local_matrix_type::HostMirror host_local_matrix_type;
74 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.");
76 typedef Tpetra::Map<local_ordinal_type,
80 typedef typename row_matrix_type::mag_type mag_type;
103 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
104 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
105 bool filterSingletons);
108 void updateMatrixValues();
110 Teuchos::RCP<const crs_matrix_type> getFilteredMatrix()
const;
120 virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm()
const;
123 virtual Teuchos::RCP<const map_type> getRowMap()
const;
126 virtual Teuchos::RCP<const map_type> getColMap()
const;
129 virtual Teuchos::RCP<const map_type> getDomainMap()
const;
132 virtual Teuchos::RCP<const map_type> getRangeMap()
const;
135 virtual Teuchos::RCP<const Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > getGraph()
const;
138 virtual local_ordinal_type getBlockSize()
const;
141 virtual global_size_t getGlobalNumRows()
const;
144 virtual global_size_t getGlobalNumCols()
const;
147 virtual size_t getLocalNumRows()
const;
150 virtual size_t getLocalNumCols()
const;
153 virtual global_ordinal_type getIndexBase()
const;
156 virtual global_size_t getGlobalNumEntries()
const;
159 virtual size_t getLocalNumEntries()
const;
167 virtual size_t getNumEntriesInGlobalRow (global_ordinal_type globalRow)
const;
175 virtual size_t getNumEntriesInLocalRow (local_ordinal_type localRow)
const;
178 virtual size_t getGlobalMaxNumRowEntries()
const;
181 virtual size_t getLocalMaxNumRowEntries()
const;
184 virtual bool hasColMap()
const;
187 virtual bool isLocallyIndexed()
const;
190 virtual bool isGloballyIndexed()
const;
193 virtual bool isFillComplete()
const;
196 virtual bool supportsRowViews()
const;
215 getGlobalRowCopy (global_ordinal_type GlobalRow,
216 nonconst_global_inds_host_view_type &Indices,
217 nonconst_values_host_view_type &Values,
218 size_t& NumEntries)
const;
231 getLocalRowCopy (local_ordinal_type LocalRow,
232 nonconst_local_inds_host_view_type &Indices,
233 nonconst_values_host_view_type &Values,
234 size_t& NumEntries)
const;
246 getGlobalRowView (global_ordinal_type GlobalRow,
247 global_inds_host_view_type &indices,
248 values_host_view_type &values)
const;
260 getLocalRowView (local_ordinal_type LocalRow,
261 local_inds_host_view_type & indices,
262 values_host_view_type & values)
const;
266 virtual void getLocalDiagCopy(Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &diag)
const;
282 virtual void leftScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
293 virtual void rightScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x);
299 virtual mag_type getFrobeniusNorm()
const;
323 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
324 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
325 Teuchos::ETransp mode = Teuchos::NO_TRANS,
326 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
327 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
330 virtual bool hasTransposeApply()
const;
333 void CreateReducedProblem(
334 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingB,
335 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingY,
336 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ReducedReorderedB)
const;
340 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ReducedReorderedY,
341 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& OverlappingY)
const;
343 void setup(
const Teuchos::RCP<const row_matrix_type>& A_unfiltered,
344 const Teuchos::ArrayRCP<local_ordinal_type>& perm,
345 const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm,
346 bool filterSingletons);
352 void fillLocalMatrix(local_matrix_type localMatrix);
371 mapPairIsFitted (
const map_type& map1,
const map_type& map2);
379 mapPairsAreFitted (
const row_matrix_type& A);
382 Teuchos::RCP<const row_matrix_type> A_unfiltered_;
384 Teuchos::RCP<crs_matrix_type> A_;
386 Kokkos::DualView<local_ordinal_type*, device_type> perm_;
388 Kokkos::DualView<local_ordinal_type*, device_type> reverseperm_;
389 local_ordinal_type numSingletons_;
391 Kokkos::DualView<local_ordinal_type*, device_type> singletons_;
393 Kokkos::DualView<impl_scalar_type*, device_type> singletonDiagonals_;
397 bool FilterSingletons_;
400 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:34
Sparse matrix (Tpetra::RowMatrix subclass) with ghost rows.
Definition Ifpack2_OverlappingRowMatrix_decl.hpp:26
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41