$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_SOLVER_H 00021 #define LIBMESH_SOLVER_H 00022 00023 // Local includes 00024 #include "libmesh/libmesh_common.h" 00025 #include "libmesh/reference_counted_object.h" 00026 #include "libmesh/equation_systems.h" 00027 00028 // C++ includes 00029 00030 namespace libMesh 00031 { 00032 00033 // Forward Declarations 00034 class MeshBase; 00035 class Solver; 00036 00045 // ------------------------------------------------------------ 00046 // Solver class definition 00047 class Solver : public ReferenceCountedObject<Solver> 00048 { 00049 protected: 00050 00056 explicit 00057 Solver (EquationSystems& es); 00058 00063 Solver (EquationSystems& es, 00064 const std::string& name, 00065 const unsigned int number); 00066 00067 00068 public: 00069 00073 ~Solver (); 00074 00078 typedef EquationSystems sys_type; 00079 00084 virtual void init (); 00085 00090 virtual void pre_process (); 00091 00097 virtual void solve (); 00098 00103 virtual void post_process (); 00104 00108 const sys_type & system () const { return _system; } 00109 00113 const MeshBase & mesh () const { return _mesh; } 00114 00115 00116 protected: 00117 00121 sys_type & system () { return _system; } 00122 00126 MeshBase & mesh () { return _mesh; } 00127 00131 sys_type& _system; 00132 00137 MeshBase& _mesh; 00138 }; 00139 00140 00141 00142 // ------------------------------------------------------------ 00143 // Solver inline members 00144 inline 00145 Solver::Solver (EquationSystems& es) : 00146 _system (es), 00147 _mesh (es.get_mesh()) 00148 { 00149 libmesh_deprecated(); 00150 } 00151 00152 00153 00154 inline 00155 Solver::~Solver () 00156 { 00157 } 00158 00159 00160 00161 inline 00162 void Solver::init () 00163 { 00164 // Initialize the system. 00165 this->system().init (); 00166 } 00167 00168 00169 00170 inline 00171 void Solver::pre_process () 00172 { 00173 // libMesh::out << "Pre-processing" 00174 // << std::endl; 00175 } 00176 00177 00178 00179 inline 00180 void Solver::solve () 00181 { 00182 // Perform any necessary pre-processing 00183 Solver::pre_process (); 00184 00185 // Solve the system 00186 this->system().solve (); 00187 00188 // Perform any necessary post-processing 00189 Solver::post_process (); 00190 } 00191 00192 00193 00194 inline 00195 void Solver::post_process () 00196 { 00197 // libMesh::out << "Post-processing" 00198 // << std::endl; 00199 } 00200 00201 } // namespace libMesh 00202 00203 00204 #endif // LIBMESH_SOLVER_H