Preconditioner.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_PRECONDITIONER_H__
#define __PASO_PRECONDITIONER_H__
#include "Paso.h"
#include "SystemMatrix.h"
namespace paso {
struct MergedSolver;
struct Preconditioner;
typedef boost::shared_ptr<Preconditioner> Preconditioner_ptr;
typedef boost::shared_ptr<const Preconditioner> const_Preconditioner_ptr;
struct Preconditioner_Smoother;
struct Solver_ILU;
struct Solver_RILU;
// general preconditioner interface
struct Preconditioner
{
dim_t type;
dim_t sweeps;
Preconditioner_Smoother* jacobi;
Preconditioner_Smoother* gs;
Solver_ILU* ilu;
Solver_RILU* rilu;
};
void Preconditioner_free(Preconditioner*);
Preconditioner* Preconditioner_alloc(SystemMatrix_ptr<double> A, Options* options);
void Preconditioner_solve(Preconditioner* prec, SystemMatrix_ptr<double> A, double*, double*);
// GAUSS SEIDEL & Jacobi
struct Preconditioner_LocalSmoother
{
bool Jacobi;
double* diag;
double* buffer;
index_t* pivot;
};
struct Preconditioner_Smoother
{
Preconditioner_LocalSmoother* localSmoother;
bool is_local;
};
void PASO_DLL_API Preconditioner_Smoother_free(Preconditioner_Smoother * in);
void PASO_DLL_API Preconditioner_LocalSmoother_free(Preconditioner_LocalSmoother * in);
Preconditioner_Smoother* Preconditioner_Smoother_alloc(
SystemMatrix_ptr<double> A, bool jacobi, bool is_local, bool verbose);
Preconditioner_LocalSmoother* Preconditioner_LocalSmoother_alloc(
SparseMatrix_ptr<double> A, bool jacobi, bool verbose);
void Preconditioner_Smoother_solve(SystemMatrix_ptr<double> A,
Preconditioner_Smoother* gs, double* x, const double* b,
dim_t sweeps, bool x_is_initial);
void Preconditioner_LocalSmoother_solve(SparseMatrix_ptr<double> A,
Preconditioner_LocalSmoother* gs, double* x, const double* b,
dim_t sweeps, bool x_is_initial);
SolverResult Preconditioner_Smoother_solve_byTolerance(SystemMatrix_ptr<double> A,
Preconditioner_Smoother* gs, double* x, const double* b,
double atol, dim_t* sweeps, bool x_is_initial);
void Preconditioner_LocalSmoother_Sweep(SparseMatrix_ptr<double> A,
Preconditioner_LocalSmoother* gs, double* x);
void Preconditioner_LocalSmoother_Sweep_sequential(
SparseMatrix_ptr<double> A, Preconditioner_LocalSmoother* gs,
double* x);
void Preconditioner_LocalSmoother_Sweep_tiled(SparseMatrix_ptr<double> A,
Preconditioner_LocalSmoother* gs, double* x);
void Preconditioner_LocalSmoother_Sweep_colored(SparseMatrix_ptr<double> A,
Preconditioner_LocalSmoother* gs, double* x);
struct Solver_ILU
{
double* factors;
};
struct Solver_RILU
{
dim_t n;
dim_t n_block;
dim_t n_F;
dim_t n_C;
double* inv_A_FF;
index_t* A_FF_pivot;
SparseMatrix_ptr<double> A_FC;
SparseMatrix_ptr<double> A_CF;
index_t* rows_in_F;
index_t* rows_in_C;
index_t* mask_F;
index_t* mask_C;
double* x_F;
double* b_F;
double* x_C;
double* b_C;
Solver_RILU* RILU_of_Schur;
};
void Solver_ILU_free(Solver_ILU * in);
Solver_ILU* Solver_getILU(SparseMatrix_ptr<double> A, bool verbose);
void Solver_solveILU(SparseMatrix_ptr<double> A, Solver_ILU* ilu, double* x, const double* b);
void Solver_RILU_free(Solver_RILU* in);
Solver_RILU* Solver_getRILU(SparseMatrix_ptr<double> A, bool verbose);
void Solver_solveRILU(Solver_RILU* rilu, double* x, double* b);
void Solver_updateIncompleteSchurComplement(SparseMatrix_ptr<double> A_CC,
SparseMatrix_ptr<double> A_CF, double* invA_FF, index_t* A_FF_pivot,
SparseMatrix_ptr<double> A_FC);
} // namespace paso
#endif // __PASO_PRECONDITIONER_H__
Paso.h
SystemMatrix.h
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:66
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:61
paso
Definition: BiCGStab.cpp:25
paso::Preconditioner_Smoother_solve
void Preconditioner_Smoother_solve(SystemMatrix_ptr< double > A, Preconditioner_Smoother *gs, double *x, const double *b, dim_t sweeps, bool x_is_initial)
Definition: Smoother.cpp:100
paso::Preconditioner_solve
void Preconditioner_solve(Preconditioner *prec, SystemMatrix_ptr< double > A, double *x, double *b)
Definition: Preconditioner.cpp:111
paso::Preconditioner_LocalSmoother_Sweep
void Preconditioner_LocalSmoother_Sweep(SparseMatrix_ptr< double > A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:201
paso::Preconditioner_alloc
Preconditioner * Preconditioner_alloc(SystemMatrix_ptr< double > A, Options *options)
Definition: Preconditioner.cpp:46
paso::Preconditioner_free
void Preconditioner_free(Preconditioner *in)
Definition: Preconditioner.cpp:35
paso::Solver_ILU_free
void Solver_ILU_free(Solver_ILU *in)
Definition: ILU.cpp:35
paso::Preconditioner_LocalSmoother_Sweep_sequential
void Preconditioner_LocalSmoother_Sweep_sequential(SparseMatrix_ptr< double > A, Preconditioner_LocalSmoother *gs, double *x)
inplace Gauss-Seidel sweep in sequential mode
Definition: Smoother.cpp:221
paso::Preconditioner_LocalSmoother_Sweep_tiled
void Preconditioner_LocalSmoother_Sweep_tiled(SparseMatrix_ptr< double > A, Preconditioner_LocalSmoother *gs, double *x)
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix< T > > SystemMatrix_ptr
Definition: SystemMatrix.h:42
paso::SparseMatrix_ptr
boost::shared_ptr< SparseMatrix< T > > SparseMatrix_ptr
Definition: SparseMatrix.h:37
paso::Preconditioner_Smoother_free
void Preconditioner_Smoother_free(Preconditioner_Smoother *in)
Definition: Smoother.cpp:34
paso::Preconditioner_Smoother_alloc
Preconditioner_Smoother * Preconditioner_Smoother_alloc(SystemMatrix_ptr< double > A, bool jacobi, bool is_local, bool verbose)
constructs the symmetric Gauss-Seidel preconditioner
Definition: Smoother.cpp:54
paso::Preconditioner_ptr
boost::shared_ptr< Preconditioner > Preconditioner_ptr
Definition: Preconditioner.h:27
paso::const_Preconditioner_ptr
boost::shared_ptr< const Preconditioner > const_Preconditioner_ptr
Definition: Preconditioner.h:29
paso::SolverResult
SolverResult
Definition: Paso.h:44
paso::Solver_solveILU
void Solver_solveILU(SparseMatrix_ptr< double > A, Solver_ILU *ilu, double *x, const double *b)
Definition: ILU.cpp:316
paso::Preconditioner_LocalSmoother_Sweep_colored
void Preconditioner_LocalSmoother_Sweep_colored(SparseMatrix_ptr< double > A, Preconditioner_LocalSmoother *gs, double *x)
Definition: Smoother.cpp:338
paso::Solver_solveRILU
void Solver_solveRILU(Solver_RILU *rilu, double *x, double *b)
Definition: RILU.cpp:289
paso::Preconditioner_LocalSmoother_free
void Preconditioner_LocalSmoother_free(Preconditioner_LocalSmoother *in)
Definition: Smoother.cpp:42
paso::Solver_getRILU
Solver_RILU * Solver_getRILU(SparseMatrix_ptr< double > A, bool verbose)
Definition: RILU.cpp:71
paso::Solver_getILU
Solver_ILU * Solver_getILU(SparseMatrix_ptr< double > A, bool verbose)
constructs the incomplete block factorization
Definition: ILU.cpp:44
paso::Solver_RILU_free
void Solver_RILU_free(Solver_RILU *in)
Definition: RILU.cpp:35
paso::Preconditioner_LocalSmoother_alloc
Preconditioner_LocalSmoother * Preconditioner_LocalSmoother_alloc(SparseMatrix_ptr< double > A, bool jacobi, bool verbose)
Definition: Smoother.cpp:64
paso::Solver_updateIncompleteSchurComplement
void Solver_updateIncompleteSchurComplement(SparseMatrix_ptr< double > A_CC, SparseMatrix_ptr< double > A_CF, double *invA_FF, index_t *A_FF_pivot, SparseMatrix_ptr< double > A_FC)
Definition: SchurComplement.cpp:28
paso::Preconditioner_LocalSmoother_solve
void Preconditioner_LocalSmoother_solve(SparseMatrix_ptr< double > A, Preconditioner_LocalSmoother *gs, double *x, const double *b, dim_t sweeps, bool x_is_initial)
Definition: Smoother.cpp:161
paso::Preconditioner_Smoother_solve_byTolerance
SolverResult Preconditioner_Smoother_solve_byTolerance(SystemMatrix_ptr< double > A, Preconditioner_Smoother *gs, double *x, const double *b, double atol, dim_t *sweeps, bool x_is_initial)
Definition: Smoother.cpp:127
PASO_DLL_API
#define PASO_DLL_API
Definition: paso/src/system_dep.h:29
paso::Options
Definition: Options.h:80
paso::Preconditioner_LocalSmoother
Definition: Preconditioner.h:57
paso::Preconditioner_LocalSmoother::buffer
double * buffer
Definition: Preconditioner.h:60
paso::Preconditioner_LocalSmoother::Jacobi
bool Jacobi
Definition: Preconditioner.h:58
paso::Preconditioner_LocalSmoother::pivot
index_t * pivot
Definition: Preconditioner.h:61
paso::Preconditioner_LocalSmoother::diag
double * diag
Definition: Preconditioner.h:59
paso::Preconditioner_Smoother
Definition: Preconditioner.h:65
paso::Preconditioner_Smoother::is_local
bool is_local
Definition: Preconditioner.h:67
paso::Preconditioner_Smoother::localSmoother
Preconditioner_LocalSmoother * localSmoother
Definition: Preconditioner.h:66
paso::Preconditioner
Definition: Preconditioner.h:37
paso::Preconditioner::type
dim_t type
Definition: Preconditioner.h:38
paso::Preconditioner::rilu
Solver_RILU * rilu
RILU preconditioner.
Definition: Preconditioner.h:47
paso::Preconditioner::jacobi
Preconditioner_Smoother * jacobi
Jacobi preconditioner.
Definition: Preconditioner.h:41
paso::Preconditioner::ilu
Solver_ILU * ilu
ILU preconditioner.
Definition: Preconditioner.h:45
paso::Preconditioner::sweeps
dim_t sweeps
Definition: Preconditioner.h:39
paso::Preconditioner::gs
Preconditioner_Smoother * gs
Gauss-Seidel preconditioner.
Definition: Preconditioner.h:43
paso::Solver_ILU
ILU preconditioner.
Definition: Preconditioner.h:106
paso::Solver_ILU::factors
double * factors
Definition: Preconditioner.h:107
paso::Solver_RILU
RILU preconditioner.
Definition: Preconditioner.h:112
paso::Solver_RILU::b_F
double * b_F
Definition: Preconditioner.h:126
paso::Solver_RILU::mask_F
index_t * mask_F
Definition: Preconditioner.h:123
paso::Solver_RILU::A_FC
SparseMatrix_ptr< double > A_FC
Definition: Preconditioner.h:119
paso::Solver_RILU::A_FF_pivot
index_t * A_FF_pivot
Definition: Preconditioner.h:118
paso::Solver_RILU::inv_A_FF
double * inv_A_FF
Definition: Preconditioner.h:117
paso::Solver_RILU::x_C
double * x_C
Definition: Preconditioner.h:127
paso::Solver_RILU::rows_in_C
index_t * rows_in_C
Definition: Preconditioner.h:122
paso::Solver_RILU::n_block
dim_t n_block
Definition: Preconditioner.h:114
paso::Solver_RILU::A_CF
SparseMatrix_ptr< double > A_CF
Definition: Preconditioner.h:120
paso::Solver_RILU::b_C
double * b_C
Definition: Preconditioner.h:128
paso::Solver_RILU::n
dim_t n
Definition: Preconditioner.h:113
paso::Solver_RILU::n_C
dim_t n_C
Definition: Preconditioner.h:116
paso::Solver_RILU::rows_in_F
index_t * rows_in_F
Definition: Preconditioner.h:121
paso::Solver_RILU::mask_C
index_t * mask_C
Definition: Preconditioner.h:124
paso::Solver_RILU::RILU_of_Schur
Solver_RILU * RILU_of_Schur
Definition: Preconditioner.h:129
paso::Solver_RILU::n_F
dim_t n_F
Definition: Preconditioner.h:115
paso::Solver_RILU::x_F
double * x_F
Definition: Preconditioner.h:125