Amesos Package Browser (Single Doxygen Collection)
Development
test
Test_KLU
Test_KLU/cxx_main.cpp
Go to the documentation of this file.
1
#include "
Amesos_ConfigDefs.h
"
2
3
#ifdef HAVE_MPI
4
#include "mpi.h"
5
#include "
Epetra_MpiComm.h
"
6
#else
7
#include "
Epetra_SerialComm.h
"
8
#endif
9
#include "
Epetra_Map.h
"
10
#include "
Epetra_Vector.h
"
11
#include "
Epetra_Util.h
"
12
#include "
Amesos_Klu.h
"
13
#include "
Amesos_TestRowMatrix.h
"
14
#include "Teuchos_ParameterList.hpp"
15
#include "Galeri_Maps.h"
16
#include "Galeri_CrsMatrices.h"
17
#include "Galeri_Utils.h"
18
19
using namespace
Galeri
;
20
21
//============ //
22
// main driver //
23
//============ //
24
25
int
main
(
int
argc,
char
*argv[])
26
{
27
#ifdef HAVE_MPI
28
MPI_Init(&argc, &argv);
29
Epetra_MpiComm
Comm(MPI_COMM_WORLD);
30
#else
31
Epetra_SerialComm
Comm;
32
#endif
33
34
Teuchos::ParameterList GaleriList;
35
GaleriList.set(
"n"
, 5);
36
37
Epetra_Map
* Map = CreateMap(
"Random"
, Comm, GaleriList);
38
Epetra_CrsMatrix
* Matrix =
CreateCrsMatrix
(
"Minij"
, Map, GaleriList);
39
40
int
NumVectors = 2;
41
Amesos_TestRowMatrix
A(Matrix);
42
Epetra_MultiVector
x(*Map,NumVectors);
43
Epetra_MultiVector
x_exact(*Map,NumVectors);
44
Epetra_MultiVector
b(*Map,NumVectors);
45
x_exact.
Random
();
46
A.
Multiply
(
false
,x_exact,b);
47
48
// =========== //
49
// AMESOS PART //
50
// =========== //
51
52
Epetra_LinearProblem
Problem(&A, &x, &b);
53
Amesos_Klu
Solver
(Problem);
54
55
AMESOS_CHK_ERR
(
Solver
.SymbolicFactorization());
56
AMESOS_CHK_ERR
(
Solver
.NumericFactorization());
57
AMESOS_CHK_ERR
(
Solver
.Solve());
58
59
double
norm = ComputeNorm(Matrix, &x_exact, &b);
60
if
(Comm.
MyPID
() == 0)
61
std::cout <<
"norm = "
<< norm << std::endl;
62
63
if
(norm > 1e-5)
64
exit(EXIT_FAILURE);
65
66
#ifdef HAVE_MPI
67
MPI_Finalize();
68
#endif
69
70
return
(EXIT_SUCCESS);
71
}
Epetra_MultiVector
Amesos_Klu
Amesos_Klu: A serial, unblocked code ideal for getting started and for very sparse matrices...
Definition:
Amesos_Klu.h:111
Epetra_Map
Epetra_MultiVector::Random
int Random()
Amesos_ConfigDefs.h
Amesos_TestRowMatrix
Amesos_TestRowMatrix: a class to test Epetra_RowMatrix based codes.
Definition:
Amesos_TestRowMatrix.h:30
Epetra_MpiComm
Epetra_SerialComm.h
Amesos_TestRowMatrix.h
AMESOS_CHK_ERR
#define AMESOS_CHK_ERR(a)
Definition:
Amesos_ConfigDefs.h:78
Amesos_TestRowMatrix::Multiply
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
Definition:
Amesos_TestRowMatrix.h:116
Amesos_Klu.h
Solver
Solver
CreateCrsMatrix
int CreateCrsMatrix(const char *in_filename, const Epetra_Comm &Comm, Epetra_Map *&readMap, const bool transpose, const bool distribute, bool &symmetric, Epetra_CrsMatrix *&Matrix)
Definition:
TestOptions.cpp:81
Epetra_SerialComm
main
int main(int argc, char *argv[])
Definition:
Test_KLU/cxx_main.cpp:25
Epetra_MpiComm.h
Galeri
Epetra_SerialComm::MyPID
int MyPID() const
Epetra_CrsMatrix
Epetra_Map.h
Epetra_Vector.h
Epetra_LinearProblem
Epetra_Util.h
Generated by
1.8.14