BELFEM 0.9.3
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::Solver Class Reference

Unified interface to the sparse direct solvers. More...

#include <cl_Solver.hpp>

Public Member Functions

 Solver (const SolverType aSolverType=gDefaultSolver)
 Collective: the constructor synchronizes the solver settings ( not the solver type ) from rank 0 to every rank, so all ranks must construct the Solver together.
 Solver (const SolverParameters aParams)
 ~Solver ()
 Solver (const Solver &)=delete
 Solver (Solver &&)=delete
Solver & operator= (const Solver &)=delete
Solver & operator= (Solver &&)=delete
SolverType type () const
const SolverParameters & parameters () const
 read-only view of the parameters this solver was built with ( e.g.
void set_symmetry_mode (const SymmetryMode &aMode)
 symmetry mode, needed for some solvers
void solve (SpMatrix &aMatrix, Vector< real > &aLHS, Vector< real > &aRHS)
 Solves A x = b.
void solve (SpMatrix &aMatrix, Matrix< real > &aLHS, Matrix< real > &aRHS)
 Same contract as the vector overload, with one right-hand side per column of aRHS; the backend resizes aLHS to that shape.
void set_petsc (const Preconditioner aPreconditioner, const KrylovMethod aKrylovMethod, const real aEpsilon=1e-8)
 this does only do something if PETSc is used
void set_mumps_reordering (const MumpsSerialReodrdering aSerial, const MumpsParallelReodrdering aParallel)
 Silently ignored unless the solver is MUMPS.
void set_mumps_blr (const MumpsBlockLowRanking aBlr, const real aEpsilon)
void set_mumps_error_analysis (const MumpsErrorAnalysis aSetting)
void free ()
 Releases the factorization ( the destructor does it too ); the next solve() re-initializes from scratch, including the RHS column count.
solver::Wrapper * wrapper ()
 Borrowed: the Solver owns and deletes the wrapper; do not keep it past the Solver's lifetime.

Detailed Description

Unified interface to the sparse direct solvers.

See also
BELFEM Sparse Matrix Module - Usage Guide

Constructor & Destructor Documentation

◆ Solver() [1/4]

belfem::Solver::Solver ( const SolverType aSolverType = gDefaultSolver)

Collective: the constructor synchronizes the solver settings ( not the solver type ) from rank 0 to every rank, so all ranks must construct the Solver together.

Both constructors share this contract.

◆ Solver() [2/4]

belfem::Solver::Solver ( const SolverParameters aParams)

◆ ~Solver()

belfem::Solver::~Solver ( )

◆ Solver() [3/4]

belfem::Solver::Solver ( const Solver & )
delete

◆ Solver() [4/4]

belfem::Solver::Solver ( Solver && )
delete

Member Function Documentation

◆ free()

void belfem::Solver::free ( )

Releases the factorization ( the destructor does it too ); the next solve() re-initializes from scratch, including the RHS column count.

◆ operator=() [1/2]

Solver & belfem::Solver::operator= ( const Solver & )
delete

◆ operator=() [2/2]

Solver & belfem::Solver::operator= ( Solver && )
delete

◆ parameters()

const SolverParameters & belfem::Solver::parameters ( ) const

read-only view of the parameters this solver was built with ( e.g.

for setup-time consistency checks against the nonlinear tolerances )

◆ set_mumps_blr()

void belfem::Solver::set_mumps_blr ( const MumpsBlockLowRanking aBlr,
const real aEpsilon )

◆ set_mumps_error_analysis()

void belfem::Solver::set_mumps_error_analysis ( const MumpsErrorAnalysis aSetting)

◆ set_mumps_reordering()

void belfem::Solver::set_mumps_reordering ( const MumpsSerialReodrdering aSerial,
const MumpsParallelReodrdering aParallel )

Silently ignored unless the solver is MUMPS.

The three setters below share this contract.

◆ set_petsc()

void belfem::Solver::set_petsc ( const Preconditioner aPreconditioner,
const KrylovMethod aKrylovMethod,
const real aEpsilon = 1e-8 )

this does only do something if PETSc is used

Parameters
aPreconditioner
aKrylovMethod
aEpsilon

◆ set_symmetry_mode()

void belfem::Solver::set_symmetry_mode ( const SymmetryMode & aMode)

symmetry mode, needed for some solvers

Parameters
aMode

◆ solve() [1/2]

void belfem::Solver::solve ( SpMatrix & aMatrix,
Matrix< real > & aLHS,
Matrix< real > & aRHS )

Same contract as the vector overload, with one right-hand side per column of aRHS; the backend resizes aLHS to that shape.

The first solve initializes the wrapper with aRHS's column count. PETSc and STRUMPACK have no matrix overload and abort here.

◆ solve() [2/2]

void belfem::Solver::solve ( SpMatrix & aMatrix,
Vector< real > & aLHS,
Vector< real > & aRHS )

Solves A x = b.

It is collective for the MPI backends ( MUMPS, STRUMPACK, PETSc ) and local for the others. The first call initializes the wrapper. It does not return a failure status: when the wrapper's soft-fail contract is armed on a backend that has one ( MUMPS, STRUMPACK, PETSc ), a failed factorization or solve is reported by wrapper()->failed(); every other failure aborts ( BELFEM_ERROR ).

◆ type()

SolverType belfem::Solver::type ( ) const

◆ wrapper()

solver::Wrapper * belfem::Solver::wrapper ( )
inline

Borrowed: the Solver owns and deletes the wrapper; do not keep it past the Solver's lifetime.


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