63#include "Teuchos_RefCountPtr.hpp"
64#include "Teuchos_ArrayRCP.hpp"
72struct hypre_IJMatrix_struct;
73typedef struct hypre_IJMatrix_struct *HYPRE_IJMatrix;
74struct hypre_IJVector_struct;
75typedef struct hypre_IJVector_struct *HYPRE_IJVector;
76struct hypre_ParCSRMatrix_struct;
77typedef struct hypre_ParCSRMatrix_struct* HYPRE_ParCSRMatrix;
78struct hypre_ParVector_struct;
79typedef struct hypre_ParVector_struct * HYPRE_ParVector;
80struct hypre_Solver_struct;
81typedef struct hypre_Solver_struct *HYPRE_Solver;
82struct hypre_ParVector_struct;
83typedef struct hypre_ParVector_struct hypre_ParVector;
89typedef HYPRE_Int (*HYPRE_PtrToParSolverFcn)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector);
114class FunctionParameter;
134 ~Ifpack_Hypre(){ Destroy();}
143 bool IsInitialized()
const{
return(IsInitialized_);}
151 bool IsComputed()
const{
return(IsComputed_);}
183 int SetParameters(Teuchos::ParameterList& parameterlist);
194 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
int),
int parameter);
205 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
double),
double parameter);
217 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
double,
int),
double parameter1,
int parameter2);
229 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
int,
int),
int parameter1,
int parameter2);
240 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
double*),
double* parameter);
251 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
int*),
int* parameter);
263 int SetParameter(
Hypre_Chooser chooser,
int (*pt2Func)(HYPRE_Solver,
int**),
int** parameter);
286 int SetParameter(
bool UsePreconditioner){ UsePreconditioner_ = UsePreconditioner;
return 0;}
295 int SetParameter(
Hypre_Chooser chooser) { SolveOrPrec_ = chooser;
return 0;}
298 int SetCoordinates(Teuchos::RCP<Epetra_MultiVector> coords);
301 int SetDiscreteGradient(Teuchos::RCP<const Epetra_CrsMatrix> G);
304 int CallFunctions()
const;
316 int SetUseTranspose(
bool UseTranspose_in) {UseTranspose_ = UseTranspose_in;
return(0);};
357 const int MaxIters = 1550,
358 const double Tol = 1e-9,
362 double Condest()
const{
return(Condest_);}
368 const char* Label()
const {
return(Label_);}
371 int SetLabel(
const char* Label_in)
373 strcpy(Label_,Label_in);
378 const Epetra_Map& OperatorDomainMap()
const{
return *GloballyContiguousRowMap_;}
381 const Epetra_Map& OperatorRangeMap()
const{
return *GloballyContiguousRowMap_;}
384 double NormInf()
const {
return(0.0);};
387 bool HasNormInf()
const {
return(
false);};
390 bool UseTranspose()
const {
return(UseTranspose_);};
393 const Epetra_Comm & Comm()
const{
return(A_->Comm());};
400 const HYPRE_IJMatrix& HypreMatrix()
402 if(IsInitialized() ==
false)
409 virtual std::ostream& Print(std::ostream& os)
const;
412 virtual int NumInitialize()
const{
return(NumInitialize_);}
415 virtual int NumCompute()
const{
return(NumCompute_);}
418 virtual int NumApplyInverse()
const{
return(NumApplyInverse_);}
421 virtual double InitializeTime()
const{
return(InitializeTime_);}
424 virtual double ComputeTime()
const{
return(ComputeTime_);}
427 virtual double ApplyInverseTime()
const{
return(ApplyInverseTime_);}
430 virtual double InitializeFlops()
const{
return(0.0);}
433 virtual double ComputeFlops()
const{
return(ComputeFlops_);}
436 virtual double ApplyInverseFlops()
const{
return(ApplyInverseFlops_);}
444 Ifpack_Hypre(
const Ifpack_Hypre&
RHS) : Time_(
RHS.Comm()){}
447 Ifpack_Hypre& operator=(
const Ifpack_Hypre& ){
return(*
this);}
453 MPI_Comm GetMpiComm()
const
454 {
return (
dynamic_cast<const Epetra_MpiComm*
>(&A_->Comm()))->GetMpiComm();}
471 int NumGlobalRows()
const {
return(A_->NumGlobalRows());};
474 int NumGlobalCols()
const {
return(A_->NumGlobalCols());};
477 int NumMyRows()
const {
return(A_->NumMyRows());};
480 int NumMyCols()
const {
return(A_->NumMyCols());};
495 int CopyEpetraToHypre();
498 int AddFunToList(Teuchos::RCP<FunctionParameter> NewFun);
501 int Hypre_BoomerAMGCreate(MPI_Comm comm, HYPRE_Solver *solver);
504 int Hypre_ParaSailsCreate(MPI_Comm comm, HYPRE_Solver *solver);
507 int Hypre_EuclidCreate(MPI_Comm comm, HYPRE_Solver *solver);
510 int Hypre_AMSCreate(MPI_Comm comm, HYPRE_Solver *solver);
513 int Hypre_ParCSRHybridCreate(MPI_Comm comm, HYPRE_Solver *solver);
516 int Hypre_ParCSRPCGCreate(MPI_Comm comm, HYPRE_Solver *solver);
519 int Hypre_ParCSRGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver);
522 int Hypre_ParCSRFlexGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver);
525 int Hypre_ParCSRLGMRESCreate(MPI_Comm comm, HYPRE_Solver *solver);
528 int Hypre_ParCSRBiCGSTABCreate(MPI_Comm comm, HYPRE_Solver *solver);
531 Teuchos::RCP<const Epetra_Map> MakeContiguousColumnMap(Teuchos::RCP<const Epetra_RowMatrix> &Matrix)
const;
536 Teuchos::RCP<Epetra_RowMatrix> A_;
538 Teuchos::ParameterList List_;
554 mutable int NumApplyInverse_;
556 double InitializeTime_;
560 mutable double ApplyInverseTime_;
562 double ComputeFlops_;
564 mutable double ApplyInverseFlops_;
569 mutable HYPRE_IJMatrix HypreA_;
571 mutable HYPRE_ParCSRMatrix ParMatrix_;
574 Teuchos::RCP<const Epetra_CrsMatrix> G_;
576 mutable HYPRE_IJMatrix HypreG_;
578 mutable HYPRE_ParCSRMatrix ParMatrixG_;
581 mutable HYPRE_IJVector XHypre_;
583 mutable HYPRE_IJVector YHypre_;
584 mutable HYPRE_ParVector ParX_;
585 mutable HYPRE_ParVector ParY_;
586 mutable Teuchos::RCP<hypre_ParVector> XVec_;
587 mutable Teuchos::RCP<hypre_ParVector> YVec_;
589 Teuchos::RCP<Epetra_MultiVector> Coords_;
590 mutable HYPRE_IJVector xHypre_;
591 mutable HYPRE_IJVector yHypre_;
592 mutable HYPRE_IJVector zHypre_;
593 mutable HYPRE_ParVector xPar_;
594 mutable HYPRE_ParVector yPar_;
595 mutable HYPRE_ParVector zPar_;
598 mutable HYPRE_Solver Solver_;
600 mutable HYPRE_Solver Preconditioner_;
602 int (Ifpack_Hypre::*SolverCreatePtr_)(MPI_Comm, HYPRE_Solver*);
603 int (*SolverDestroyPtr_)(HYPRE_Solver);
604 int (*SolverSetupPtr_)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector);
605 int (*SolverSolvePtr_)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector);
606 int (*SolverPrecondPtr_)(HYPRE_Solver, HYPRE_PtrToParSolverFcn, HYPRE_PtrToParSolverFcn, HYPRE_Solver);
607 int (Ifpack_Hypre::*PrecondCreatePtr_)(MPI_Comm, HYPRE_Solver*);
608 int (*PrecondDestroyPtr_)(HYPRE_Solver);
609 int (*PrecondSetupPtr_)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector);
610 int (*PrecondSolvePtr_)(HYPRE_Solver, HYPRE_ParCSRMatrix, HYPRE_ParVector, HYPRE_ParVector);
612 bool IsSolverCreated_;
613 bool IsPrecondCreated_;
617 Teuchos::RCP<const Epetra_Map> GloballyContiguousRowMap_;
618 Teuchos::RCP<const Epetra_Map> GloballyContiguousColMap_;
619 Teuchos::RCP<const Epetra_Map> GloballyContiguousNodeRowMap_;
620 Teuchos::RCP<const Epetra_Map> GloballyContiguousNodeColMap_;
628 bool UsePreconditioner_;
630 std::vector<Teuchos::RCP<FunctionParameter> > FunsToCall_;
634 mutable Teuchos::ArrayRCP<double> VectorCache_;
Ifpack_CondestType
Ifpack_CondestType: enum to define the type of condition number estimate.
@ Ifpack_Cheap
cheap estimate
Ifpack_ScalingType enumerable type.
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.