escript  Revision_
Solver.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 
19 #ifndef __PASO_SOLVER_H__
20 #define __PASO_SOLVER_H__
21 
22 #include "Paso.h"
23 #include "Functions.h"
24 #include "performance.h"
25 #include "SystemMatrix.h"
26 
27 namespace paso {
28 
29 #define TOLERANCE_FOR_SCALARS (double)(0.)
30 
31 void solve_free(SystemMatrix* A);
32 
33 SolverResult Solver(SystemMatrix_ptr, double*, double*, Options*, Performance*);
34 
35 void Solver_free(SystemMatrix*);
36 
37 SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double* B, double* X,
38  dim_t* iter, double* tolerance, Performance* pp);
39 
40 SolverResult Solver_PCG(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
41  double* tolerance, Performance* pp);
42 
43 SolverResult Solver_TFQMR(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
44  double* tolerance, Performance* pp);
45 
46 SolverResult Solver_MINRES(SystemMatrix_ptr A, double* B, double* X,
47  dim_t* iter, double* tolerance, Performance* pp);
48 
49 SolverResult Solver_GMRES(SystemMatrix_ptr A, double* r, double* x,
50  dim_t* num_iter, double* tolerance,
51  dim_t length_of_recursion, dim_t restart,
52  Performance* pp);
53 
54 SolverResult Solver_GMRES2(Function* F, const double* f0, const double* x0,
55  double* x, dim_t* iter, double* tolerance,
56  Performance* pp);
57 
58 SolverResult Solver_NewtonGMRES(Function* F, double* x, Options* options,
59  Performance* pp);
60 
61 } // namespace paso
62 
63 #endif // __PASO_SOLVER_H__
64 
BlockOps.h
paso::UMFPACK_free
void UMFPACK_free(SparseMatrix *A)
frees any UMFPACK related data from the matrix
Definition: UMFPACK.cpp:36
paso::EPSILON
static const real_t EPSILON
Definition: ReactiveSolver.cpp:41
MKL.h
paso::Options::num_level
dim_t num_level
Definition: Options.h:135
paso::Preconditioner_LocalSmoother_alloc
Preconditioner_LocalSmoother * Preconditioner_LocalSmoother_alloc(SparseMatrix_ptr A, bool jacobi, bool verbose)
Definition: Smoother.cpp:65
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:51
paso::SystemMatrix::mpi_info
escript::JMPI mpi_info
Definition: SystemMatrix.h:322
paso::util::lsup
double lsup(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global Lsup of x
Definition: PasoUtil.cpp:467
paso::Preconditioner_Smoother_free
void Preconditioner_Smoother_free(Preconditioner_Smoother *in)
Definition: Smoother.cpp:35
paso::Preconditioner_LocalSmoother::Jacobi
bool Jacobi
Definition: Preconditioner.h:58
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:69
paso::Divergence
@ Divergence
Definition: Paso.h:50
paso::Performance_startMonitor
void Performance_startMonitor(Performance *pp, int monitor)
switches on a monitor
Definition: performance.cpp:164
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:60
paso::SystemMatrix
this class holds a (distributed) stiffness matrix
Definition: SystemMatrix.h:49
paso::Options::accept_failed_convergence
bool accept_failed_convergence
Definition: Options.h:127
paso::SystemMatrix::freePreconditioner
void freePreconditioner()
Definition: SystemMatrix.cpp:165
MATRIX_FORMAT_CSC
#define MATRIX_FORMAT_CSC
Definition: Paso.h:63
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:220
paso::solve_free
void solve_free(SystemMatrix *in)
Definition: solve.cpp:129
paso::Solver
SolverResult Solver(SystemMatrix_ptr A, double *x, double *b, Options *options, Performance *pp)
calls the iterative solver
Definition: Solver.cpp:47
paso::Options::time
double time
Definition: Options.h:137
paso::SystemMatrix::getGlobalNumCols
dim_t getGlobalNumCols() const
Definition: SystemMatrix.h:223
paso::BlockOps_MViP_3
void BlockOps_MViP_3(const double *mat, double *V)
inplace matrix vector product - order 3
Definition: BlockOps.h:200
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:41
PASO_GMRES
#define PASO_GMRES
Definition: Options.h:48
paso::Options::tolerance
double tolerance
Definition: Options.h:113
MPI_SUM
#define MPI_SUM
Definition: EsysMPI.h:52
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:67
paso::Solver_TFQMR
SolverResult Solver_TFQMR(SystemMatrix_ptr A, double *B, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: TFQMR.cpp:63
paso::util::AXPY
void AXPY(dim_t N, double *x, double a, const double *y)
x = x+a*y
Definition: PasoUtil.h:100
PASO_PRES20
#define PASO_PRES20
Definition: Options.h:49
PERFORMANCE_PRECONDITIONER_INIT
#define PERFORMANCE_PRECONDITIONER_INIT
Definition: performance.h:44
paso::InputError
@ InputError
Definition: Paso.h:46
PERFORMANCE_ALL
#define PERFORMANCE_ALL
Definition: performance.h:42
paso::Options::net_time
double net_time
Definition: Options.h:141
PASO_MKL
#define PASO_MKL
Definition: Options.h:50
MATRIX_FORMAT_OFFSET1
#define MATRIX_FORMAT_OFFSET1
Definition: Paso.h:65
paso::Options::verbose
bool verbose
Definition: Options.h:117
Options.h
paso::Options::method
int method
Definition: Options.h:109
paso::Preconditioner_LocalSmoother::diag
double * diag
Definition: Preconditioner.h:59
paso::Preconditioner_Smoother::localSmoother
Preconditioner_LocalSmoother * localSmoother
Definition: Preconditioner.h:66
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:25
MPI_MAX
#define MPI_MAX
Definition: EsysMPI.h:54
paso::NegativeNormError
@ NegativeNormError
Definition: Paso.h:49
paso::SystemMatrix::solver_package
index_t solver_package
package code controlling the solver pointer
Definition: SystemMatrix.h:349
paso::Preconditioner_LocalSmoother_Sweep_colored
void Preconditioner_LocalSmoother_Sweep_colored(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:339
paso::Performance_close
void Performance_close(Performance *pp, int verbose)
shuts down the monitoring process
Definition: performance.cpp:94
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:219
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:88
PASO_PCG
#define PASO_PCG
Definition: Options.h:41
PASO_TFQMR
#define PASO_TFQMR
Definition: Options.h:60
paso::Breakdown
@ Breakdown
Definition: Paso.h:48
paso::Solver_BiCGStab
SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: BiCGStab.cpp:78
paso::LinearSystem
Definition: Functions.h:48
Paso.h
paso::Preconditioner_LocalSmoother_free
void Preconditioner_LocalSmoother_free(Preconditioner_LocalSmoother *in)
Definition: Smoother.cpp:43
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:101
paso::Options::truncation
index_t truncation
Definition: Options.h:124
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:42
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:65
paso::SystemMatrix::getGlobalNumRows
dim_t getGlobalNumRows() const
Definition: SystemMatrix.h:215
paso::Options::reordering
bool reordering
Definition: Options.h:118
paso::Solver_PCG
SolverResult Solver_PCG(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: PCG.cpp:63
paso::Options::symmetric
bool symmetric
Definition: Options.h:111
paso::SystemMatrix::solver_p
void * solver_p
pointer to data needed by a solver
Definition: SystemMatrix.h:352
paso::SystemMatrix::mainBlock
SparseMatrix_ptr mainBlock
main block
Definition: SystemMatrix.h:328
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:46
paso::UMFPACK_solve
void UMFPACK_solve(SparseMatrix_ptr A, double *out, double *in, dim_t numRefinements, bool verbose)
calls the solver
Definition: UMFPACK.cpp:56
paso::Options::refinements
dim_t refinements
Definition: Options.h:130
paso::Options::num_inner_iter
dim_t num_inner_iter
Definition: Options.h:136
paso::Preconditioner_Smoother
Definition: Preconditioner.h:65
paso::SolverResult
SolverResult
Definition: Paso.h:43
PASO_NONLINEAR_GMRES
#define PASO_NONLINEAR_GMRES
Definition: Options.h:59
SystemMatrix.h
paso::Options::iter_max
dim_t iter_max
Definition: Options.h:120
paso::MaxIterReached
@ MaxIterReached
Definition: Paso.h:45
paso::Options::converged
bool converged
Definition: Options.h:143
paso::MKL_free
void MKL_free(SparseMatrix *A)
Definition: MKL.cpp:36
paso::SystemMatrix::col_block_size
dim_t col_block_size
Definition: SystemMatrix.h:317
paso::Performance_open
void Performance_open(Performance *pp, int verbose)
sets up the monitoring process
Definition: performance.cpp:37
PASO_PASO
#define PASO_PASO
Definition: Options.h:56
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:167
PASO_UMFPACK
#define PASO_UMFPACK
Definition: Options.h:51
paso::Preconditioner_Smoother::is_local
bool is_local
Definition: Preconditioner.h:67
PASO_BICGSTAB
#define PASO_BICGSTAB
Definition: Options.h:44
paso::SystemMatrix::row_block_size
dim_t row_block_size
Definition: SystemMatrix.h:316
paso::SparseMatrix_ptr
boost::shared_ptr< SparseMatrix > SparseMatrix_ptr
Definition: SparseMatrix.h:36
paso::Options::residual_norm
double residual_norm
Definition: Options.h:142
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:47
paso::Solver_free
void Solver_free(SystemMatrix *A)
Definition: Solver.cpp:41
paso::BlockOps_Cpy_N
void BlockOps_Cpy_N(dim_t N, double *R, const double *V)
Definition: BlockOps.h:40
paso::PasoException
PasoException exception class.
Definition: PasoException.h:34
PASO_MINRES
#define PASO_MINRES
Definition: Options.h:61
escript::gettime
double gettime()
returns the current ticks for timing
Definition: EsysMPI.h:187
paso::BlockOps_MV_N
void BlockOps_MV_N(dim_t N, double *R, const double *mat, const double *V)
Definition: BlockOps.h:90
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:60
paso::Performance_stopMonitor
void Performance_stopMonitor(Performance *pp, int monitor)
switches off a monitor
Definition: performance.cpp:183
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:55
paso::Preconditioner_LocalSmoother::buffer
double * buffer
Definition: Preconditioner.h:60
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:128
paso::SystemMatrix::solve
void solve(double *out, double *in, Options *options) const
Definition: solve.cpp:40
paso::Options::set_up_time
double set_up_time
Definition: Options.h:138
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:222
paso::Preconditioner_LocalSmoother::pivot
index_t * pivot
Definition: Preconditioner.h:61
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:280
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:162
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:59
escript::DataTypes::real_t_eps
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:98
paso::Solver_NewtonGMRES
SolverResult Solver_NewtonGMRES(Function *F, double *x, Options *options, Performance *pp)
Definition: NewtonGMRES.cpp:44
Functions.h
paso::BlockOps_MViP_2
void BlockOps_MViP_2(const double *mat, double *V)
inplace matrix vector product - order 2
Definition: BlockOps.h:187
paso
Definition: BiCGStab.cpp:26
PASO_SMOOTHER
#define PASO_SMOOTHER
Definition: Options.h:74
paso::NoError
@ NoError
Definition: Paso.h:44
paso::Options
Definition: Options.h:79
paso::Performance
Definition: performance.h:56
paso::Preconditioner_LocalSmoother
Definition: Preconditioner.h:57
paso::Preconditioner_LocalSmoother_Sweep
void Preconditioner_LocalSmoother_Sweep(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:202
paso::Options::num_iter
dim_t num_iter
Definition: Options.h:134
paso::Options::restart
index_t restart
Definition: Options.h:125
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:81