21 auto key = dict.
get<std::string>(
"solver");
22 SolverFactory::keyExistsOrError(key);
23 return SolverFactory::table().at(key)(exec, dict);
26 static std::string
name() {
return "SolverFactory"; }
36 virtual std::unique_ptr<SolverFactory>
clone()
const = 0;
49 : exec_(solver.exec_), solverInstance_(solver.solverInstance_->clone()) {};
52 : exec_(solver.exec_), solverInstance_(std::move(solver.solverInstance_)) {};
55 : exec_(exec), solverInstance_(std::move(solverInstance)) {};
58 : exec_(exec), solverInstance_(
SolverFactory::create(exec, dict)) {};
62 solverInstance_->solve(ls, field);
68 std::unique_ptr<SolverFactory> solverInstance_;
A class representing a dictionary that stores key-value pairs.
T & get(const std::string &key)
Retrieves the value associated with the given key, casting it to the specified type.
A factory class for runtime selection of derived classes.
A class to contain the data and executors for a field and define some basic operations.
A class representing a linear system of equations.
static std::string name()
virtual std::unique_ptr< SolverFactory > clone() const =0
virtual void solve(const LinearSystem< scalar, localIdx > &, Vector< scalar > &) const =0
SolverFactory(const Executor &exec)
static std::unique_ptr< SolverFactory > create(const Executor &exec, const Dictionary &dict)
Solver(const Solver &solver)
Solver(const Executor &exec, std::unique_ptr< SolverFactory > solverInstance)
Solver(const Executor &exec, const Dictionary &dict)
void solve(const LinearSystem< scalar, localIdx > &ls, Vector< scalar > &field) const
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor