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.)
struct Function;
template <typename T>
void solve_free(SystemMatrix<T>* A);
SolverResult Solver(SystemMatrix_ptr<double>, double*, double*, Options*, Performance*);
void PASO_DLL_API Solver_free(SystemMatrix<double>*);
SolverResult Solver(SystemMatrix_ptr<cplx_t>, cplx_t*, cplx_t*, Options*, Performance*);
void PASO_DLL_API Solver_free(SystemMatrix<cplx_t>*);
SolverResult Solver_BiCGStab(SystemMatrix_ptr<double> A, double* B, double* X,
dim_t* iter, double* tolerance, Performance* pp);
SolverResult Solver_PCG(SystemMatrix_ptr<double> A, double* B, double* X, dim_t* iter,
double* tolerance, Performance* pp);
SolverResult Solver_TFQMR(SystemMatrix_ptr<double> A, double* B, double* X, dim_t* iter,
double* tolerance, Performance* pp);
SolverResult Solver_MINRES(SystemMatrix_ptr<double> A, double* B, double* X,
dim_t* iter, double* tolerance, Performance* pp);
SolverResult Solver_GMRES(SystemMatrix_ptr<double> 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
#include "Preconditioner.h"
#include "MKL.h"
#include "UMFPACK.h"
#include "MUMPS.h"
namespace paso {
struct Preconditioner_Smoother;
void PASO_DLL_API Preconditioner_Smoother_free(Preconditioner_Smoother * in);
template <typename T>
void solve_free(SystemMatrix<T>* in)
{
if (!in) return;
switch(in->solver_package) {
case PASO_PASO:
Solver_free(in);
break;
case PASO_SMOOTHER:
Preconditioner_Smoother_free((Preconditioner_Smoother*) in->solver_p);
break;
case PASO_MKL:
MKL_free(in->mainBlock.get());
break;
case PASO_UMFPACK:
UMFPACK_free(in->mainBlock.get());
break;
case PASO_MUMPS:
MUMPS_free(in->mainBlock.get());
break;
}
}
} // namespace paso
#endif // __PASO_SOLVER_H__
Functions.h
MKL.h
MUMPS.h
PASO_SMOOTHER
#define PASO_SMOOTHER
Definition: Options.h:75
PASO_MUMPS
#define PASO_MUMPS
Definition: Options.h:57
PASO_UMFPACK
#define PASO_UMFPACK
Definition: Options.h:51
PASO_PASO
#define PASO_PASO
Definition: Options.h:56
PASO_MKL
#define PASO_MKL
Definition: Options.h:50
Paso.h
Preconditioner.h
SystemMatrix.h
UMFPACK.h
paso::SystemMatrix
this class holds a (distributed) stiffness matrix
Definition: SystemMatrix.h:50
paso::SystemMatrix::solver_p
void * solver_p
pointer to data needed by a solver
Definition: SystemMatrix.h:353
paso::SystemMatrix::solver_package
index_t solver_package
package code controlling the solver pointer
Definition: SystemMatrix.h:350
paso::SystemMatrix::mainBlock
SparseMatrix_ptr< T > mainBlock
main block
Definition: SystemMatrix.h:329
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:55
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:66
paso
Definition: BiCGStab.cpp:25
paso::Solver_PCG
SolverResult Solver_PCG(SystemMatrix_ptr< double > A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: PCG.cpp:62
paso::Solver_free
void Solver_free(SystemMatrix< double > *A)
Definition: Solver.cpp:40
paso::Solver_TFQMR
SolverResult Solver_TFQMR(SystemMatrix_ptr< double > A, double *B, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: TFQMR.cpp:62
paso::Solver
SolverResult Solver(SystemMatrix_ptr< double > A, double *x, double *b, Options *options, Performance *pp)
calls the iterative solver
Definition: Solver.cpp:46
paso::Preconditioner_Smoother_free
void Preconditioner_Smoother_free(Preconditioner_Smoother *in)
Definition: Smoother.cpp:34
paso::Solver_GMRES
SolverResult Solver_GMRES(SystemMatrix_ptr< double > A, double *r, double *x, dim_t *iter, double *tolerance, dim_t Length_of_recursion, dim_t restart, Performance *pp)
Definition: GMRES.cpp:68
paso::UMFPACK_free
void UMFPACK_free(SparseMatrix< double > *A)
frees any UMFPACK related data from the matrix
Definition: UMFPACK.cpp:35
paso::solve_free
void solve_free(SystemMatrix< T > *A)
Definition: Solver.h:79
paso::SolverResult
SolverResult
Definition: Paso.h:44
paso::Solver_MINRES
SolverResult Solver_MINRES(SystemMatrix_ptr< double > A, double *R, double *X, dim_t *iter, double *tolerance, Performance *pp)
Definition: MINRES.cpp:59
paso::Solver_BiCGStab
SolverResult Solver_BiCGStab(SystemMatrix_ptr< double > A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: BiCGStab.cpp:77
paso::MUMPS_free
void MUMPS_free(SparseMatrix< T > *A)
frees any MUMPS related data from the matrix
Definition: MUMPS.h:118
paso::MKL_free
void MKL_free(SparseMatrix< double > *A)
Definition: MKL.cpp:35
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:24
paso::Solver_NewtonGMRES
SolverResult Solver_NewtonGMRES(Function *F, double *x, Options *options, Performance *pp)
Definition: NewtonGMRES.cpp:43
PASO_DLL_API
#define PASO_DLL_API
Definition: paso/src/system_dep.h:29
performance.h
paso::Preconditioner_Smoother
Definition: Preconditioner.h:65