LibMesh::LinearSolver<T> & PetscLinearSolver<T> 类接口


   This class provides a uniform interface for linear solvers, this base class is overloaded to provide linear solvers from different packages like PETSc / LASPACK

   LinearSolver类继承关系:

   

   共有成员函数:

   LinearSovler(const libMesh::Communicator)

   virtual ~LinearSolver()

   clear(),

   init(),

   solver_type() 

   set_solver_type(), 


   Preconditioner_type(),

  set_preconditioner_type(), 

  attach_preconditioner(), 

  1 {

  2         if(this->_is_initialized)

  3                 libmesh_error_msg("Preconditioner must be attached before the s    olver is initialized");

  4         

  5         _preconditioner_type = SHELL_PRECOND;

  6         _preconditioner = preconditioner //function input;

  7


  virtual solver() 重载方法,一般给矩阵a,rhs列向量,求解列向量,pc矩阵可以给也可以有矩阵a计算。

  static AutoPtr<LinearSolver<T> > build(), build a LinearSolver using linear solver package specified by solver_package

  9 {

 10         switch (solver_package)

 11         {

 12 #ifdef LIBMESH_HAVE_LASPACK

 13                 case LASPACK_SOLVERS:

 14                         {

 15                                 AutoPtr<LinearSolver<T> > ap(new LaspackLinearSolver<T>(comm) );

 16                                 return ap;

 17                         }

 18 #endif

 19 

 20 #ifdef LIBMESH_HAVE_PETSC

 21                 case PETSC_SOLVERS:

 22                         {

 23                                 AutoPtr<LinearSolver<T> > ap(new PetscLinearSolver<T>(comm) );

 24                                 return ap;

 25                         }

 26 #endif

 27 

 28 #ifdef LIBMESH_HAVE_TRILINOS

 29                 case TRILINOS_SOLVERS:

 30                         {

 31                                 AutoPtr<LinearSolver<T> > ap(new AztecLinearSolver<T>(comm) );

 32                                 return ap;

 33                         }

 34 #endif

 35 

 36 #ifdef LIBMESH_HAVE_EIGEN

 37                 case EIGEN_SOLVERS:

 38                         {

 39                                 AutoPtr<LinearSolver<T> > ap(new EigenSparseLinearSolver<T>(comm) );

 40                                 return ap;

 41                         }

 42 #endif

 43                 default:

 44                         libmesh_error_msg("ERROR:Unrecognized solver package:" << solver_package);

 45         }

 46         AutoPtr<LinearSolver<T> > ap(NULL);

 47         return ap;

 48 }



  PetscLinearSolver 重载 除构造/析构函数以外的 linear solver方法, 另外还有方法:

    

     pc(),

     ksp(), return PETSc ksp context pointer

     get_residual_history()

     get_initial_residual()

     set_preconditioner_type(),

     






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值