* Constructor. Takes the solver control object and name
* and creates the solver.
*/
- SolverDirectBase(SolverControl &cn,
- const std::string &solver_type,
- const bool output_solver_details = false);
+ SolverDirectBase(SolverControl &cn, const std::string &solver_type);
/**
* Actually performs the operations for solving the linear system,
* including the factorization and forward and backward substitution.
*/
std::string solver_type;
- /**
- * Enables/disables the output of solver details (residual in each
- * iterations etc.).
- */
- bool output_solver_details;
-
-
/**
* An optional Teuchos::ParameterList for fine tuning the solver.
* Please refer to the Amesos2 manual to see which parameters
*/
struct AdditionalData
{
- AdditionalData(const std::string &solver_name,
- const bool output_solver_details = false);
+ AdditionalData(const std::string &solver_name);
/**
* that can nevertheless be used if configured.
*/
std::string solver_name;
-
- /**
- * Enables/disables the output of solver details (residual in each
- * iterations etc.).
- */
- bool output_solver_details;
};
/**
*/
struct AdditionalData
{
- AdditionalData(const std::string &transpose_mode = "NOTRANS",
- const bool symmetric_mode = false,
- const bool equilibrate_matrix = true,
- const std::string &column_permutation = "COLAMD",
- const std::string &iterative_refinement = "NO",
- const bool output_solver_details = false);
+ AdditionalData(const std::string &transpose_mode = "NOTRANS",
+ const bool symmetric_mode = false,
+ const bool equilibrate_matrix = true,
+ const std::string &column_permutation = "COLAMD",
+ const std::string &iterative_refinement = "NO");
/**
* Decide which system to solve
* "NOTRANS": Ax=b (default)
* "EXTRA": ??
*/
std::string iterative_refinement;
-
-
- /**
- * Enables/disables the output of solver details (residual in each
- * iterations etc.).
- */
- bool output_solver_details;
};
/**
template <typename Number, typename MemorySpace>
SolverDirectBase<Number, MemorySpace>::SolverDirectBase(
SolverControl &cn,
- const std::string &solver_type,
- const bool output_solver_details)
+ const std::string &solver_type)
: solver_control(cn)
, solver_type(solver_type)
- , output_solver_details(output_solver_details)
{
AssertThrow(Amesos2::query(solver_type),
ExcTrilinosAmesos2SolverUnsupported(solver_type));
SolverDirectBase<Number, MemorySpace>::initialize(
const SparseMatrix<Number, MemorySpace> &A)
{
- // First set whether we want to print the solver information to screen or
- // not.
- ConditionalOStream verbose_cout(std::cout, output_solver_details);
-
- // Next allocate the Amesos2 solver with the concrete solver, if possible.
+ // Allocate the Amesos2 solver with the concrete solver, if possible.
solver =
Amesos2::create<typename SparseMatrix<Number, MemorySpace>::MatrixType,
MultiVector>(solver_type, A.trilinos_rcp());
// Now do the actual factorization, which is a two step procedure.
// The symbolic factorization determines the structure of the inverse,
// while the numeric factorization does to actual computation of L and U
- verbose_cout << "Starting symbolic factorization" << std::endl;
solver->symbolicFactorization();
- verbose_cout << "Starting numeric factorization" << std::endl;
solver->numericFactorization();
}
// Assign the RHS vector
solver->setB(b.trilinos_rcp());
- // First set whether we want to print the solver information to screen
- // or not.
- ConditionalOStream verbose_cout(std::cout, output_solver_details);
- verbose_cout << "Starting solve" << std::endl;
solver->solve();
// Finally, force the SolverControl object to report convergence
void
SolverDirectBase<Number, MemorySpace>::do_solve()
{
- // First set whether we want to print the solver information to screen or
- // not.
- ConditionalOStream verbose_cout(std::cout, output_solver_details);
-
+ // Set the parameter list. If it is empty defaults will be used.
solver->setParameters(Teuchos::rcpFromRef(parameter_list));
// Now do the actual factorization, which is a two step procedure.
// The symbolic factorization determines the structure of the inverse,
// while the numeric factorization does to actual computation of L and U
- verbose_cout << "Starting symbolic factorization" << std::endl;
solver->symbolicFactorization();
- verbose_cout << "Starting numeric factorization" << std::endl;
solver->numericFactorization();
- verbose_cout << "Starting solve" << std::endl;
solver->solve();
// Finally, force the SolverControl object to report convergence
template <typename Number, typename MemorySpace>
SolverDirect<Number, MemorySpace>::AdditionalData::AdditionalData(
- const std::string &solver_name,
- const bool output_solver_details)
+ const std::string &solver_name)
: solver_name(solver_name)
- , output_solver_details(output_solver_details)
{}
template <typename Number, typename MemorySpace>
SolverDirect<Number, MemorySpace>::SolverDirect(SolverControl &cn,
const AdditionalData &ad)
- : SolverDirectBase<Number, MemorySpace>(cn,
- ad.solver_name,
- ad.output_solver_details)
+ : SolverDirectBase<Number, MemorySpace>(cn, ad.solver_name)
{}
const bool symmetric_mode,
const bool equilibrate_matrix,
const std::string &column_permutation,
- const std::string &iterative_refinement,
- const bool output_solver_details)
+ const std::string &iterative_refinement)
: transpose_mode(transpose_mode)
, symmetric_mode(symmetric_mode)
, equilibrate_matrix(equilibrate_matrix)
, column_permutation(column_permutation)
, iterative_refinement(iterative_refinement)
- , output_solver_details(output_solver_details)
{}
SolverDirectKLU2<Number, MemorySpace>::SolverDirectKLU2(
SolverControl &cn,
const AdditionalData &ad)
- : SolverDirectBase<Number, MemorySpace>(cn,
- "KLU2",
- ad.output_solver_details)
+ : SolverDirectBase<Number, MemorySpace>(cn, "KLU2")
{
this->parameter_list = Teuchos::ParameterList("Amesos2");
Teuchos::ParameterList klu2_params = this->parameter_list.sublist("KLU2");