#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_VbrMatrix.h"
#include "Epetra_LinearProblem.h"
#include "AztecOO.h"
#include "Galeri_Maps.h"
#include "Galeri_CrsMatrices.h"
#include "Galeri_VbrMatrices.h"
#include "Galeri_Utils.h"
using namespace Galeri;
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
Epetra_MpiComm
Comm(MPI_COMM_WORLD);
#else
#endif
int NumPDEEqns = 5;
int nx = 32;
GaleriList.
set(
"nx", nx);
GaleriList.
set(
"ny", nx *
Comm.NumProc());
GaleriList.
set(
"my",
Comm.NumProc());
Epetra_Map* Map = CreateMap(
"Cartesian2D",
Comm, GaleriList);
Epetra_CrsMatrix* CrsA = CreateCrsMatrix("Laplace2D", Map, GaleriList);
Epetra_VbrMatrix* A = CreateVbrMatrix(CrsA, NumPDEEqns);
Epetra_Vector LHS(A->Map()); LHS.Random();
Epetra_Vector RHS(A->Map()); RHS.PutScalar(0.0);
Epetra_LinearProblem Problem(A, &LHS, &RHS);
AztecOO solver(Problem);
Epetra_MultiVector* Coord = CreateCartesianCoordinates("2D", &(A->Map()),
GaleriList);
double* x_coord = (*Coord)[0];
double* y_coord = (*Coord)[1];
int *options = new int[AZ_OPTIONS_SIZE];
double *params = new double[AZ_PARAMS_SIZE];
MLList.
set(
"max levels",3);
MLList.
set(
"increasing or decreasing",
"increasing");
MLList.
set(
"smoother: type",
"symmetric Gauss-Seidel");
MLList.
set(
"aggregation: type",
"Uncoupled");
MLList.
set(
"viz: output format",
"vtk");
MLList.
set(
"viz: enable",
true);
MLList.
set(
"x-coordinates", x_coord);
MLList.
set(
"y-coordinates", y_coord);
MLList.
set(
"z-coordinates", (
double *)0);
MLList.
set(
"viz: print starting solution",
true);
delete MLPrec;
delete [] options;
delete [] params;
delete A;
delete Coord;
delete Map;
#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
return(EXIT_SUCCESS);
}
#endif