*
* @ingroup TrilinosWrappers
*/
- class SolverDirect
+ class SolverDirect : public Subscriptor
{
public:
/**
std::string solver_type;
};
+ /**
+ * Constructor. Creates the solver without solver control object.
+ */
+ explicit SolverDirect(const AdditionalData &data = AdditionalData());
+
/**
* Constructor. Takes the solver control object and creates the solver.
*/
void
initialize(const SparseMatrix &A);
+ /**
+ * Initializes the direct solver for the matrix <tt>A</tt> and creates a
+ * factorization for it with the package chosen from the additional
+ * data structure. Note that there is no need for a preconditioner
+ * here and solve() is not called. Furthermore, @p data replaces the
+ * data stored in this instance.
+ */
+ void
+ initialize(const SparseMatrix &A, const AdditionalData &data);
+
/**
* Solve the linear system <tt>Ax=b</tt> based on the
- * package set in initialize(). Note the matrix is not refactorized during
- * this call.
+ * package set in the constructor on initialize(). Note the matrix is not
+ * refactored during this call.
*/
void
solve(MPI::Vector &x, const MPI::Vector &b);
/**
* Solve the linear system <tt>Ax=b</tt> based on the package set in
* initialize() for deal.II's own parallel vectors. Note the matrix is not
- * refactorized during this call.
+ * refactored during this call.
*/
void
solve(dealii::LinearAlgebra::distributed::Vector<double> &x,
const dealii::LinearAlgebra::distributed::Vector<double> &b);
+ /**
+ * Solve the linear system <tt>Ax=b</tt> based on the
+ * package set in the constructor or initialize(). Note the matrix is not
+ * refactored during this call.
+ */
+ void
+ vmult(MPI::Vector &x, const MPI::Vector &b) const;
+
+ /**
+ * Solve the linear system <tt>Ax=b</tt> based on the package set in
+ * initialize() for deal.II's own parallel vectors. Note the matrix is not
+ * refactored during this call.
+ */
+ void
+ vmult(dealii::LinearAlgebra::distributed::Vector<double> &x,
+ const dealii::LinearAlgebra::distributed::Vector<double> &b) const;
+
/**
* Solve the linear system <tt>Ax=b</tt>. Creates a factorization of the
* matrix with the package chosen from the additional data structure and
void
do_solve();
+ /**
+ * Local dummy solver control object.
+ */
+ SolverControl solver_control_own;
+
/**
* Reference to the object that controls convergence of the iterative
* solver. In fact, for these Trilinos wrappers, Trilinos does so itself,
/**
* Store a copy of the flags for this particular solver.
*/
- const AdditionalData additional_data;
+ AdditionalData additional_data;
};
+ SolverDirect::SolverDirect(const AdditionalData &data)
+ : solver_control(solver_control_own)
+ , additional_data(data.output_solver_details, data.solver_type)
+ {}
+
+
+
SolverDirect::SolverDirect(SolverControl &cn, const AdditionalData &data)
: solver_control(cn)
, additional_data(data.output_solver_details, data.solver_type)
}
+
+ void
+ SolverDirect::initialize(const SparseMatrix &A, const AdditionalData &data)
+ {
+ this->additional_data = data;
+
+ this->initialize(A);
+ }
+
+
void
SolverDirect::solve(MPI::Vector &x, const MPI::Vector &b)
+ {
+ this->vmult(x, b);
+ }
+
+
+
+ void
+ SolverDirect::solve(
+ dealii::LinearAlgebra::distributed::Vector<double> &x,
+ const dealii::LinearAlgebra::distributed::Vector<double> &b)
+ {
+ this->vmult(x, b);
+ }
+
+
+ void
+ SolverDirect::vmult(MPI::Vector &x, const MPI::Vector &b) const
{
// Assign the empty LHS vector to the Epetra_LinearProblem object
linear_problem->SetLHS(&x.trilinos_vector());
void
- SolverDirect::solve(
+ SolverDirect::vmult(
dealii::LinearAlgebra::distributed::Vector<double> &x,
- const dealii::LinearAlgebra::distributed::Vector<double> &b)
+ const dealii::LinearAlgebra::distributed::Vector<double> &b) const
{
Epetra_Vector ep_x(View,
linear_problem->GetOperator()->OperatorDomainMap(),