Loading...
Searching...
No Matches
Amesos2LUSolver.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_AMESOS2_LU_SOLVER_H
#define __DOLFIN_AMESOS2_LU_SOLVER_H
#ifdef HAS_TRILINOS
#include "GenericLinearSolver.h"
#include <Amesos2_Factory.hpp>
namespace dolfin
{
class GenericLinearOperator;
class GenericVector;
class TpetraMatrix;
class TpetraVector;
class Amesos2LUSolver : public GenericLinearSolver
{
public:
Amesos2LUSolver(std::string method="default");
Amesos2LUSolver(std::shared_ptr<const TpetraMatrix> A,
std::string method="default");
~Amesos2LUSolver();
void set_operator(std::shared_ptr<const GenericLinearOperator> A);
void set_operator(std::shared_ptr<const TpetraMatrix> 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 TpetraMatrix& A,
TpetraVector& x,
const TpetraVector& 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"; }
private:
void init_solver(std::string& method);
// Reference counted pointer (RCP) to solver
Teuchos::RCP<Amesos2::Solver<TpetraMatrix::matrix_type,
TpetraVector::vector_type>> _solver;
// Operator (the matrix)
std::shared_ptr<const TpetraMatrix> _matA;
// Method name
std::string _method_name;
};
}
#endif
#endif
dolfin::Amesos2LUSolver::str
std::string str(bool verbose) const
Return informal string representation (pretty-print).
Definition Amesos2LUSolver.cpp:204
dolfin::Amesos2LUSolver::methods
static std::map< std::string, std::string > methods()
Return a list of available solver methods.
Definition Amesos2LUSolver.cpp:35
dolfin::Amesos2LUSolver::~Amesos2LUSolver
~Amesos2LUSolver()
Destructor.
Definition Amesos2LUSolver.cpp:95
dolfin::Amesos2LUSolver::Amesos2LUSolver
Amesos2LUSolver(std::string method="default")
Constructor.
Definition Amesos2LUSolver.cpp:68
dolfin::Amesos2LUSolver::parameter_type
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition Amesos2LUSolver.h:85
dolfin::Amesos2LUSolver::set_operator
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set operator (matrix).
Definition Amesos2LUSolver.cpp:101
dolfin::Amesos2LUSolver::solve
std::size_t solve(GenericVector &x, const GenericVector &b)
Solve linear system Ax = b.
Definition Amesos2LUSolver.cpp:140
dolfin::Amesos2LUSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition Amesos2LUSolver.cpp:60
dolfin::Amesos2LUSolver::get_operator
const GenericLinearOperator & get_operator() const
Get operator (matrix).
Definition Amesos2LUSolver.cpp:129
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::TpetraMatrix
Definition TpetraMatrix.h:59
dolfin::TpetraMatrix::matrix_type
Tpetra::CrsMatrix< double, int, dolfin::la_index > matrix_type
Matrix type (scalar, local index, global index).
Definition TpetraMatrix.h:64
dolfin::TpetraVector
Definition TpetraVector.h:54
dolfin::TpetraVector::vector_type
Tpetra::MultiVector< double, int, dolfin::la_index, node_type > vector_type
TpetraVector vector type (scalar, local index, global index, node).
Definition TpetraVector.h:63
dolfin
Definition adapt.h:30