43 #ifndef IFPACK2_BLOCKRELAXATION_DECL_HPP
44 #define IFPACK2_BLOCKRELAXATION_DECL_HPP
46 #include "Ifpack2_ConfigDefs.hpp"
47 #include "Ifpack2_Preconditioner.hpp"
48 #include "Ifpack2_Condest.hpp"
49 #include "Ifpack2_Parameters.hpp"
50 #include "Ifpack2_Partitioner.hpp"
52 #include <Tpetra_Vector.hpp>
54 #include <Teuchos_Assert.hpp>
136 template<
class MatrixType,
class ContainerType>
137 class BlockRelaxation :
virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> {
140 typedef typename MatrixType::scalar_type Scalar;
141 typedef typename MatrixType::local_ordinal_type LocalOrdinal;
142 typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
143 typedef typename MatrixType::node_type Node;
184 return(IsInitialized_);
211 void apply(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
212 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
223 bool hasTransposeApply()
const;
232 void applyMat(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
233 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y,
243 LocalOrdinal MaxIters = 1550,
244 magnitudeType Tol = 1e-9,
245 const Teuchos::Ptr<
const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &matrix = Teuchos::null);
308 virtual void ApplyInverseJacobi(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
309 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
311 virtual void DoJacobi(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
312 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
314 virtual void ApplyInverseGS(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
315 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
317 virtual void DoGaussSeidel(Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
318 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
320 virtual void ApplyInverseSGS(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
321 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
323 virtual void DoSGS(
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X,
324 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Xtmp,
325 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y)
const;
327 void ExtractSubmatrices();
345 mutable std::vector<Teuchos::RCP<ContainerType> > Containers_;
348 std::string PartitionerType_;
356 LocalOrdinal NumLocalBlocks_;
360 Scalar MinDiagonalValue_;
362 Scalar DampingFactor_;
366 bool ZeroStartingSolution_;
370 magnitudeType Condest_;
380 mutable int NumApply_;
382 double InitializeTime_;
386 mutable double ApplyTime_;
388 double ComputeFlops_;
390 mutable double ApplyFlops_;
394 global_size_t NumGlobalRows_;
396 global_size_t NumGlobalNonzeros_;
404 #endif // IFPACK2_BLOCKRELAXATION_DECL_HPP
magnitudeType computeCondEst(CondestType CT=Cheap, LocalOrdinal MaxIters=1550, magnitudeType Tol=1e-9, const Teuchos::Ptr< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &matrix=Teuchos::null)
Computes the estimated condition number and returns the value.
Definition: Ifpack2_BlockRelaxation_def.hpp:247
double getApplyFlops() const
Returns the number of flops for the application of the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:232
CondestType
Ifpack2::CondestType: enum to define the type of condition number estimate.
Definition: Ifpack2_CondestType.hpp:50
const Teuchos::RCP< const Teuchos::Comm< int > > & getComm() const
Returns the Tpetra::BlockMap object associated with the range of this matrix operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:150
BlockRelaxation(const Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Matrix)
BlockRelaxation constructor with given Tpetra::RowMatrix input.
Definition: Ifpack2_BlockRelaxation_def.hpp:53
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:729
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:220
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:202
int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:196
void setParameters(const Teuchos::ParameterList ¶ms)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:91
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:388
Ifpack2::BlockRelaxation: defines relaxation preconditioners for Tpetra::RowMatrix objects...
Definition: Ifpack2_BlockRelaxation_decl.hpp:137
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:208
void apply(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Applies the preconditioner to X, returns the result in Y.
Definition: Ifpack2_BlockRelaxation_def.hpp:268
double getComputeFlops() const
Returns the number of flops in the computation phase.
Definition: Ifpack2_BlockRelaxation_def.hpp:226
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:214
bool isComputed() const
Return true if compute() has been called.
Definition: Ifpack2_BlockRelaxation_decl.hpp:191
virtual ~BlockRelaxation()
BlockRelaxation Destructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:86
Base class for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:130
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack2_BlockRelaxation_decl.hpp:183
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:190
void initialize()
Initialize.
Definition: Ifpack2_BlockRelaxation_def.hpp:345
static const EVerbosityLevel verbLevel_default
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:757
const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:178
const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:169
magnitudeType getCondEst() const
Returns the computed estimated condition number, or -1.0 if no computed.
Definition: Ifpack2_BlockRelaxation_def.hpp:239
void applyMat(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS) const
Applies the matrix to a Tpetra::MultiVector.
Definition: Ifpack2_BlockRelaxation_def.hpp:325
Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMatrix() const
Returns a reference to the matrix to be preconditioned.
Definition: Ifpack2_BlockRelaxation_def.hpp:160
cheap estimate
Definition: Ifpack2_CondestType.hpp:51