23 #ifndef __GENERIC_LINEAR_ALGEBRA_FACTORY_H 24 #define __GENERIC_LINEAR_ALGEBRA_FACTORY_H 29 #include <dolfin/common/MPI.h> 30 #include <dolfin/common/types.h> 31 #include <dolfin/log/log.h> 34 #include "GenericLinearOperator.h" 39 class GenericLinearSolver;
57 virtual std::shared_ptr<GenericMatrix>
create_matrix(MPI_Comm comm)
const = 0;
60 virtual std::shared_ptr<GenericVector>
64 virtual std::shared_ptr<TensorLayout>
68 virtual std::shared_ptr<GenericLinearOperator>
72 virtual std::shared_ptr<GenericLinearSolver>
76 virtual std::shared_ptr<GenericLinearSolver>
79 std::string preconditioner)
const = 0;
84 {
return std::map<std::string, std::string>(); }
89 {
return std::map<std::string, std::string>(); }
93 virtual std::map<std::string, std::string>
95 {
return std::map<std::string, std::string>(); }
105 std::size_t
size(std::size_t dim)
const 109 { dolfin_not_implemented(); }
112 { dolfin_not_implemented();
return MPI_COMM_WORLD; }
114 std::string
str(
bool verbose)
const 115 { dolfin_not_implemented();
return ""; }
virtual std::shared_ptr< GenericLinearSolver > create_lu_solver(MPI_Comm comm, std::string method) const =0
Create LU solver.
std::string str(bool verbose) const
Return informal string representation (pretty-print)
Definition: GenericLinearAlgebraFactory.h:114
virtual ~GenericLinearAlgebraFactory()
Destructor.
Definition: GenericLinearAlgebraFactory.h:54
virtual std::shared_ptr< GenericLinearSolver > create_krylov_solver(MPI_Comm comm, std::string method, std::string preconditioner) const =0
Create Krylov solver.
void mult(const GenericVector &x, GenericVector &y) const
Compute matrix-vector product y = Ax.
Definition: GenericLinearAlgebraFactory.h:108
virtual std::shared_ptr< GenericLinearOperator > create_linear_operator(MPI_Comm comm) const =0
Create empty linear operator.
std::size_t size(std::size_t dim) const
Return size of given dimension.
Definition: GenericLinearAlgebraFactory.h:105
Definition: GenericLinearAlgebraFactory.h:101
Definition: GenericLinearOperator.h:42
GenericLinearAlgebraFactory()
Constructor.
Definition: GenericLinearAlgebraFactory.h:51
Base class for LinearAlgebra factories.
Definition: GenericLinearAlgebraFactory.h:46
virtual std::map< std::string, std::string > lu_solver_methods() const
Definition: GenericLinearAlgebraFactory.h:83
MPI_Comm mpi_comm() const
Return MPI communicator.
Definition: GenericLinearAlgebraFactory.h:111
virtual std::map< std::string, std::string > krylov_solver_methods() const
Definition: GenericLinearAlgebraFactory.h:88
virtual std::shared_ptr< GenericMatrix > create_matrix(MPI_Comm comm) const =0
Create empty matrix.
virtual std::map< std::string, std::string > krylov_solver_preconditioners() const
Definition: GenericLinearAlgebraFactory.h:94
virtual std::shared_ptr< TensorLayout > create_layout(MPI_Comm comm, std::size_t rank) const =0
Create empty tensor layout.
virtual std::shared_ptr< GenericVector > create_vector(MPI_Comm comm) const =0
Create empty vector.
This class defines a common interface for vectors.
Definition: GenericVector.h:47