escript  Revision_
Solver.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #ifndef __PASO_SOLVER_H__
19 #define __PASO_SOLVER_H__
20 
21 #include "Paso.h"
22 #include "Functions.h"
23 #include "performance.h"
24 #include "SystemMatrix.h"
25 
26 namespace paso {
27 
28 #define TOLERANCE_FOR_SCALARS (double)(0.)
29 
30 void solve_free(SystemMatrix* A);
31 
32 SolverResult Solver(SystemMatrix_ptr, double*, double*, Options*, Performance*);
33 
34 void Solver_free(SystemMatrix*);
35 
36 SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double* B, double* X,
37  dim_t* iter, double* tolerance, Performance* pp);
38 
39 SolverResult Solver_PCG(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
40  double* tolerance, Performance* pp);
41 
42 SolverResult Solver_TFQMR(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
43  double* tolerance, Performance* pp);
44 
45 SolverResult Solver_MINRES(SystemMatrix_ptr A, double* B, double* X,
46  dim_t* iter, double* tolerance, Performance* pp);
47 
48 SolverResult Solver_GMRES(SystemMatrix_ptr A, double* r, double* x,
49  dim_t* num_iter, double* tolerance,
50  dim_t length_of_recursion, dim_t restart,
51  Performance* pp);
52 
53 SolverResult Solver_GMRES2(Function* F, const double* f0, const double* x0,
54  double* x, dim_t* iter, double* tolerance,
55  Performance* pp);
56 
57 SolverResult Solver_NewtonGMRES(Function* F, double* x, Options* options,
58  Performance* pp);
59 
60 } // namespace paso
61 
62 #endif // __PASO_SOLVER_H__
63 
BlockOps.h
paso::UMFPACK_free
void UMFPACK_free(SparseMatrix *A)
frees any UMFPACK related data from the matrix
Definition: UMFPACK.cpp:46
paso::EPSILON
static const real_t EPSILON
Definition: ReactiveSolver.cpp:52
MKL.h
paso::Preconditioner_LocalSmoother_alloc
Preconditioner_LocalSmoother * Preconditioner_LocalSmoother_alloc(SparseMatrix_ptr A, bool jacobi, bool verbose)
Definition: Smoother.cpp:75
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:73
paso::SystemMatrix::mpi_info
escript::JMPI mpi_info
Definition: SystemMatrix.h:332
paso::util::lsup
double lsup(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global Lsup of x
Definition: PasoUtil.cpp:489
paso::Preconditioner_Smoother_free
void Preconditioner_Smoother_free(Preconditioner_Smoother *in)
Definition: Smoother.cpp:45
paso::Solver_GMRES
SolverResult Solver_GMRES(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, dim_t Length_of_recursion, dim_t restart, Performance *pp)
Definition: GMRES.cpp:79
paso::Divergence
Definition: Paso.h:72
paso::Performance_startMonitor
void Performance_startMonitor(Performance *pp, int monitor)
switches on a monitor
Definition: performance.cpp:174
performance.h
paso::Solver_MINRES
SolverResult Solver_MINRES(SystemMatrix_ptr A, double *R, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: MINRES.cpp:70
MATRIX_FORMAT_CSC
#define MATRIX_FORMAT_CSC
Definition: Paso.h:61
paso::Options::getSolver
static int getSolver(int solver, int package, bool symmetry, const escript::JMPI &mpi_info)
returns the solver to be used with given combination
Definition: Options.cpp:230
paso::solve_free
void solve_free(SystemMatrix *in)
Definition: solve.cpp:140
paso::Solver
SolverResult Solver(SystemMatrix_ptr A, double *x, double *b, Options *options, Performance *pp)
calls the iterative solver
Definition: Solver.cpp:57
paso::SystemMatrix::getGlobalNumCols
dim_t getGlobalNumCols() const
Definition: SystemMatrix.h:233
paso::BlockOps_MViP_3
void BlockOps_MViP_3(const double *mat, double *V)
inplace matrix vector product - order 3
Definition: BlockOps.h:210
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:51
PASO_GMRES
#define PASO_GMRES
Definition: Options.h:46
MPI_SUM
#define MPI_SUM
Definition: EsysMPI.h:50
UMFPACK.h
paso::MKL_solve
void MKL_solve(SparseMatrix_ptr A, double *out, double *in, index_t reordering, dim_t numRefinements, bool verbose)
Definition: MKL.cpp:78
paso::Solver_TFQMR
SolverResult Solver_TFQMR(SystemMatrix_ptr A, double *B, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: TFQMR.cpp:73
paso::util::AXPY
void AXPY(dim_t N, double *x, double a, const double *y)
x = x+a*y
Definition: PasoUtil.h:122
PASO_PRES20
#define PASO_PRES20
Definition: Options.h:47
PERFORMANCE_PRECONDITIONER_INIT
#define PERFORMANCE_PRECONDITIONER_INIT
Definition: performance.h:54
paso::InputError
Definition: Paso.h:68
PERFORMANCE_ALL
#define PERFORMANCE_ALL
Definition: performance.h:52
PASO_MKL
#define PASO_MKL
Definition: Options.h:48
MATRIX_FORMAT_OFFSET1
#define MATRIX_FORMAT_OFFSET1
Definition: Paso.h:63
Options.h
paso::Preconditioner_LocalSmoother::diag
double * diag
Definition: Preconditioner.h:69
paso::Preconditioner_Smoother::localSmoother
Preconditioner_LocalSmoother * localSmoother
Definition: Preconditioner.h:76
paso::Solver_GMRES2
SolverResult Solver_GMRES2(Function *F, const double *f0, const double *x0, double *dx, dim_t *iter, double *tolerance, Performance *pp)
Definition: GMRES2.cpp:35
MPI_MAX
#define MPI_MAX
Definition: EsysMPI.h:52
paso::NegativeNormError
Definition: Paso.h:71
paso::SystemMatrix::solver_package
index_t solver_package
package code controlling the solver pointer
Definition: SystemMatrix.h:359
paso::Preconditioner_LocalSmoother_Sweep_colored
void Preconditioner_LocalSmoother_Sweep_colored(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:349
paso::Performance_close
void Performance_close(Performance *pp, int verbose)
shuts down the monitoring process
Definition: performance.cpp:104
Solver.h
paso::BlockOps_solveAll
void BlockOps_solveAll(dim_t n_block, dim_t n, double *D, index_t *pivot, double *x)
Definition: BlockOps.h:229
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:110
PASO_PCG
#define PASO_PCG
Definition: Options.h:39
PASO_TFQMR
#define PASO_TFQMR
Definition: Options.h:58
paso::Breakdown
Definition: Paso.h:70
paso::Solver_BiCGStab
SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: BiCGStab.cpp:89
Paso.h
paso::Preconditioner_LocalSmoother_free
void Preconditioner_LocalSmoother_free(Preconditioner_LocalSmoother *in)
Definition: Smoother.cpp:53
paso::Preconditioner_Smoother_solve
void Preconditioner_Smoother_solve(SystemMatrix_ptr A, Preconditioner_Smoother *gs, double *x, const double *b, dim_t sweeps, bool x_is_initial)
Definition: Smoother.cpp:111
escript::AbstractSystemMatrix::getPtr
ASM_ptr getPtr()
Returns smart pointer which is managing this object. If one does not exist yet it creates one.
Definition: AbstractSystemMatrix.cpp:52
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:87
paso::SystemMatrix::getGlobalNumRows
dim_t getGlobalNumRows() const
Definition: SystemMatrix.h:225
paso::Solver_PCG
SolverResult Solver_PCG(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: PCG.cpp:73
paso::SystemMatrix::mainBlock
SparseMatrix_ptr mainBlock
main block
Definition: SystemMatrix.h:338
paso::BlockOps_SMV_2
void BlockOps_SMV_2(double *R, const double *mat, const double *V)
performs operation R=R-mat*V (V and R are not overlapping) - 2x2
Definition: BlockOps.h:56
paso::UMFPACK_solve
void UMFPACK_solve(SparseMatrix_ptr A, double *out, double *in, dim_t numRefinements, bool verbose)
calls the solver
Definition: UMFPACK.cpp:66
paso::SolverResult
SolverResult
Definition: Paso.h:53
PASO_NONLINEAR_GMRES
#define PASO_NONLINEAR_GMRES
Definition: Options.h:57
SystemMatrix.h
paso::MaxIterReached
Definition: Paso.h:67
paso::MKL_free
void MKL_free(SparseMatrix *A)
Definition: MKL.cpp:47
paso::SystemMatrix::col_block_size
dim_t col_block_size
Definition: SystemMatrix.h:327
paso::Performance_open
void Performance_open(Performance *pp, int verbose)
sets up the monitoring process
Definition: performance.cpp:47
PASO_PASO
#define PASO_PASO
Definition: Options.h:54
paso::BlockOps_solve_N
void BlockOps_solve_N(dim_t N, double *X, double *mat, index_t *pivot, int *failed)
solves system of linear equations A*X=B
Definition: BlockOps.h:177
PASO_UMFPACK
#define PASO_UMFPACK
Definition: Options.h:49
PASO_BICGSTAB
#define PASO_BICGSTAB
Definition: Options.h:42
paso::SystemMatrix::row_block_size
dim_t row_block_size
Definition: SystemMatrix.h:326
paso::SparseMatrix_ptr
boost::shared_ptr< SparseMatrix > SparseMatrix_ptr
Definition: SparseMatrix.h:46
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:45
paso::Solver_free
void Solver_free(SystemMatrix *A)
Definition: Solver.cpp:51
paso::BlockOps_Cpy_N
void BlockOps_Cpy_N(dim_t N, double *R, const double *V)
Definition: BlockOps.h:50
paso::PasoException
PasoException exception class.
Definition: PasoException.h:43
PASO_MINRES
#define PASO_MINRES
Definition: Options.h:59
escript::gettime
double gettime()
returns the current ticks for timing
Definition: EsysMPI.h:185
paso::BlockOps_MV_N
void BlockOps_MV_N(dim_t N, double *R, const double *mat, const double *V)
Definition: BlockOps.h:100
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:82
paso::Performance_stopMonitor
void Performance_stopMonitor(Performance *pp, int monitor)
switches off a monitor
Definition: performance.cpp:193
paso::Preconditioner_Smoother_alloc
Preconditioner_Smoother * Preconditioner_Smoother_alloc(SystemMatrix_ptr A, bool jacobi, bool is_local, bool verbose)
constructs the symmetric Gauss-Seidel preconditioner
Definition: Smoother.cpp:65
paso::Preconditioner_LocalSmoother::buffer
double * buffer
Definition: Preconditioner.h:70
paso::Preconditioner_Smoother_solve_byTolerance
SolverResult Preconditioner_Smoother_solve_byTolerance(SystemMatrix_ptr A, Preconditioner_Smoother *gs, double *x, const double *b, double atol, dim_t *sweeps, bool x_is_initial)
Definition: Smoother.cpp:138
paso::SystemMatrix::solve
void solve(double *out, double *in, Options *options) const
Definition: solve.cpp:51
paso::Preconditioner_LocalSmoother_Sweep_sequential
void Preconditioner_LocalSmoother_Sweep_sequential(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
inplace Gauss-Seidel sweep in sequential mode
Definition: Smoother.cpp:232
paso::Preconditioner_LocalSmoother::pivot
index_t * pivot
Definition: Preconditioner.h:71
Preconditioner.h
paso::SparseMatrix_MatrixVector_CSR_OFFSET0
void SparseMatrix_MatrixVector_CSR_OFFSET0(const double alpha, const_SparseMatrix_ptr A, const double *in, const double beta, double *out)
Definition: SparseMatrix_MatrixVector.cpp:292
PasoUtil.h
paso::Preconditioner_LocalSmoother_solve
void Preconditioner_LocalSmoother_solve(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x, const double *b, dim_t sweeps, bool x_is_initial)
Definition: Smoother.cpp:172
paso::BlockOps_SMV_3
void BlockOps_SMV_3(double *R, const double *mat, const double *V)
performs operation R=R-mat*V (V and R are not overlapping) - 3x3
Definition: BlockOps.h:69
escript::DataTypes::real_t_eps
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:120
paso::Solver_NewtonGMRES
SolverResult Solver_NewtonGMRES(Function *F, double *x, Options *options, Performance *pp)
Definition: NewtonGMRES.cpp:54
Functions.h
paso::SystemMatrix::SystemMatrix
SystemMatrix()
default constructor - throws exception.
Definition: SystemMatrix.cpp:52
paso::BlockOps_MViP_2
void BlockOps_MViP_2(const double *mat, double *V)
inplace matrix vector product - order 2
Definition: BlockOps.h:197
paso
Definition: BiCGStab.cpp:25
PASO_SMOOTHER
#define PASO_SMOOTHER
Definition: Options.h:72
paso::NoError
Definition: Paso.h:66
paso::Preconditioner_LocalSmoother
Definition: Preconditioner.h:66
paso::Preconditioner_LocalSmoother_Sweep
void Preconditioner_LocalSmoother_Sweep(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:212
paso::BlockOps_SMV_N
void BlockOps_SMV_N(dim_t N, double *R, const double *mat, const double *V)
performs operation R=R-mat*V (V and R are not overlapping) - NxN
Definition: BlockOps.h:91