Loading...
Searching...
No Matches
EigenLUSolver.h
// Copyright (C) 2015 Chris Richardson
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#ifndef __DOLFIN_EIGEN_LU_SOLVER_H
#define __DOLFIN_EIGEN_LU_SOLVER_H
#include <map>
#include <memory>
#include <dolfin/common/types.h>
#include <Eigen/Dense>
#include "GenericLinearSolver.h"
namespace dolfin
{
class EigenMatrix;
class EigenVector;
class GenericLinearOperator;
class GenericVector;
class EigenLUSolver : public GenericLinearSolver
{
public:
EigenLUSolver(std::string method="default");
EigenLUSolver(std::shared_ptr<const EigenMatrix> A,
std::string method="default");
~EigenLUSolver();
void set_operator(std::shared_ptr<const GenericLinearOperator> A);
void set_operator(std::shared_ptr<const EigenMatrix> A);
const GenericLinearOperator& get_operator() const;
std::size_t solve(GenericVector& x, const GenericVector& b);
std::size_t solve(const GenericLinearOperator& A, GenericVector& x,
const GenericVector& b);
std::size_t solve(const EigenMatrix& A, EigenVector& x,
const EigenVector& b);
std::string str(bool verbose) const;
static std::map<std::string, std::string> methods();
static Parameters default_parameters();
std::string parameter_type() const
{ return "lu_solver"; }
// Eigen LU implementation class
class EigenLUImplBase;
private:
std::unique_ptr<EigenLUImplBase> _impl;
// Available LU solvers and descriptions
static const std::map<std::string, std::string> _methods_descr;
// Current selected method
std::string _method;
// Select LU solver type
std::string select_solver(const std::string method) const;
// Operator (the matrix)
std::shared_ptr<const EigenMatrix> _matA;
};
}
#endif
dolfin::EigenLUSolver::EigenLUSolver
EigenLUSolver(std::string method="default")
Constructor.
Definition EigenLUSolver.cpp:149
dolfin::EigenLUSolver::get_operator
const GenericLinearOperator & get_operator() const
Get operator (matrix).
Definition EigenLUSolver.cpp:199
dolfin::EigenLUSolver::str
std::string str(bool verbose) const
Return informal string representation (pretty-print).
Definition EigenLUSolver.cpp:320
dolfin::EigenLUSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition EigenLUSolver.cpp:142
dolfin::EigenLUSolver::solve
std::size_t solve(GenericVector &x, const GenericVector &b)
Solve linear system Ax = b.
Definition EigenLUSolver.cpp:210
dolfin::EigenLUSolver::set_operator
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set operator (matrix).
Definition EigenLUSolver.cpp:179
dolfin::EigenLUSolver::methods
static std::map< std::string, std::string > methods()
Return a list of available solver methods.
Definition EigenLUSolver.cpp:137
dolfin::EigenLUSolver::~EigenLUSolver
~EigenLUSolver()
Destructor.
Definition EigenLUSolver.cpp:174
dolfin::EigenLUSolver::parameter_type
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition EigenLUSolver.h:83
dolfin::EigenMatrix
Definition EigenMatrix.h:47
dolfin::EigenVector
Definition EigenVector.h:46
dolfin::GenericLinearOperator
Definition GenericLinearOperator.h:43
dolfin::GenericLinearSolver
This class provides a general solver for linear systems Ax = b.
Definition GenericLinearSolver.h:38
dolfin::GenericVector
This class defines a common interface for vectors.
Definition GenericVector.h:48
dolfin::Parameters
Definition Parameters.h:95
dolfin
Definition adapt.h:30