23    PetscFunctionBeginUser;
 
   25    PetscFunctionReturn(0);
 
   31    PetscFunctionBeginUser;
 
   35    std::string info = 
"";
 
   36    info += (std::string(80, 
'=') + 
"\n");
 
   37    info += (
"Linear Solver " + 
name + 
":\n");
 
   38    info += (std::string(80, 
'=') + 
"\n");
 
   40    info += (
"\tType: " + 
type + 
"\n\n");
 
   41    info += (
"\tConfig file: " + 
config + 
"\n\n");
 
   43    ierr = PetscPrintf(PETSC_COMM_WORLD, 
"%s", info.c_str()); CHKERRQ(ierr);
 
   45    PetscFunctionReturn(0);
 
   51    PetscFunctionBeginUser;
 
   53    PetscFunctionReturn(0);
 
   60    PetscFunctionBeginUser;
 
   62    std::string key, config, type;
 
   64    key = solverName + 
"Solver";
 
   67    type = node[
"parameters"][key][
"type"].as<std::string>(
"CPU");
 
   70    config = node[
"parameters"][key][
"config"].as<std::string>(
"None");
 
   71    if (config[0] != 
'/' && config != 
"None")
 
   72        config = node[
"directory"].as<std::string>() + 
"/" + config;
 
   76        solver = std::make_shared<LinSolverKSP>(solverName, config);
 
   77    else if (type == 
"GPU")
 
   79        solver = std::make_shared<LinSolverAmgX>(solverName, config);
 
   81        SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
 
   82                "AmgX solver is used, while PetIBM is not compiled with AmgX.");
 
   85        SETERRQ2(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
 
   86                 "Unrecognized value \"%s\" of the type of the linear solver " 
   88                 type.c_str(), solverName.c_str());
 
   90    PetscFunctionReturn(0);
 
PetscErrorCode printInfo() const
Print information to standard output.
std::string config
Path of the solver configuration file to read.
std::string name
Name of the linear solver.
PetscErrorCode getType(std::string &_type) const
Get the type of this instance.
virtual PetscErrorCode destroy()
Manually destroy the data in the current instance.
std::string type
Type of the linear solver.
PetscErrorCode createLinSolver(const std::string &solverName, const YAML::Node &node, type::LinSolver &solver)
A factory function for creating a LinSolver.
std::shared_ptr< linsolver::LinSolverBase > LinSolver
Type definition of LinSolver.
Def. of LinSolverBase, LinSolver, and factory function.
A toolbox for building flow solvers.