$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_TRILINOS_NOX_NONLINEAR_SOLVER_H 00021 #define LIBMESH_TRILINOS_NOX_NONLINEAR_SOLVER_H 00022 00023 #ifdef LIBMESH_HAVE_NOX 00024 00025 // Local includes 00026 #include "libmesh/nonlinear_solver.h" 00027 00028 //trilinos includes 00029 #include "Epetra_Vector.h" 00030 #include "Epetra_Operator.h" 00031 #include "Epetra_RowMatrix.h" 00032 #include "NOX_Epetra_Interface_Required.H" // base class 00033 #include "NOX_Epetra_Interface_Jacobian.H" // base class 00034 #include "NOX_Epetra_Interface_Preconditioner.H" // base class 00035 #include "NOX.H" 00036 00037 // C++ includes 00038 #include <cstddef> 00039 00040 namespace libMesh 00041 { 00042 00043 // Forward declarations 00044 class Problem_Interface; 00045 00046 00055 template <typename T> 00056 class NoxNonlinearSolver : public NonlinearSolver<T> 00057 { 00058 public: 00062 typedef NonlinearImplicitSystem sys_type; 00063 00067 explicit 00068 NoxNonlinearSolver (sys_type& system); 00069 00073 virtual ~NoxNonlinearSolver (); 00074 00078 virtual void clear (); 00079 00083 virtual void init (const char* name = NULL); 00084 00089 virtual std::pair<unsigned int, Real> solve (SparseMatrix<T> &, // System Jacobian Matrix 00090 NumericVector<T> &, // Solution vector 00091 NumericVector<T> &, // Residual vector 00092 const double, // Stopping tolerance 00093 const unsigned int); // N. Iterations 00097 virtual int get_total_linear_iterations(); 00098 00104 virtual unsigned get_current_nonlinear_iteration_number() const { libmesh_not_implemented(); return 0; } 00105 00106 private: 00107 00111 NOX::Solver::Generic * _solver; 00112 00116 Problem_Interface * _interface; 00117 00121 int _n_linear_iterations; 00122 }; 00123 00124 00125 /*----------------------- functions ----------------------------------*/ 00126 template <typename T> 00127 inline 00128 NoxNonlinearSolver<T>::NoxNonlinearSolver (sys_type& system) : 00129 NonlinearSolver<T>(system), 00130 _solver(NULL), 00131 _interface(NULL), 00132 _n_linear_iterations(0) 00133 { 00134 } 00135 00136 00137 00138 template <typename T> 00139 inline 00140 NoxNonlinearSolver<T>::~NoxNonlinearSolver () 00141 { 00142 this->clear (); 00143 } 00144 00145 00146 } // namespace libMesh 00147 00148 00149 #endif // #ifdef LIBMESH_HAVE_NOX 00150 #endif // LIBMESH_TRILINOS_NOX_NONLINEAR_SOLVER_H