43 #ifndef IFPACK2_BLOCKRELAXATION_DECL_HPP 44 #define IFPACK2_BLOCKRELAXATION_DECL_HPP 50 #include "Ifpack2_Partitioner.hpp" 52 #include "Teuchos_Time.hpp" 53 #include <type_traits> 79 template<
class MatrixType,
class ContainerType>
82 typename MatrixType::local_ordinal_type,
83 typename MatrixType::global_ordinal_type,
84 typename MatrixType::node_type>,
86 typename MatrixType::local_ordinal_type,
87 typename MatrixType::global_ordinal_type,
88 typename MatrixType::node_type> >
107 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
110 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
112 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
113 "Ifpack2::BlockRelaxation: Please use MatrixType = Tpetra::RowMatrix.");
148 explicit BlockRelaxation (
const Teuchos::RCP<const row_matrix_type>& Matrix);
182 return(IsInitialized_);
220 setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
237 void apply(
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
238 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
239 Teuchos::ETransp mode = Teuchos::NO_TRANS,
240 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
241 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
244 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
getDomainMap()
const;
247 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
getRangeMap()
const;
249 bool hasTransposeApply()
const;
258 void applyMat(
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
259 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
260 Teuchos::ETransp mode = Teuchos::NO_TRANS)
const;
267 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const;
270 Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> >
getMatrix()
const;
305 describe (Teuchos::FancyOStream& out,
306 const Teuchos::EVerbosityLevel verbLevel =
307 Teuchos::Describable::verbLevel_default)
const;
312 Teuchos::RCP<Ifpack2::Partitioner<Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > >
getPartitioner(){
return Partitioner_;}
319 typedef Teuchos::ScalarTraits<scalar_type> STS;
320 typedef Teuchos::ScalarTraits<magnitude_type> STM;
330 virtual void ApplyInverseJacobi (
const MV& X, MV& Y)
const;
332 virtual void DoJacobi (
const MV& X, MV& Y)
const;
334 virtual void ApplyInverseGS (
const MV& X, MV& Y)
const;
336 virtual void DoGaussSeidel (MV& X, MV& Y)
const;
338 virtual void ApplyInverseSGS (
const MV& X, MV& Y)
const;
340 virtual void DoSGS (MV& X, MV& Y)
const;
342 void ExtractSubmatrices ();
349 Teuchos::RCP<const row_matrix_type> A_;
352 Teuchos::RCP<Teuchos::Time> Time_;
355 Teuchos::RCP<const Tpetra::Import<local_ordinal_type,global_ordinal_type,node_type> > Importer_;
358 Teuchos::RCP<Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > W_;
364 mutable std::vector<Teuchos::RCP<ContainerType> > Containers_;
372 Teuchos::ArrayRCP< const scalar_type > DiagRCP;
375 Teuchos::RCP<Ifpack2::Partitioner<Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > > Partitioner_;
377 std::string PartitionerType_;
380 Teuchos::ParameterList List_;
386 local_ordinal_type NumLocalBlocks_;
389 Details::RelaxationType PrecType_;
392 scalar_type DampingFactor_;
398 bool ZeroStartingSolution_;
416 mutable int NumApply_;
419 double InitializeTime_;
425 mutable double ApplyTime_;
428 double ComputeFlops_;
431 mutable double ApplyFlops_;
437 global_size_t NumGlobalRows_;
440 global_size_t NumGlobalNonzeros_;
446 #endif // IFPACK2_BLOCKRELAXATION_DECL_HPP double getApplyFlops() const
Returns the number of flops for the application of the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:264
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
void applyMat(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS) const
Applies the matrix to a Tpetra::MultiVector.
Definition: Ifpack2_BlockRelaxation_def.hpp:346
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the input matrix is distributed.
Definition: Ifpack2_BlockRelaxation_def.hpp:182
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:101
std::string description() const
A one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:904
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:252
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:234
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:210
int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:228
void setParameters(const Teuchos::ParameterList ¶ms)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:119
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:422
Block relaxation preconditioners (or smoothers) for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse ma...
Definition: Ifpack2_BlockRelaxation_decl.hpp:80
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:240
double getComputeFlops() const
Returns the number of flops in the computation phase.
Definition: Ifpack2_BlockRelaxation_def.hpp:258
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:246
bool isComputed() const
Return true if compute() has been called.
Definition: Ifpack2_BlockRelaxation_decl.hpp:189
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_BlockRelaxation_decl.hpp:107
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Tpetra::RowMatrix specialization corresponding to MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:110
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_BlockRelaxation_def.hpp:57
virtual ~BlockRelaxation()
Destructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:113
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:201
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack2_BlockRelaxation_decl.hpp:181
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:222
Declaration of interface for preconditioners that can change their matrix after construction.
void initialize()
Initialize.
Definition: Ifpack2_BlockRelaxation_def.hpp:366
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Definition: Ifpack2_BlockRelaxation_def.hpp:950
MatrixType::node_type node_type
Node type of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:104
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:98
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:95
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
Teuchos::RCP< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > getMatrix() const
The input matrix of this preconditioner's constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:192
void apply(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
Applies the preconditioner to X, returns the result in Y.
Definition: Ifpack2_BlockRelaxation_def.hpp:272
Teuchos::RCP< Ifpack2::Partitioner< Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > > getPartitioner()
For diagnostic purposes.
Definition: Ifpack2_BlockRelaxation_decl.hpp:312
BlockRelaxation(const Teuchos::RCP< const row_matrix_type > &Matrix)
Constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:80