21PetscErrorCode
KspRhs(KSP ksp, Vec f,
void *ctx) {
29 auto cache_ptr = boost::make_shared<CacheTuple>();
33 auto set = [&](
auto &fe) {
38 fe.cacheWeakPtr = cache_ptr;
41 auto unset = [&](
auto &fe) {
61 *(lit.second),
nullptr,
62 ksp_ctx->
bH, cache_ptr);
78 CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
79 CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
80 CHKERR VecAssemblyBegin(f);
86PetscErrorCode
KspMat(KSP ksp, Mat
A, Mat
B,
void *ctx) {
93 auto cache_ptr = boost::make_shared<CacheTuple>();
97 auto set = [&](
auto &fe) {
103 fe.cacheWeakPtr = cache_ptr;
106 auto unset = [&](
auto &fe) {
111 auto ent_data_cache = boost::make_shared<std::vector<EntityCacheDofs>>();
113 boost::make_shared<std::vector<EntityCacheNumeredDofs>>();
115 boost::make_shared<std::vector<EntityCacheNumeredDofs>>();
132 *(lit.second),
nullptr,
133 ksp_ctx->
bH, cache_ptr);
149 CHKERR MatAssemblyBegin(
B, MAT_FINAL_ASSEMBLY);
150 CHKERR MatAssemblyEnd(
B, MAT_FINAL_ASSEMBLY);
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode KspRhs(KSP ksp, Vec f, void *ctx)
Run over elements in the lists.
PetscErrorCode KspMat(KSP ksp, Mat A, Mat B, void *ctx)
Run over elements in the list.
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
Interface for linear (KSP) solver.
FEMethodsSequence loops_to_do_Rhs
PetscLogEvent MOFEM_EVENT_KspRhs
BasicMethodsSequence preProcess_Rhs
BasicMethodsSequence postProcess_Rhs
BasicMethodsSequence postProcess_Mat
boost::movelib::unique_ptr< bool > matAssembleSwitch
PetscLogEvent MOFEM_EVENT_KspMat
MoFEMErrorCode clearLoops()
Clear loops.
BasicMethodsSequence preProcess_Mat
MoFEM::Interface & mField
MoFEMTypes bH
If set to MF_EXIST check if element exist.
std::string problemName
Problem name.
boost::movelib::unique_ptr< bool > vecAssembleSwitch
FEMethodsSequence loops_to_do_Mat
static constexpr Switches CtxSetA
static constexpr Switches CtxSetNone
static constexpr Switches CtxSetF
static constexpr Switches CtxSetB