Commit 474d9f30 authored by Gregor Olenik's avatar Gregor Olenik
Browse files

Make BiCGStabFactory consistent with CGFactory

parent 746fc5c1
...@@ -41,18 +41,15 @@ class GKOBiCGStabFactory { ...@@ -41,18 +41,15 @@ class GKOBiCGStabFactory {
private: private:
// executor where Ginkgo will perform the computation // executor where Ginkgo will perform the computation
const label maxIterI_;
const scalar toleranceI_;
const word preconditioner_; const word preconditioner_;
const label blockSize_;
public: public:
GKOBiCGStabFactory(const dictionary &controlDict_) GKOBiCGStabFactory(const dictionary &dictionary_)
: maxIterI_(controlDict_.lookupOrDefault("maxIter", label(1000))), : preconditioner_(
toleranceI_(controlDict_.lookupOrDefault("tolerance", scalar(1e-6))), dictionary_.lookupOrDefault("preconditioner", word("none"))),
preconditioner_( blockSize_(dictionary_.lookupOrDefault("maxBlockSize", label(16))){};
controlDict_.lookupOrDefault("preconditioner", word("none"))){};
std::unique_ptr<gko::solver::Bicgstab<double>::Factory, std::unique_ptr<gko::solver::Bicgstab<double>::Factory,
std::default_delete<gko::solver::Bicgstab<double>::Factory>> std::default_delete<gko::solver::Bicgstab<double>::Factory>>
...@@ -61,7 +58,7 @@ public: ...@@ -61,7 +58,7 @@ public:
std::vector<std::shared_ptr<const gko::stop::CriterionFactory>> std::vector<std::shared_ptr<const gko::stop::CriterionFactory>>
criterion_vec) const criterion_vec) const
{ {
// if (preconditioner_ == "none") if (preconditioner_ == "BJ") return create_BJ(exec, criterion_vec);
return create_default(exec, criterion_vec); return create_default(exec, criterion_vec);
}; };
...@@ -79,17 +76,15 @@ public: ...@@ -79,17 +76,15 @@ public:
std::unique_ptr<gko::solver::Bicgstab<double>::Factory, std::unique_ptr<gko::solver::Bicgstab<double>::Factory,
std::default_delete<gko::solver::Bicgstab<double>::Factory>> std::default_delete<gko::solver::Bicgstab<double>::Factory>>
create_BJ(std::shared_ptr<gko::Executor> exec) const create_BJ(std::shared_ptr<gko::Executor> exec,
std::vector<std::shared_ptr<const gko::stop::CriterionFactory>>
criterion_vec) const
{ {
using bj = gko::preconditioner::Jacobi<>; using bj = gko::preconditioner::Jacobi<>;
return gko::solver::Bicgstab<scalar>::build() return gko::solver::Bicgstab<scalar>::build()
.with_criteria( .with_criteria(criterion_vec)
gko::stop::Iteration::build().with_max_iters(maxIterI_).on( .with_preconditioner(
exec), bj::build().with_max_block_size(blockSize_).on(exec))
gko::stop::ResidualNormReduction<scalar>::build()
.with_reduction_factor(toleranceI_)
.on(exec))
.with_preconditioner(bj::build().with_max_block_size(8u).on(exec))
.on(exec); .on(exec);
}; };
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment