📄 laspack_linear_solver.h
字号:
// $Id: laspack_linear_solver.h 2788 2008-04-13 02:05:22Z roystgnr $// The libMesh Finite Element Library.// Copyright (C) 2002-2007 Benjamin S. Kirk, John W. Peterson // This library 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 2.1 of the License, or (at your option) any later version. // This library 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 this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#ifndef __laspack_linear_solver_h__#define __laspack_linear_solver_h__#include "libmesh_common.h"#if defined(HAVE_LASPACK)//#if defined(HAVE_LASPACK) && !defined(USE_COMPLEX_NUMBERS)// C++ includes// Local includes#include "linear_solver.h"#include "laspack_vector.h"#include "laspack_matrix.h"#include <itersolv.h>#include <rtc.h>#include <errhandl.h>/** * This class provides an interface to Laspack * iterative solvers that is compatible with the \p libMesh * \p LinearSolver<> * * @author Benjamin Kirk, 2002-2007 */template <typename T>class LaspackLinearSolver : public LinearSolver<T>{ public: /** * Constructor. Initializes Laspack data structures */ LaspackLinearSolver (); /** * Destructor. */ ~LaspackLinearSolver (); /** * Release all memory and clear data structures. */ void clear (); /** * Initialize data structures if not done so already. */ void init (); /** * Call the Laspack solver */ std::pair<unsigned int, Real> solve (SparseMatrix<T> &matrix, NumericVector<T> &solution, NumericVector<T> &rhs, const double tol, const unsigned int m_its); /** * Call the Laspack solver */ std::pair<unsigned int, Real> solve (SparseMatrix<T> &matrix, SparseMatrix<T> &pc, NumericVector<T> &solution, NumericVector<T> &rhs, const double tol, const unsigned int m_its); /** * Prints a useful message about why the latest linear solve * con(di)verged. */ virtual void print_converged_reason(); private: /** * Tells LASPACK to use the user-specified preconditioner stored in * \p _preconditioner_type */ void set_laspack_preconditioner_type (); /** * Preconditioner type */ PrecondProcType _precond_type;};/*----------------------- functions ----------------------------------*/template <typename T>inlineLaspackLinearSolver<T>::LaspackLinearSolver () : _precond_type (ILUPrecond){}template <typename T>inlineLaspackLinearSolver<T>::~LaspackLinearSolver (){ this->clear ();}template <typename T>inlinestd::pair<unsigned int, Real>LaspackLinearSolver<T>::solve (SparseMatrix<T>&, SparseMatrix<T>&, NumericVector<T>&, NumericVector<T>&, const double, const unsigned int){ std::cerr << "ERROR: LASPACK does not support a user-supplied preconditioner!" << std::endl; libmesh_error(); std::pair<unsigned int, Real> p; return p;}#endif // #ifdef HAVE_LASPACK#endif // #ifndef __laspack_linear_solver_h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -