std::shared_ptr<gko::Executor> executor,
const AdditionalData & data = AdditionalData());
+ /**
+ * Constructor.
+ *
+ * @p solver_control The solver control object is then used to set the
+ * parameters and setup the CG solver from the CG factory which solves the
+ * linear system.
+ *
+ * @p executor The execution paradigm for the CG solver.
+ */
+ SolverCG(SolverControl & solver_control,
+ std::shared_ptr<gko::Executor> executor,
+ std::shared_ptr<gko::LinOpFactory> preconditioner,
+ const AdditionalData & data = AdditionalData());
protected:
/**
* Store a copy of the settings for this particular solver.
cg::build().with_criteria(this->combined_factory).on(executor);
}
+ template <typename ValueType, typename IndexType>
+ SolverCG<ValueType, IndexType>::SolverCG(
+ SolverControl & solver_control,
+ std::shared_ptr<gko::Executor> executor,
+ std::shared_ptr<gko::LinOpFactory> preconditioner,
+ const AdditionalData & data)
+ : SolverBase<ValueType, IndexType>(solver_control, executor)
+ , additional_data(data)
+ {
+ using cg = gko::solver::Cg<ValueType>;
+ this->solver_gen =
+ cg::build().with_criteria(this->combined_factory).with_preconditioner(preconditioner).on(executor);
+ }
// Explicit instantiations in GinkgoWrappers
# define DEALII_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(_macro) \
template _macro(float, int32_t); \
// gko::OmpExecutor::create());
// std::shared_ptr<gko::Executor> exec = gko::OmpExecutor::create();
std::shared_ptr<gko::Executor> exec = gko::ReferenceExecutor::create();
+ std::shared_ptr<gko::LinOpFactory> jacobi = gko::preconditioner::Jacobi<>::build().on(exec);
GinkgoWrappers::SolverCG<> solver(control, exec);
+ GinkgoWrappers::SolverCG<> solver_with_jacobi_precond(control, exec, jacobi);
check_solver_within_range(solver.solve(A, u, f),
control.last_step(),
35,
39);
+ u = 0.;
+ check_solver_within_range(solver_with_jacobi_precond.solve(A, u, f),
+ control.last_step(),
+ 29,
+ 33);
}
}
DEAL::Size 32 Unknowns 961
DEAL::Solver stopped within 35 - 39 iterations
+DEAL::Solver stopped within 29 - 33 iterations