Chi-Tech
chi_math::LinearSolver< MatType, VecType, SolverType > Class Template Referenceabstract

#include <linear_solver.h>

Inheritance diagram for chi_math::LinearSolver< MatType, VecType, SolverType >:
lbs::AGSLinearSolver< MatType, VecType, SolverType > lbs::WGSLinearSolver< MatType, VecType, SolverType >

Data Structures

struct  ToleranceOptions
 

Public Types

typedef LinearSolverContext< MatType, VecType > LinSolveContext
 
typedef std::shared_ptr< LinSolveContextLinSolveContextPtr
 

Public Member Functions

 LinearSolver (const std::string &iterative_method, LinSolveContextPtr context_ptr)
 
 LinearSolver (std::string solver_name, std::string iterative_method, LinSolveContextPtr context_ptr)
 
virtual ~LinearSolver ()
 
ToleranceOptionsToleranceOptions ()
 
void ApplyToleranceOptions ()
 
LinSolveContextPtrGetContext ()
 
void SetKSPSolveSuppressionFlag (bool flag)
 
bool GetKSPSolveSuppressionFlag () const
 
virtual void Setup ()
 
virtual void Solve ()
 
 ~LinearSolver ()
 
void ApplyToleranceOptions ()
 
void Setup ()
 
void Solve ()
 

Protected Member Functions

bool IsSystemSet () const
 
virtual void PreSetupCallback ()
 
virtual void SetOptions ()
 
virtual void SetSolverContext ()
 
virtual void SetConvergenceTest ()
 
virtual void SetMonitor ()
 
virtual void SetPreconditioner ()
 
virtual void SetSystemSize ()=0
 
virtual void SetSystem ()=0
 
virtual void PostSetupCallback ()
 
virtual void PreSolveCallback ()
 
virtual void SetInitialGuess ()=0
 
virtual void SetRHS ()=0
 
virtual void PostSolveCallback ()
 
void PreSetupCallback ()
 
void SetOptions ()
 
void SetSolverContext ()
 
void SetConvergenceTest ()
 
void SetMonitor ()
 
void SetPreconditioner ()
 
void PostSetupCallback ()
 
void PreSolveCallback ()
 
void PostSolveCallback ()
 

Protected Attributes

const std::string solver_name_
 
const std::string iterative_method_
 
LinSolveContextPtr context_ptr_ = nullptr
 
MatType A_
 
VecType b_
 
VecType x_
 
SolverType solver_
 
int64_t num_local_dofs_ = 0
 
int64_t num_globl_dofs_ = 0
 
struct chi_math::LinearSolver::ToleranceOptions tolerance_options_
 

Private Attributes

bool system_set_ = false
 
bool suppress_kspsolve_ = false
 

Detailed Description

template<class MatType, class VecType, class SolverType>
class chi_math::LinearSolver< MatType, VecType, SolverType >

Implementation of a general linear solver.

Definition at line 18 of file linear_solver.h.

Member Typedef Documentation

◆ LinSolveContext

template<class MatType , class VecType , class SolverType >
typedef LinearSolverContext<MatType, VecType> chi_math::LinearSolver< MatType, VecType, SolverType >::LinSolveContext

Definition at line 21 of file linear_solver.h.

◆ LinSolveContextPtr

template<class MatType , class VecType , class SolverType >
typedef std::shared_ptr<LinSolveContext> chi_math::LinearSolver< MatType, VecType, SolverType >::LinSolveContextPtr

Definition at line 22 of file linear_solver.h.

Constructor & Destructor Documentation

◆ LinearSolver() [1/2]

template<class MatType , class VecType , class SolverType >
chi_math::LinearSolver< MatType, VecType, SolverType >::LinearSolver ( const std::string &  iterative_method,
LinSolveContextPtr  context_ptr 
)
inlineexplicit

Definition at line 57 of file linear_solver.h.

◆ LinearSolver() [2/2]

template<class MatType , class VecType , class SolverType >
chi_math::LinearSolver< MatType, VecType, SolverType >::LinearSolver ( std::string  solver_name,
std::string  iterative_method,
LinSolveContextPtr  context_ptr 
)
inlineexplicit

Definition at line 65 of file linear_solver.h.

◆ ~LinearSolver() [1/2]

template<class MatType , class VecType , class SolverType >
virtual chi_math::LinearSolver< MatType, VecType, SolverType >::~LinearSolver ( )
virtual

◆ ~LinearSolver() [2/2]

Definition at line 9 of file linear_solver_petsc.cc.

Member Function Documentation

◆ ApplyToleranceOptions() [1/2]

template<class MatType , class VecType , class SolverType >
void chi_math::LinearSolver< MatType, VecType, SolverType >::ApplyToleranceOptions ( )

◆ ApplyToleranceOptions() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::ApplyToleranceOptions ( )

Definition at line 17 of file linear_solver_petsc.cc.

◆ GetContext()

template<class MatType , class VecType , class SolverType >
LinSolveContextPtr & chi_math::LinearSolver< MatType, VecType, SolverType >::GetContext ( )
inline

Definition at line 79 of file linear_solver.h.

◆ GetKSPSolveSuppressionFlag()

template<class MatType , class VecType , class SolverType >
bool chi_math::LinearSolver< MatType, VecType, SolverType >::GetKSPSolveSuppressionFlag ( ) const
inline

Definition at line 83 of file linear_solver.h.

◆ IsSystemSet()

template<class MatType , class VecType , class SolverType >
bool chi_math::LinearSolver< MatType, VecType, SolverType >::IsSystemSet ( ) const
inlineprotected

Definition at line 54 of file linear_solver.h.

◆ PostSetupCallback() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::PostSetupCallback ( )
protectedvirtual

◆ PostSetupCallback() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::PostSetupCallback ( )
protected

Definition at line 55 of file linear_solver_petsc.cc.

◆ PostSolveCallback() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::PostSolveCallback ( )
protectedvirtual

◆ PostSolveCallback() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::PostSolveCallback ( )
protected

Definition at line 100 of file linear_solver_petsc.cc.

◆ PreSetupCallback() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::PreSetupCallback ( )
protectedvirtual

◆ PreSetupCallback() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::PreSetupCallback ( )
protected

Definition at line 27 of file linear_solver_petsc.cc.

◆ PreSolveCallback() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::PreSolveCallback ( )
protectedvirtual

◆ PreSolveCallback() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::PreSolveCallback ( )
protected

Definition at line 96 of file linear_solver_petsc.cc.

◆ SetConvergenceTest() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetConvergenceTest ( )
protectedvirtual

◆ SetConvergenceTest() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::SetConvergenceTest ( )
protected

Definition at line 41 of file linear_solver_petsc.cc.

◆ SetInitialGuess()

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetInitialGuess ( )
protectedpure virtual

◆ SetKSPSolveSuppressionFlag()

template<class MatType , class VecType , class SolverType >
void chi_math::LinearSolver< MatType, VecType, SolverType >::SetKSPSolveSuppressionFlag ( bool  flag)
inline

Sets a flag to suppress the KSPSolve() method from being called.

Definition at line 82 of file linear_solver.h.

◆ SetMonitor() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetMonitor ( )
protectedvirtual

◆ SetMonitor() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::SetMonitor ( )
protected

Definition at line 47 of file linear_solver_petsc.cc.

◆ SetOptions() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetOptions ( )
protectedvirtual

◆ SetOptions() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::SetOptions ( )
protected

Definition at line 31 of file linear_solver_petsc.cc.

◆ SetPreconditioner() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetPreconditioner ( )
protectedvirtual

◆ SetPreconditioner() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::SetPreconditioner ( )
protected

Definition at line 51 of file linear_solver_petsc.cc.

◆ SetRHS()

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetRHS ( )
protectedpure virtual

◆ SetSolverContext() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetSolverContext ( )
protectedvirtual

◆ SetSolverContext() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::SetSolverContext ( )
protected

Definition at line 35 of file linear_solver_petsc.cc.

◆ SetSystem()

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetSystem ( )
protectedpure virtual

◆ SetSystemSize()

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::SetSystemSize ( )
protectedpure virtual

◆ Setup() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::Setup ( )
virtual

◆ Setup() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::Setup ( )

Definition at line 60 of file linear_solver_petsc.cc.

◆ Solve() [1/2]

template<class MatType , class VecType , class SolverType >
virtual void chi_math::LinearSolver< MatType, VecType, SolverType >::Solve ( )
virtual

◆ Solve() [2/2]

void chi_math::LinearSolver< Mat, Vec, KSP >::Solve ( )

Definition at line 104 of file linear_solver_petsc.cc.

◆ ToleranceOptions()

template<class MatType , class VecType , class SolverType >
ToleranceOptions & chi_math::LinearSolver< MatType, VecType, SolverType >::ToleranceOptions ( )
inline

Definition at line 76 of file linear_solver.h.

Field Documentation

◆ A_

template<class MatType , class VecType , class SolverType >
MatType chi_math::LinearSolver< MatType, VecType, SolverType >::A_
protected

Definition at line 30 of file linear_solver.h.

◆ b_

template<class MatType , class VecType , class SolverType >
VecType chi_math::LinearSolver< MatType, VecType, SolverType >::b_
protected

Definition at line 31 of file linear_solver.h.

◆ context_ptr_

template<class MatType , class VecType , class SolverType >
LinSolveContextPtr chi_math::LinearSolver< MatType, VecType, SolverType >::context_ptr_ = nullptr
protected

Definition at line 28 of file linear_solver.h.

◆ iterative_method_

template<class MatType , class VecType , class SolverType >
const std::string chi_math::LinearSolver< MatType, VecType, SolverType >::iterative_method_
protected

Definition at line 26 of file linear_solver.h.

◆ num_globl_dofs_

template<class MatType , class VecType , class SolverType >
int64_t chi_math::LinearSolver< MatType, VecType, SolverType >::num_globl_dofs_ = 0
protected

Definition at line 41 of file linear_solver.h.

◆ num_local_dofs_

template<class MatType , class VecType , class SolverType >
int64_t chi_math::LinearSolver< MatType, VecType, SolverType >::num_local_dofs_ = 0
protected

Definition at line 40 of file linear_solver.h.

◆ solver_

template<class MatType , class VecType , class SolverType >
SolverType chi_math::LinearSolver< MatType, VecType, SolverType >::solver_
protected

Definition at line 33 of file linear_solver.h.

◆ solver_name_

template<class MatType , class VecType , class SolverType >
const std::string chi_math::LinearSolver< MatType, VecType, SolverType >::solver_name_
protected

Definition at line 25 of file linear_solver.h.

◆ suppress_kspsolve_

template<class MatType , class VecType , class SolverType >
bool chi_math::LinearSolver< MatType, VecType, SolverType >::suppress_kspsolve_ = false
private

Definition at line 37 of file linear_solver.h.

◆ system_set_

template<class MatType , class VecType , class SolverType >
bool chi_math::LinearSolver< MatType, VecType, SolverType >::system_set_ = false
private

Definition at line 36 of file linear_solver.h.

◆ tolerance_options_

template<class MatType , class VecType , class SolverType >
struct chi_math::LinearSolver::ToleranceOptions chi_math::LinearSolver< MatType, VecType, SolverType >::tolerance_options_
protected

◆ x_

template<class MatType , class VecType , class SolverType >
VecType chi_math::LinearSolver< MatType, VecType, SolverType >::x_
protected

Definition at line 32 of file linear_solver.h.


The documentation for this class was generated from the following file: