IFEM  90A354
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PETScSolParams Class Reference

Class for PETSc solver parameters. More...

#include <PETScSolParams.h>

Collaboration diagram for PETScSolParams:
Collaboration graph
[legend]

Public Member Functions

 PETScSolParams (const LinSolParams &spar, const ProcessAdm &padm)
 Default constructor. More...
 
 ~PETScSolParams ()
 Destructor.
 
void setupPC (PC &pc, size_t block, const std::string &prefix, const std::set< int > &blockEqs, bool setup)
 Set up preconditioner parameters for PC object. More...
 
size_t getNoBlocks () const
 Obtain number of blocks.
 
const LinSolParams::BlockParamsgetBlock (size_t i) const
 Obtain settings for a given block.
 
int getIntValue (const std::string &key) const
 Get integer setting.
 
double getDoubleValue (const std::string &key) const
 Get integer setting.
 
std::string getStringValue (const std::string &key) const
 Get string setting.
 
bool hasValue (const std::string &key) const
 Get integer setting.
 
LinAlg::LinearSystemType getLinSysType () const
 Returns the linear system type.
 

Protected Member Functions

bool addDirSmoother (PC pc, const Mat &P, int iBlock, const ISMat &dirIndexSet)
 Set directional smoother. More...
 
void setMLOptions (const std::string &prefix, const SettingMap &map)
 Set ML options. More...
 
void setGAMGOptions (const std::string &prefix, const SettingMap &map)
 Set GAMG options. More...
 
void setHypreOptions (const std::string &prefix, const SettingMap &map)
 Set Hypre options. More...
 
void setupCoarseSolver (PC &pc, const std::string &prefix, const SettingMap &map)
 Setup the coarse solver in a multigrid. More...
 
void setupSmoothers (PC &pc, size_t iBlock, const ISMat &dirIndexSet, const std::set< int > &blockEqs, bool setup)
 Setup the smoothers in a multigrid. More...
 
void setupAdditiveSchwarz (PC &pc, size_t block, bool asmlu, bool smoother, const std::set< int > &blockEqs, bool setup)
 Setup an additive Schwarz preconditioner. More...
 

Protected Attributes

const LinSolParamsparams
 Reference to linear solver parameters.
 
const ProcessAdmadm
 Reference to process administrator.
 

Detailed Description

Class for PETSc solver parameters.

It contains information about solver method, preconditioner and convergence criteria.

Constructor & Destructor Documentation

◆ PETScSolParams()

PETScSolParams::PETScSolParams ( const LinSolParams spar,
const ProcessAdm padm 
)
inline

Default constructor.

Parameters
[in]sparThe base linear solver parameters
[in]padmThe process administrator

Member Function Documentation

◆ addDirSmoother()

bool PETScSolParams::addDirSmoother ( PC  pc,
const Mat &  P,
int  iBlock,
const ISMat dirIndexSet 
)
protected

Set directional smoother.

Parameters
[in]pcThe preconditioner to add smoother for
[in]PThe preconditioner matrix
[in]iBlockThe index of the block to add smoother to
[in]dirIndexSetThe index set for the smoother

References LinSolParams::BlockParams::dirSmoother, LinSolParams::getBlock(), params, PCPermApply(), PCPermCreate(), PCPermDestroy(), and PCPermSetUp().

◆ setGAMGOptions()

void PETScSolParams::setGAMGOptions ( const std::string &  prefix,
const SettingMap map 
)
protected

Set GAMG options.

Parameters
[in]prefixThe prefix of the block to set parameters for
[in]mapThe map of settings to use

References condSetup().

Referenced by setupPC().

◆ setHypreOptions()

void PETScSolParams::setHypreOptions ( const std::string &  prefix,
const SettingMap map 
)
protected

Set Hypre options.

Parameters
[in]prefixThe prefix of the block to set parameters for
[in]mapThe settings to apply

References AddPrefix(), and condSetup().

Referenced by setupPC().

◆ setMLOptions()

void PETScSolParams::setMLOptions ( const std::string &  prefix,
const SettingMap map 
)
protected

Set ML options.

Parameters
[in]prefixThe prefix of the block to set parameters for
[in]mapThe map of settings to use

References condSetup().

Referenced by setupPC().

◆ setupAdditiveSchwarz()

void PETScSolParams::setupAdditiveSchwarz ( PC &  pc,
size_t  block,
bool  asmlu,
bool  smoother,
const std::set< int > &  blockEqs,
bool  setup 
)
protected

Setup an additive Schwarz preconditioner.

Parameters
pcThe preconditioner to set coarse solver for
[in]blockThe block the preconditioner belongs to
[in]asmluTrue to use LU subdomain solvers
[in]smootherTrue if this is a smoother in multigrid
blockEqsThe local equations belonging to block
setupTrue to setup preconditioner

References adm, ProcessAdm::dd, LinSolParams::getBlock(), DomainDecomposition::getGlobalEq(), SettingMap::getIntValue(), DomainDecomposition::getMinEq(), DomainDecomposition::getSubdomains(), and params.

Referenced by setupPC(), and setupSmoothers().

◆ setupCoarseSolver()

void PETScSolParams::setupCoarseSolver ( PC &  pc,
const std::string &  prefix,
const SettingMap map 
)
protected

Setup the coarse solver in a multigrid.

Parameters
[in]pcThe preconditioner to set coarse solver for
[in]prefixThe prefix of the block to set parameters for
[in]mapThe settings to apply

References AddPrefix(), and SettingMap::getStringValue().

Referenced by setupPC().

◆ setupPC()

void PETScSolParams::setupPC ( PC &  pc,
size_t  block,
const std::string &  prefix,
const std::set< int > &  blockEqs,
bool  setup 
)

Set up preconditioner parameters for PC object.

Parameters
pcPreconditioner to configure
blockBlock this preconditioner applies to
prefixPETsc param prefix for block
blockEqsThe local equations belonging to block
setupTrue to setup preconditioner

References adm, LinSolParams::getBlock(), SettingMap::getIntValue(), ProcessAdm::getNoProcs(), SettingMap::getStringValue(), SettingMap::hasValue(), params, setGAMGOptions(), setHypreOptions(), setMLOptions(), setupAdditiveSchwarz(), setupCoarseSolver(), and setupSmoothers().

Referenced by PETScMatrix::setParameters().

◆ setupSmoothers()

void PETScSolParams::setupSmoothers ( PC &  pc,
size_t  iBlock,
const ISMat dirIndexSet,
const std::set< int > &  blockEqs,
bool  setup 
)
protected

Setup the smoothers in a multigrid.

Parameters
[in]pcThe preconditioner to set coarse solver for
[in]iBlockThe index of the block to set parameters for
[in]dirIndexSetThe index set for direction smoothers
blockEqsThe local equations belonging to block
setupTrue to setup preconditioner

References adm, LinSolParams::getBlock(), SettingMap::getIntValue(), ProcessAdm::getNoProcs(), SettingMap::getStringValue(), params, and setupAdditiveSchwarz().

Referenced by setupPC().


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