46 #include "Epetra_ConfigDefs.h"
49 #include "Epetra_MpiComm.h"
51 #include "Epetra_SerialComm.h"
53 #include "Epetra_Comm.h"
54 #include "Epetra_Map.h"
55 #include "Epetra_Time.h"
56 #include "Epetra_BlockMap.h"
57 #include "Epetra_MultiVector.h"
58 #include "Epetra_Vector.h"
59 #include "Epetra_Export.h"
61 #include "Galeri_Maps.h"
62 #include "Galeri_CrsMatrices.h"
66 #include "Teuchos_RefCountPtr.hpp"
73 return std::string(s);
79 return std::string(s);
84 int main(
int argc,
char *argv[]) {
87 MPI_Init(&argc,&argv);
96 GaleriList.
set(
"nx", nx);
98 GaleriList.
set(
"ny", nx);
99 GaleriList.
set(
"mx", 1);
101 GaleriList.
set(
"alpha", .0);
102 GaleriList.
set(
"diff", 1.0);
103 GaleriList.
set(
"conv", 100.0);
105 Teuchos::RefCountPtr<Epetra_Map> Map =
Teuchos::rcp( Galeri::CreateMap64(
"Cartesian2D", Comm, GaleriList) );
106 Teuchos::RefCountPtr<Epetra_CrsMatrix>
A =
Teuchos::rcp( Galeri::CreateCrsMatrix(
"UniFlow2D", &*Map, GaleriList) );
109 LHS->PutScalar(0.0); RHS->Random();
116 Teuchos::RefCountPtr<Ifpack_Preconditioner> Prec =
Teuchos::rcp( Factory.
Create(
"IHSS", &*A,0) );
118 List.
set(
"ihss: hermetian type",
"ILU");
119 List.
set(
"ihss: skew hermetian type",
"ILU");
120 List.
set(
"ihss: ratio eigenvalue",100.0);
130 solver.SetUserMatrix(&*A);
131 solver.SetLHS(&*LHS);
132 solver.SetRHS(&*RHS);
133 solver.SetAztecOption(AZ_solver,AZ_gmres);
134 solver.SetPrecOperator(&*Prec);
135 solver.SetAztecOption(AZ_output, 1);
136 solver.Iterate(Niters, 1e-8);
141 Teuchos::RefCountPtr<Ifpack_Preconditioner> Prec2 =
Teuchos::rcp( Factory.
Create(
"SORa", &*A,0) );
143 List2.
set(
"sora: sweeps",1);
153 solver2.SetUserMatrix(&*A);
154 solver2.SetLHS(&*LHS);
155 solver2.SetRHS(&*RHS);
156 solver2.SetAztecOption(AZ_solver,AZ_gmres);
157 solver2.SetPrecOperator(&*Prec2);
158 solver2.SetAztecOption(AZ_output, 1);
159 solver2.Iterate(Niters, 1e-8);
165 return(EXIT_SUCCESS);
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::string toString(const int &x)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int main(int argc, char *argv[])
Ifpack: a function class to define Ifpack preconditioners.
static Ifpack_Preconditioner * Create(EPrecType PrecType, Epetra_RowMatrix *Matrix, const int overlap=0, bool overrideSerialDefault=false)
Creates an instance of Ifpack_Preconditioner given the enum value of the preconditioner type (can not...
#define IFPACK_CHK_ERR(ifpack_err)