Solver.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __PASO_SOLVER_H__
#define __PASO_SOLVER_H__
#include "Paso.h"
#include "Functions.h"
#include "performance.h"
#include "SystemMatrix.h"
namespace paso {
#define TOLERANCE_FOR_SCALARS (double)(0.)
void solve_free(SystemMatrix* A);
SolverResult Solver(SystemMatrix_ptr, double*, double*, Options*, Performance*);
void Solver_free(SystemMatrix*);
SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double* B, double* X,
dim_t* iter, double* tolerance, Performance* pp);
SolverResult Solver_PCG(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
double* tolerance, Performance* pp);
SolverResult Solver_TFQMR(SystemMatrix_ptr A, double* B, double* X, dim_t* iter,
double* tolerance, Performance* pp);
SolverResult Solver_MINRES(SystemMatrix_ptr A, double* B, double* X,
dim_t* iter, double* tolerance, Performance* pp);
SolverResult Solver_GMRES(SystemMatrix_ptr A, double* r, double* x,
dim_t* num_iter, double* tolerance,
dim_t length_of_recursion, dim_t restart,
Performance* pp);
SolverResult Solver_GMRES2(Function* F, const double* f0, const double* x0,
double* x, dim_t* iter, double* tolerance,
Performance* pp);
SolverResult Solver_NewtonGMRES(Function* F, double* x, Options* options,
Performance* pp);
} // namespace paso
#endif // __PASO_SOLVER_H__
BlockOps.h
paso::UMFPACK_free
void UMFPACK_free(SparseMatrix *A)
frees any UMFPACK related data from the matrix
Definition: UMFPACK.cpp:50
paso::EPSILON
static const real_t EPSILON
Definition: ReactiveSolver.cpp:55
MKL.h
paso::Preconditioner_LocalSmoother_alloc
Preconditioner_LocalSmoother * Preconditioner_LocalSmoother_alloc(SparseMatrix_ptr A, bool jacobi, bool verbose)
Definition: Smoother.cpp:79
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
paso::SystemMatrix::mpi_info
escript::JMPI mpi_info
Definition: SystemMatrix.h:336
paso::util::lsup
double lsup(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global Lsup of x
Definition: PasoUtil.cpp:495
paso::Preconditioner_Smoother_free
void Preconditioner_Smoother_free(Preconditioner_Smoother *in)
Definition: Smoother.cpp:49
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:83
paso::Divergence
@ Divergence
Definition: Paso.h:78
paso::Performance_startMonitor
void Performance_startMonitor(Performance *pp, int monitor)
switches on a monitor
Definition: performance.cpp:178
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:74
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:234
paso::solve_free
void solve_free(SystemMatrix *in)
Definition: solve.cpp:143
paso::Solver
SolverResult Solver(SystemMatrix_ptr A, double *x, double *b, Options *options, Performance *pp)
calls the iterative solver
Definition: Solver.cpp:61
paso::SystemMatrix::getGlobalNumCols
dim_t getGlobalNumCols() const
Definition: SystemMatrix.h:237
paso::BlockOps_MViP_3
void BlockOps_MViP_3(const double *mat, double *V)
inplace matrix vector product - order 3
Definition: BlockOps.h:214
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:55
PASO_GMRES
#define PASO_GMRES
Definition: Options.h:48
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:81
paso::Solver_TFQMR
SolverResult Solver_TFQMR(SystemMatrix_ptr A, double *B, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: TFQMR.cpp:77
paso::util::AXPY
void AXPY(dim_t N, double *x, double a, const double *y)
x = x+a*y
Definition: PasoUtil.h:128
PASO_PRES20
#define PASO_PRES20
Definition: Options.h:49
PERFORMANCE_PRECONDITIONER_INIT
#define PERFORMANCE_PRECONDITIONER_INIT
Definition: performance.h:58
paso::InputError
@ InputError
Definition: Paso.h:74
PERFORMANCE_ALL
#define PERFORMANCE_ALL
Definition: performance.h:56
PASO_MKL
#define PASO_MKL
Definition: Options.h:50
MATRIX_FORMAT_OFFSET1
#define MATRIX_FORMAT_OFFSET1
Definition: Paso.h:65
Options.h
paso::Preconditioner_LocalSmoother::diag
double * diag
Definition: Preconditioner.h:73
paso::Preconditioner_Smoother::localSmoother
Preconditioner_LocalSmoother * localSmoother
Definition: Preconditioner.h:80
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:39
MPI_MAX
#define MPI_MAX
Definition: EsysMPI.h:54
paso::NegativeNormError
@ NegativeNormError
Definition: Paso.h:77
paso::SystemMatrix::solver_package
index_t solver_package
package code controlling the solver pointer
Definition: SystemMatrix.h:363
paso::Preconditioner_LocalSmoother_Sweep_colored
void Preconditioner_LocalSmoother_Sweep_colored(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:353
paso::Performance_close
void Performance_close(Performance *pp, int verbose)
shuts down the monitoring process
Definition: performance.cpp:108
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:233
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:116
PASO_PCG
#define PASO_PCG
Definition: Options.h:41
PASO_TFQMR
#define PASO_TFQMR
Definition: Options.h:60
paso::Breakdown
@ Breakdown
Definition: Paso.h:76
paso::Solver_BiCGStab
SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: BiCGStab.cpp:92
Paso.h
paso::Preconditioner_LocalSmoother_free
void Preconditioner_LocalSmoother_free(Preconditioner_LocalSmoother *in)
Definition: Smoother.cpp:57
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:115
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:56
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
paso::SystemMatrix::getGlobalNumRows
dim_t getGlobalNumRows() const
Definition: SystemMatrix.h:229
paso::Solver_PCG
SolverResult Solver_PCG(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: PCG.cpp:77
paso::SystemMatrix::mainBlock
SparseMatrix_ptr mainBlock
main block
Definition: SystemMatrix.h:342
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:60
paso::UMFPACK_solve
void UMFPACK_solve(SparseMatrix_ptr A, double *out, double *in, dim_t numRefinements, bool verbose)
calls the solver
Definition: UMFPACK.cpp:70
paso::Preconditioner_Smoother
Definition: Preconditioner.h:78
paso::SolverResult
SolverResult
Definition: Paso.h:57
PASO_NONLINEAR_GMRES
#define PASO_NONLINEAR_GMRES
Definition: Options.h:59
SystemMatrix.h
paso::MaxIterReached
@ MaxIterReached
Definition: Paso.h:73
paso::MKL_free
void MKL_free(SparseMatrix *A)
Definition: MKL.cpp:50
paso::SystemMatrix::col_block_size
dim_t col_block_size
Definition: SystemMatrix.h:331
paso::Performance_open
void Performance_open(Performance *pp, int verbose)
sets up the monitoring process
Definition: performance.cpp:51
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:181
PASO_UMFPACK
#define PASO_UMFPACK
Definition: Options.h:51
paso::Preconditioner_Smoother::is_local
bool is_local
Definition: Preconditioner.h:81
PASO_BICGSTAB
#define PASO_BICGSTAB
Definition: Options.h:44
paso::SystemMatrix::row_block_size
dim_t row_block_size
Definition: SystemMatrix.h:330
paso::SparseMatrix_ptr
boost::shared_ptr< SparseMatrix > SparseMatrix_ptr
Definition: SparseMatrix.h:50
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:47
paso::Solver_free
void Solver_free(SystemMatrix *A)
Definition: Solver.cpp:55
paso::BlockOps_Cpy_N
void BlockOps_Cpy_N(dim_t N, double *R, const double *V)
Definition: BlockOps.h:54
paso::PasoException
PasoException exception class.
Definition: PasoException.h:47
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:104
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
paso::Performance_stopMonitor
void Performance_stopMonitor(Performance *pp, int monitor)
switches off a monitor
Definition: performance.cpp:197
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:69
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:142
paso::SystemMatrix::solve
void solve(double *out, double *in, Options *options) const
Definition: solve.cpp:54
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:236
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:298
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:176
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:73
escript::DataTypes::real_t_eps
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:126
paso::Solver_NewtonGMRES
SolverResult Solver_NewtonGMRES(Function *F, double *x, Options *options, Performance *pp)
Definition: NewtonGMRES.cpp:58
Functions.h
paso::SystemMatrix::SystemMatrix
SystemMatrix()
default constructor - throws exception.
Definition: SystemMatrix.cpp:56
paso::BlockOps_MViP_2
void BlockOps_MViP_2(const double *mat, double *V)
inplace matrix vector product - order 2
Definition: BlockOps.h:201
paso
Definition: BiCGStab.cpp:26
PASO_SMOOTHER
#define PASO_SMOOTHER
Definition: Options.h:74
paso::NoError
@ NoError
Definition: Paso.h:72
paso::Preconditioner_LocalSmoother
Definition: Preconditioner.h:70
paso::Preconditioner_LocalSmoother_Sweep
void Preconditioner_LocalSmoother_Sweep(SparseMatrix_ptr A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:216
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:95