Run over elements in the list.
211 {
212
215 PetscLogEventBegin(ksp_ctx->MOFEM_EVENT_KspMat, 0, 0, 0, 0);
216
217 ksp_ctx->matAssembleSwitch = boost::movelib::make_unique<bool>(true);
218 auto cache_ptr = boost::make_shared<CacheTuple>();
219 CHKERR ksp_ctx->mField.cache_problem_entities(ksp_ctx->problemName,
220 cache_ptr);
221
222 auto set = [&](auto &fe) {
223 fe.ksp = ksp;
228 fe.cacheWeakPtr = cache_ptr;
229 };
230
231 auto unset = [&](auto &fe) {
234 };
235
236 auto ent_data_cache = boost::make_shared<std::vector<EntityCacheDofs>>();
237 auto ent_row_cache =
238 boost::make_shared<std::vector<EntityCacheNumeredDofs>>();
239 auto ent_col_cache =
240 boost::make_shared<std::vector<EntityCacheNumeredDofs>>();
241
242
243 for (
auto &
bit : ksp_ctx->preProcessOperator) {
244 bit->matAssembleSwitch = boost::move(ksp_ctx->matAssembleSwitch);
246 CHKERR ksp_ctx->mField.problem_basic_method_preProcess(ksp_ctx->problemName,
249 ksp_ctx->matAssembleSwitch = boost::move(
bit->matAssembleSwitch);
250 }
251
252
253 for (auto &lit : ksp_ctx->loopsOperator) {
254 lit.second->matAssembleSwitch = boost::move(ksp_ctx->matAssembleSwitch);
255 set(*lit.second);
256 CHKERR ksp_ctx->mField.loop_finite_elements(ksp_ctx->problemName, lit.first,
257 *(lit.second), nullptr,
258 ksp_ctx->bH, cache_ptr);
259 unset(*lit.second);
260 ksp_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
261 }
262
263
264 for (
auto &
bit : ksp_ctx->postProcessOperator) {
265 bit->matAssembleSwitch = boost::move(ksp_ctx->matAssembleSwitch);
267 CHKERR ksp_ctx->mField.problem_basic_method_postProcess(
268 ksp_ctx->problemName, *
bit);
270 ksp_ctx->matAssembleSwitch = boost::move(
bit->matAssembleSwitch);
271 }
272
273 if (ksp_ctx->matAssembleSwitch) {
274 CHKERR MatAssemblyBegin(
B, MAT_FINAL_ASSEMBLY);
275 CHKERR MatAssemblyEnd(
B, MAT_FINAL_ASSEMBLY);
276 }
277 PetscLogEventEnd(ksp_ctx->MOFEM_EVENT_KspMat, 0, 0, 0, 0);
279}
#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.
KspCtx(MoFEM::Interface &m_field, std::string problem_name)
@ CTX_KSPNONE
No specific KSP context.
@ CTX_OPERATORS
Setting up linear operators.
static constexpr Switches CtxSetA
Jacobian matrix switch.
static constexpr Switches CtxSetNone
No data switch.
static constexpr Switches CtxSetB
Preconditioner matrix switch.