v0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
MoFEM::KspMethod Struct Reference

Data structure for KSP (linear solver) context. More...

#include "src/interfaces/LoopMethods.hpp"

Inheritance diagram for MoFEM::KspMethod:
[legend]
Collaboration diagram for MoFEM::KspMethod:
[legend]

Public Types

enum  KSPContext { CTX_SETFUNCTION , CTX_OPERATORS , CTX_KSPNONE }
 Context enumeration for KSP solver phases. More...
 
- Public Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0 , CTX_SET_F = 1 << 0 , CTX_SET_A = 1 << 1 , CTX_SET_B = 1 << 2 ,
  CTX_SET_X = 1 << 3 , CTX_SET_DX = 1 << 4 , CTX_SET_X_T = 1 << 5 , CTX_SET_X_TT = 1 << 6 ,
  CTX_SET_TIME = 1 << 7
}
 Enumeration for data context flags. More...
 
using Switches = std::bitset< 8 >
 Bitset type for context switches.
 

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 KspMethod ()
 Default constructor.
 
virtual ~KspMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 Copy data from another KSP method.
 
- Public Member Functions inherited from MoFEM::PetscData
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 PetscData ()
 Default constructor.
 
virtual ~PetscData ()=default
 Virtual destructor.
 
MoFEMErrorCode copyPetscData (const PetscData &petsc_data)
 Copy PETSc data from another instance.
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 

Public Attributes

KSPContext ksp_ctx
 Current KSP computation context.
 
KSP ksp
 PETSc KSP linear solver object.
 
Vec & ksp_f
 Reference to residual vector in KSP context.
 
Mat & ksp_A
 Reference to system matrix in KSP context.
 
Mat & ksp_B
 Reference to preconditioner matrix in KSP context.
 
- Public Attributes inherited from MoFEM::PetscData
Switches data_ctx
 Current data context switches.
 
Vec f
 PETSc residual vector.
 
Mat A
 PETSc Jacobian matrix.
 
Mat B
 PETSc preconditioner matrix.
 
Vec x
 PETSc solution vector.
 
Vec dx
 PETSc solution increment vector.
 
Vec x_t
 PETSc first time derivative vector.
 
Vec x_tt
 PETSc second time derivative vector.
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 
- Static Public Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 No data switch.
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 Residual vector switch.
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 Jacobian matrix switch.
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 Preconditioner matrix switch.
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 Solution vector switch.
 
static constexpr Switches CtxSetDX = PetscData::Switches(CTX_SET_DX)
 Solution increment switch.
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 First time derivative switch.
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 Second time derivative switch.
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 Time value switch.
 

Detailed Description

Data structure for KSP (linear solver) context.

This structure extends PetscData to provide context and data management specifically for PETSc KSP (Krylov Subspace) linear solvers. It stores the KSP solver instance and maintains context information about the current computation phase.

Definition at line 145 of file LoopMethods.hpp.

Member Enumeration Documentation

◆ KSPContext

Context enumeration for KSP solver phases.

Indicates the current phase of KSP computation, which determines which data structures are being used and what operations are valid.

Enumerator
CTX_SETFUNCTION 

Setting up the linear system function.

CTX_OPERATORS 

Setting up linear operators.

CTX_KSPNONE 

No specific KSP context.

Definition at line 162 of file LoopMethods.hpp.

162 {
163 CTX_SETFUNCTION, ///< Setting up the linear system function
164 CTX_OPERATORS, ///< Setting up linear operators
165 CTX_KSPNONE ///< No specific KSP context
166 };
@ CTX_KSPNONE
No specific KSP context.
@ CTX_SETFUNCTION
Setting up the linear system function.
@ CTX_OPERATORS
Setting up linear operators.

Constructor & Destructor Documentation

◆ KspMethod()

MoFEM::KspMethod::KspMethod ( )

Default constructor.

Definition at line 52 of file LoopMethods.cpp.

53 : ksp_ctx(CTX_KSPNONE), ksp(PETSC_NULLPTR), ksp_f(PetscData::f),
Mat & ksp_B
Reference to preconditioner matrix in KSP context.
KSPContext ksp_ctx
Current KSP computation context.
KSP ksp
PETSc KSP linear solver object.
Mat & ksp_A
Reference to system matrix in KSP context.
Vec & ksp_f
Reference to residual vector in KSP context.
Vec f
PETSc residual vector.
Mat B
PETSc preconditioner matrix.
Mat A
PETSc Jacobian matrix.

◆ ~KspMethod()

virtual MoFEM::KspMethod::~KspMethod ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ copyKsp()

MoFEMErrorCode MoFEM::KspMethod::copyKsp ( const KspMethod ksp)

Copy data from another KSP method.

Parameters
kspSource KSP method
Returns
Error code

Definition at line 56 of file LoopMethods.cpp.

56 {
59 this->ksp_ctx = ksp.ksp_ctx;
60 this->ksp = ksp.ksp;
62}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode copyPetscData(const PetscData &petsc_data)
Copy PETSc data from another instance.

◆ query_interface()

MoFEMErrorCode MoFEM::KspMethod::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Query interface for type casting.

Parameters
type_indexType information for interface querying
ifacePointer to interface object
Returns
Error code

Implements MoFEM::UnknownInterface.

Definition at line 46 of file LoopMethods.cpp.

47 {
48 *iface = const_cast<KspMethod *>(this);
49 return 0;
50};
KspMethod()
Default constructor.

Member Data Documentation

◆ ksp

KSP MoFEM::KspMethod::ksp

PETSc KSP linear solver object.

Definition at line 186 of file LoopMethods.hpp.

◆ ksp_A

Mat& MoFEM::KspMethod::ksp_A

Reference to system matrix in KSP context.

Definition at line 189 of file LoopMethods.hpp.

◆ ksp_B

Mat& MoFEM::KspMethod::ksp_B

Reference to preconditioner matrix in KSP context.

Examples
mofem/tutorials/cor-6/simple_elasticity.cpp.

Definition at line 190 of file LoopMethods.hpp.

◆ ksp_ctx

KSPContext MoFEM::KspMethod::ksp_ctx

Current KSP computation context.

Definition at line 185 of file LoopMethods.hpp.

◆ ksp_f

Vec& MoFEM::KspMethod::ksp_f

Reference to residual vector in KSP context.

Examples
mofem/tutorials/cor-6/simple_elasticity.cpp.

Definition at line 188 of file LoopMethods.hpp.


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