v0.8.4
Public Types | Public Member Functions | Public Attributes | List of all members
MoFEM::KspMethod Struct Reference

data structure for ksp (linear solver) contextStruture stores context data which are set in functions run by PETSc SNES functions. 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 }
 pass information about context of KSP/DM for with finite element is computed More...
 

Public Member Functions

MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 KspMethod ()
 
virtual ~KspMethod ()
 
MoFEMErrorCode setKspCtx (const KSPContext &ctx)
 set operator type More...
 
MoFEMErrorCode setKsp (KSP ksp)
 set solver More...
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

Public Attributes

KSPContext ksp_ctx
 Context. More...
 
KSP ksp
 KSP solver. More...
 
Vec ksp_f
 the right hand side vector More...
 
Mat ksp_A
 matrix More...
 
Mat ksp_B
 preconditioner matrix More...
 

Additional Inherited Members

- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

data structure for ksp (linear solver) context

Struture stores context data which are set in functions run by PETSc SNES functions.

Definition at line 45 of file LoopMethods.hpp.

Member Enumeration Documentation

◆ KSPContext

pass information about context of KSP/DM for with finite element is computed

Enumerator
CTX_SETFUNCTION 
CTX_OPERATORS 
CTX_KSPNONE 

Definition at line 61 of file LoopMethods.hpp.

Constructor & Destructor Documentation

◆ KspMethod()

MoFEM::KspMethod::KspMethod ( )

Definition at line 63 of file LoopMethods.hpp.

64  : ksp_ctx(CTX_KSPNONE), ksp(PETSC_NULL), ksp_f(PETSC_NULL),
65  ksp_A(PETSC_NULL), ksp_B(PETSC_NULL) {}
KSP ksp
KSP solver.
Definition: LoopMethods.hpp:91
Mat ksp_B
preconditioner matrix
Definition: LoopMethods.hpp:94
KSPContext ksp_ctx
Context.
Definition: LoopMethods.hpp:90
Mat ksp_A
matrix
Definition: LoopMethods.hpp:93
Vec ksp_f
the right hand side vector
Definition: LoopMethods.hpp:92

◆ ~KspMethod()

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

Definition at line 67 of file LoopMethods.hpp.

67 {}

Member Function Documentation

◆ copyKsp()

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

copy data form another method

Parameters
kspksp method
Returns
error code

Definition at line 32 of file LoopMethods.cpp.

32  {
34  this->ksp_ctx = ksp.ksp_ctx;
35  this->ksp = ksp.ksp;
36  this->ksp_f = ksp.ksp_f;
37  this->ksp_A = ksp.ksp_A;
38  this->ksp_B = ksp.ksp_B;
40 }
KSP ksp
KSP solver.
Definition: LoopMethods.hpp:91
Mat ksp_B
preconditioner matrix
Definition: LoopMethods.hpp:94
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
KSPContext ksp_ctx
Context.
Definition: LoopMethods.hpp:90
Mat ksp_A
matrix
Definition: LoopMethods.hpp:93
Vec ksp_f
the right hand side vector
Definition: LoopMethods.hpp:92

◆ query_interface()

MoFEMErrorCode MoFEM::KspMethod::query_interface ( const MOFEMuuid uuid,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Reimplemented in MoFEM::DofMethod, MoFEM::EntityMethod, MoFEM::FEMethod, and MoFEM::BasicMethod.

Definition at line 47 of file LoopMethods.hpp.

48  {
50  if (uuid == IDD_MOFEMKspMethod) {
51  *iface = const_cast<KspMethod *>(this);
53  }
54  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
55  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static const MOFEMuuid IDD_MOFEMKspMethod
Definition: LoopMethods.hpp:24

◆ setKsp()

MoFEMErrorCode MoFEM::KspMethod::setKsp ( KSP  ksp)

set solver

Parameters
kspsolver
Returns
error code

Definition at line 27 of file LoopMethods.cpp.

27  {
29  ksp = ksp_;
31 }
KSP ksp
KSP solver.
Definition: LoopMethods.hpp:91
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528

◆ setKspCtx()

MoFEMErrorCode MoFEM::KspMethod::setKspCtx ( const KSPContext ctx)

set operator type

Parameters
ctxContext, CTX_SETFUNCTION, CTX_OPERATORS, CTX_KSPNONE
Returns
error code

Definition at line 22 of file LoopMethods.cpp.

22  {
24  ksp_ctx = ctx;
26 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
KSPContext ksp_ctx
Context.
Definition: LoopMethods.hpp:90

Member Data Documentation

◆ ksp

KSP MoFEM::KspMethod::ksp

KSP solver.

Definition at line 91 of file LoopMethods.hpp.

◆ ksp_A

Mat MoFEM::KspMethod::ksp_A

matrix

Definition at line 93 of file LoopMethods.hpp.

◆ ksp_B

Mat MoFEM::KspMethod::ksp_B

preconditioner matrix

Definition at line 94 of file LoopMethods.hpp.

◆ ksp_ctx

KSPContext MoFEM::KspMethod::ksp_ctx

Context.

Definition at line 90 of file LoopMethods.hpp.

◆ ksp_f

Vec MoFEM::KspMethod::ksp_f

the right hand side vector

Definition at line 92 of file LoopMethods.hpp.


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