v0.15.0
Loading...
Searching...
No Matches
KspCtx.hpp
Go to the documentation of this file.
1/** \file KspCtx.hpp
2 * \brief Context for PETSc KSP, i.e. nonlinear solver
3 * \author Anonymous contributor under MIT license
4 */
5
6#ifndef __KSPCTX_HPP__
7#define __KSPCTX_HPP__
8
9namespace MoFEM {
10
11/** \brief Interface for linear (KSP) solver
12 * \ingroup mofem_petsc_solvers
13 */
14struct KspCtx {
15
16 KspCtx(MoFEM::Interface &m_field, std::string problem_name);
17
18 virtual ~KspCtx();
19
20 /**
21 * @return return reference to vector with FEMethod to calculate matrix
22 */
24
25 /**
26 * @return return vector to vector with FEMethod to vector
27 */
29
30 /**
31 * The sequence of BasicMethod is executed before residual is calculated. It
32 * can be used to setup data structures, e.g. zero global variable which is
33 * integrated in domain, e.g. for calculation of strain energy.
34 *
35 * @return reference to BasicMethod for preprocessing
36 */
38
39 /**
40 * The sequence of BasicMethod is executed after residual is calculated. It
41 * can be used to setup data structures, e.g. aggregate data from processors
42 * or to apply essential boundary conditions.
43 *
44 * @return reference to BasicMethod for postprocessing
45 */
47
48 /**
49 * @return reference to BasicMethod for preprocessing
50 */
52
53 /**
54 * The sequence of BasicMethod is executed after tangent matrix is calculated.
55 * It can be used to setup data structures, e.g. aggregate data from
56 * processors or to apply essential boundary conditions.
57 *
58 * @return reference to BasicMethod for postprocessing
59 */
61
62 /**
63 * @brief Clear loops
64 *
65 * @return MoFEMErrorCode
66 */
68
69 friend PetscErrorCode KspRhs(KSP ksp, Vec f, void *ctx);
70 friend PetscErrorCode KspMat(KSP ksp, Mat A, Mat B, void *ctx);
71
72 struct KspCtxImpl;
73private:
74 boost::movelib::unique_ptr<KspCtxImpl> kspCtxImpl;
75};
76
77/**
78 * \brief Run over elements in the lists
79 * @param ksp KSP solver
80 * @param f the right hand side vector
81 * @param ctx data context, i.e. KspCtx
82 * @return error code
83 */
84PetscErrorCode KspRhs(KSP ksp, Vec f, void *ctx);
85
86/**
87 * \brief Run over elements in the list
88 * @param ksp KSP solver
89 * @param A matrix
90 * @param B Preconditioned matrix
91 * @param ctx data context, i.e. KspCtx
92 * @return error code
93 */
94PetscErrorCode KspMat(KSP ksp, Mat A, Mat B, void *ctx);
95
96} // namespace MoFEM
97
98#endif // __KSPCTX_HPP__
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
PetscErrorCode KspRhs(KSP ksp, Vec f, void *ctx)
Run over elements in the lists.
Definition KspCtx.cpp:146
std::deque< BasicMethodPtr > BasicMethodsSequence
Definition AuxPETSc.hpp:57
PetscErrorCode KspMat(KSP ksp, Mat A, Mat B, void *ctx)
Run over elements in the list.
Definition KspCtx.cpp:210
std::deque< PairNameFEMethodPtr > FEMethodsSequence
Definition AuxPETSc.hpp:56
Deprecated interface functions.
Interface for linear (KSP) solver.
Definition KspCtx.hpp:14
boost::movelib::unique_ptr< KspCtxImpl > kspCtxImpl
Definition KspCtx.hpp:74
BasicMethodsSequence & getPostProcComputeRhs()
Definition KspCtx.cpp:114
BasicMethodsSequence & getPreProcComputeRhs()
Definition KspCtx.cpp:110
BasicMethodsSequence & getPreProcSetOperators()
Definition KspCtx.cpp:118
FEMethodsSequence & getSetOperators()
Definition KspCtx.cpp:102
friend PetscErrorCode KspRhs(KSP ksp, Vec f, void *ctx)
Run over elements in the lists.
Definition KspCtx.cpp:146
FEMethodsSequence & getComputeRhs()
Definition KspCtx.cpp:106
MoFEMErrorCode clearLoops()
Clear loops.
Definition KspCtx.cpp:126
virtual ~KspCtx()
friend PetscErrorCode KspMat(KSP ksp, Mat A, Mat B, void *ctx)
Run over elements in the list.
Definition KspCtx.cpp:210
BasicMethodsSequence & getPostProcSetOperators()
Definition KspCtx.cpp:122