15#define sc_double static_cast<double>
16#define PCShellPtr PetscErrorCode (*)(PC, Vec, Vec)
26 std::string method_name;
27 switch (groupset_.iterative_method_)
30 method_name =
"KRYLOV_RICHARDSON";
break;
32 method_name =
"KRYLOV_GMRES";
break;
34 method_name =
"KRYLOV_BICGSTAB";
break;
35 default: method_name =
"KRYLOV_GMRES";
39 <<
"********** Solving groupset " << groupset_.id_
40 <<
" with " << method_name <<
".\n\n";
52 if (groupset_.apply_tgdsa_)
54 PCSetType(pc, PCSHELL);
56 PCShellSetContext(pc, &(*
this));
59 KSPSetPCSide(ksp,PC_LEFT);
66 const size_t local_node_count = lbs_solver_.LocalNodeCount();
67 const size_t globl_node_count = lbs_solver_.GlobalNodeCount();
69 const size_t groupset_numgrps = groupset_.groups_.size();
70 const size_t local_size = local_node_count * groupset_numgrps;
71 const size_t globl_size = globl_node_count * groupset_numgrps;
73 return {
static_cast<int64_t
>(local_size),
74 static_cast<int64_t
>(globl_size)};
80 ++counter_applications_of_inv_op_;
81 auto& mip_solver = *lbs_mip_ss_solver_.gs_mip_solvers_[groupset_.id_];
83 lbs_solver_.PhiNewLocal() = lbs_solver_.QMomentsLocal();
86 VecDuplicate(mip_solver.RHS(), &work_vector);
88 lbs_solver_.SetGSPETScVecFromPrimarySTLvector(groupset_,
92 mip_solver.Assemble_b(work_vector);
93 mip_solver.Solve(work_vector);
95 lbs_solver_.SetPrimarySTLvectorFromGSPETScVec(groupset_,
99 VecDestroy(&work_vector);
105 lbs_solver_.GSScopedCopyPrimarySTLvectors(groupset_,
LogStream Log(LOG_LVL level=LOG_0)
@ KRYLOV_BICGSTAB
BiCGStab iterative algorithm.
@ KRYLOV_RICHARDSON
Richardson iteration.
@ KRYLOV_GMRES
GMRES iterative algorithm.
int MIP_TGDSA_PreConditionerMult(PC pc, Vec phi_input, Vec pc_output)
void SetPreconditioner(SolverType &solver) override
void ApplyInverseTransportOperator(int scope) override
void PostSolveCallback() override
void PreSetupCallback() override
std::pair< int64_t, int64_t > SystemSize() override