MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::PetscSolver Class Reference

Abstract class for PETSc's solvers. More...

#include <petsc.hpp>

Inheritance diagram for mfem::PetscSolver:
[legend]
Collaboration diagram for mfem::PetscSolver:
[legend]

Public Member Functions

 PetscSolver ()
 Construct an empty PetscSolver. Initialize protected objects to NULL.
 
virtual ~PetscSolver ()
 Destroy the PetscParVectors allocated (if any).
 
void Customize (bool customize=true) const
 Customize object with options set.
 
int GetConverged ()
 
int GetNumIterations ()
 
real_t GetFinalNorm ()
 
void SetMonitor (PetscSolverMonitor *ctx)
 Sets user-defined monitoring routine.
 
void SetBCHandler (PetscBCHandler *bch)
 Sets the object to handle essential boundary conditions.
 
void SetPreconditionerFactory (PetscPreconditionerFactory *factory)
 Sets the object for the creation of the preconditioner.
 
 operator PetscObject () const
 Conversion function to PetscObject.
 
MPI_Comm GetComm () const
 Get the associated MPI communicator.
 
Update of PETSc options.

The following Set methods can be used to update the internal PETSc options.

Note
They will be overwritten by the options in the input PETSc file.
void SetTol (real_t tol)
 
void SetRelTol (real_t tol)
 
void SetAbsTol (real_t tol)
 
void SetMaxIter (int max_iter)
 
void SetPrintLevel (int plev)
 

Protected Member Functions

void CreatePrivateContext ()
 
void FreePrivateContext ()
 

Protected Attributes

bool clcustom
 Boolean to handle SetFromOptions calls.
 
PetscObject obj
 The actual PETSc object (KSP, PC, SNES or TS).
 
PetscClassId cid
 The class id of the actual PETSc object.
 
PetscParVectorB
 Right-hand side and solution vector.
 
PetscParVectorX
 
PetscBCHandlerbchandler
 Handler for boundary conditions.
 
void * private_ctx
 Private context for solver.
 
bool operatorset
 Boolean to handle SetOperator calls.
 

Detailed Description

Abstract class for PETSc's solvers.

Definition at line 675 of file petsc.hpp.

Constructor & Destructor Documentation

◆ PetscSolver()

mfem::PetscSolver::PetscSolver ( )

Construct an empty PetscSolver. Initialize protected objects to NULL.

Definition at line 2354 of file petsc.cpp.

◆ ~PetscSolver()

mfem::PetscSolver::~PetscSolver ( )
virtual

Destroy the PetscParVectors allocated (if any).

Definition at line 2364 of file petsc.cpp.

Member Function Documentation

◆ CreatePrivateContext()

void mfem::PetscSolver::CreatePrivateContext ( )
protected

These two methods handle creation and destructions of private data for the Solver objects

Definition at line 2752 of file petsc.cpp.

◆ Customize()

void mfem::PetscSolver::Customize ( bool customize = true) const

Customize object with options set.

If customize is false, it disables any options customization.

Definition at line 2628 of file petsc.cpp.

◆ FreePrivateContext()

void mfem::PetscSolver::FreePrivateContext ( )
protected

Definition at line 2784 of file petsc.cpp.

◆ GetComm()

MPI_Comm mfem::PetscSolver::GetComm ( ) const

Get the associated MPI communicator.

Definition at line 2533 of file petsc.cpp.

◆ GetConverged()

int mfem::PetscSolver::GetConverged ( )

Definition at line 2661 of file petsc.cpp.

◆ GetFinalNorm()

mfem::real_t mfem::PetscSolver::GetFinalNorm ( )

Definition at line 2727 of file petsc.cpp.

◆ GetNumIterations()

int mfem::PetscSolver::GetNumIterations ( )

Definition at line 2694 of file petsc.cpp.

◆ operator PetscObject()

mfem::PetscSolver::operator PetscObject ( ) const
inline

Conversion function to PetscObject.

Definition at line 735 of file petsc.hpp.

◆ SetAbsTol()

void mfem::PetscSolver::SetAbsTol ( mfem::real_t tol)

Definition at line 2401 of file petsc.cpp.

◆ SetBCHandler()

void mfem::PetscSolver::SetBCHandler ( PetscBCHandler * bch)

Sets the object to handle essential boundary conditions.

Definition at line 2568 of file petsc.cpp.

◆ SetMaxIter()

void mfem::PetscSolver::SetMaxIter ( int max_iter)

Definition at line 2426 of file petsc.cpp.

◆ SetMonitor()

void mfem::PetscSolver::SetMonitor ( PetscSolverMonitor * ctx)

Sets user-defined monitoring routine.

Definition at line 2538 of file petsc.cpp.

◆ SetPreconditionerFactory()

void mfem::PetscSolver::SetPreconditionerFactory ( PetscPreconditionerFactory * factory)

Sets the object for the creation of the preconditioner.

Definition at line 2587 of file petsc.cpp.

◆ SetPrintLevel()

void mfem::PetscSolver::SetPrintLevel ( int plev)

Definition at line 2453 of file petsc.cpp.

◆ SetRelTol()

void mfem::PetscSolver::SetRelTol ( mfem::real_t tol)

Definition at line 2376 of file petsc.cpp.

◆ SetTol()

void mfem::PetscSolver::SetTol ( mfem::real_t tol)

Definition at line 2371 of file petsc.cpp.

Member Data Documentation

◆ B

PetscParVector* mfem::PetscSolver::B
mutableprotected

Right-hand side and solution vector.

Definition at line 688 of file petsc.hpp.

◆ bchandler

PetscBCHandler* mfem::PetscSolver::bchandler
protected

Handler for boundary conditions.

Definition at line 691 of file petsc.hpp.

◆ cid

PetscClassId mfem::PetscSolver::cid
protected

The class id of the actual PETSc object.

Definition at line 685 of file petsc.hpp.

◆ clcustom

bool mfem::PetscSolver::clcustom
mutableprotected

Boolean to handle SetFromOptions calls.

Definition at line 679 of file petsc.hpp.

◆ obj

PetscObject mfem::PetscSolver::obj
protected

The actual PETSc object (KSP, PC, SNES or TS).

Definition at line 682 of file petsc.hpp.

◆ operatorset

bool mfem::PetscSolver::operatorset
mutableprotected

Boolean to handle SetOperator calls.

Definition at line 697 of file petsc.hpp.

◆ private_ctx

void* mfem::PetscSolver::private_ctx
protected

Private context for solver.

Definition at line 694 of file petsc.hpp.

◆ X

PetscParVector * mfem::PetscSolver::X
protected

Definition at line 688 of file petsc.hpp.


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