43 #ifndef IFPACK2_BLOCKRELAXATION_DECL_HPP 44 #define IFPACK2_BLOCKRELAXATION_DECL_HPP 50 #include "Ifpack2_Partitioner.hpp" 52 #include "Teuchos_Time.hpp" 53 #include "Tpetra_Experimental_BlockCrsMatrix_decl.hpp" 54 #include <type_traits> 80 template<
class MatrixType,
class ContainerType>
83 typename MatrixType::local_ordinal_type,
84 typename MatrixType::global_ordinal_type,
85 typename MatrixType::node_type>,
87 typename MatrixType::local_ordinal_type,
88 typename MatrixType::global_ordinal_type,
89 typename MatrixType::node_type> >
108 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
111 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
113 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
114 "Ifpack2::BlockRelaxation: Please use MatrixType = Tpetra::RowMatrix.");
149 explicit BlockRelaxation (
const Teuchos::RCP<const row_matrix_type>& Matrix);
193 return(IsInitialized_);
196 void computeBlockCrs();
233 setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
250 void apply(
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
251 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
252 Teuchos::ETransp mode = Teuchos::NO_TRANS,
253 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
254 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
257 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
getDomainMap()
const;
260 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
getRangeMap()
const;
262 bool hasTransposeApply()
const;
271 void applyMat(
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
272 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
273 Teuchos::ETransp mode = Teuchos::NO_TRANS)
const;
280 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const;
283 Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> >
getMatrix()
const;
318 describe (Teuchos::FancyOStream& out,
319 const Teuchos::EVerbosityLevel verbLevel =
320 Teuchos::Describable::verbLevel_default)
const;
325 Teuchos::RCP<Ifpack2::Partitioner<Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > >
getPartitioner(){
return Partitioner_;}
332 typedef Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> vector_type;
333 typedef Teuchos::ScalarTraits<scalar_type> STS;
334 typedef Teuchos::ScalarTraits<magnitude_type> STM;
346 virtual void ApplyInverseJacobi (
const MV& X, MV& Y)
const;
348 virtual void DoJacobi (
const MV& X, MV& Y)
const;
350 virtual void ApplyInverseGS (
const MV& X, MV& Y)
const;
352 virtual void DoGaussSeidel (MV& X, MV& Y)
const;
354 virtual void ApplyInverseSGS (
const MV& X, MV& Y)
const;
356 virtual void DoSGS (MV& X, MV& Y)
const;
358 void ExtractSubmatrices ();
360 void getMatDiag()
const;
367 Teuchos::RCP<const row_matrix_type> A_;
370 Teuchos::RCP<Teuchos::Time> Time_;
373 Teuchos::RCP<const Tpetra::Import<local_ordinal_type,global_ordinal_type,node_type> > Importer_;
376 Teuchos::RCP<vector_type> W_;
382 mutable std::vector<Teuchos::RCP<ContainerType> > Containers_;
389 mutable Teuchos::RCP<vector_type> DiagRCP_;
392 Teuchos::RCP<Ifpack2::Partitioner<Tpetra::RowGraph<local_ordinal_type,global_ordinal_type,node_type> > > Partitioner_;
394 std::string PartitionerType_;
397 Teuchos::ParameterList List_;
403 local_ordinal_type NumLocalBlocks_;
406 Details::RelaxationType PrecType_;
409 scalar_type DampingFactor_;
415 bool ZeroStartingSolution_;
433 mutable int NumApply_;
436 double InitializeTime_;
442 mutable double ApplyTime_;
445 double ComputeFlops_;
448 mutable double ApplyFlops_;
454 global_size_t NumGlobalRows_;
457 global_size_t NumGlobalNonzeros_;
459 bool hasBlockCrsMatrix_;
465 #endif // IFPACK2_BLOCKRELAXATION_DECL_HPP double getApplyFlops() const
Returns the number of flops for the application of the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:291
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:385
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the input matrix is distributed.
Definition: Ifpack2_BlockRelaxation_def.hpp:180
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:102
std::string description() const
A one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:1146
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:275
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:251
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:217
int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:243
void setParameters(const Teuchos::ParameterList ¶ms)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:117
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:548
Block relaxation preconditioners (or smoothers) for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse ma...
Definition: Ifpack2_BlockRelaxation_decl.hpp:81
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:259
double getComputeFlops() const
Returns the number of flops in the computation phase.
Definition: Ifpack2_BlockRelaxation_def.hpp:283
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:267
bool isComputed() const
Return true if compute() has been called.
Definition: Ifpack2_BlockRelaxation_decl.hpp:202
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_BlockRelaxation_decl.hpp:108
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:111
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:111
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:203
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack2_BlockRelaxation_decl.hpp:192
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:236
Declaration of interface for preconditioners that can change their matrix after construction.
void initialize()
Initialize.
Definition: Ifpack2_BlockRelaxation_def.hpp:401
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:1192
MatrixType::node_type node_type
Node type of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:105
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:99
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:96
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:194
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:299
Teuchos::RCP< Ifpack2::Partitioner< Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > > getPartitioner()
For diagnostic purposes.
Definition: Ifpack2_BlockRelaxation_decl.hpp:325
BlockRelaxation(const Teuchos::RCP< const row_matrix_type > &Matrix)
Constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:81