#include "ml_include.h"
#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_GALERI) && defined(HAVE_ML_AZTECOO)
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_Map.h"
#include "Epetra_Vector.h"
#include "Epetra_CrsMatrix.h"
#include "Epetra_LinearProblem.h"
#include "Epetra_Time.h"
#include "AztecOO.h"
#include "Galeri_Maps.h"
#include "Galeri_CrsMatrices.h"
using namespace Teuchos;
using namespace Galeri;
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#else
#endif
ParameterList GaleriList;
GaleriList.set("nx", 8);
GaleriList.set("ny", 8);
GaleriList.set(
"nz", 8 * Comm.
NumProc());
GaleriList.set("mx", 1);
GaleriList.set("my", 1);
GaleriList.set(
"mz", Comm.
NumProc());
Epetra_Map* Map = CreateMap(
"Cartesian3D", Comm, GaleriList);
AztecOO solver(Problem);
ParameterList MLList;
int options[AZ_OPTIONS_SIZE];
double params[AZ_PARAMS_SIZE];
AZ_defaults(options,params);
options[AZ_precond] = AZ_dom_decomp;
options[AZ_subdomain_solve] = AZ_ilu;
options[AZ_graph_fill] = 0;
options[AZ_overlap] = 0;
MLList.set("aggregation: type", "METIS");
MLList.set("smoother: type","Aztec");
MLList.set("aggregation: nodes per aggregate", 64);
MLList.set("smoother: pre or post", "pre");
MLList.set("coarse: type","Amesos-KLU");
solver.SetPrecOperator(MLPrec);
solver.SetAztecOption(AZ_solver, AZ_gmres_condnum);
solver.SetAztecOption(AZ_output, 32);
solver.Iterate(500, 1e-12);
delete MLPrec;
double residual;
LHS.Norm2(&residual);
{
cout << "||x_exact - x||_2 = " << residual << endl;
cout << "Total Time = " << Time.ElapsedTime() << endl;
}
delete A;
delete Map;
if (residual > 1e-5)
exit(EXIT_FAILURE);
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return(EXIT_SUCCESS);
}
#else
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_MPI
#include "mpi.h"
#endif
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
puts("Please configure ML with:");
puts("--enable-epetra");
puts("--enable-teuchos");
puts("--enable-aztecoo");
puts("--enable-galeri");
#ifdef HAVE_MPI
MPI_Finalize();
#endif
exit(EXIT_SUCCESS);
}
#endif
MultiLevelPreconditioner: a class to define black-box multilevel preconditioners using aggregation me...
Definition ml_MultiLevelPreconditioner.h:241
int SetDefaults(std::string ProblemType, Teuchos::ParameterList &List, int *options=0, double *params=0, const bool OverWrite=true)
Sets default parameters for aggregation-based preconditioners.