00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef SIMPLENEWTONNONLINEARSOLVER_HPP_
00031 #define SIMPLENEWTONNONLINEARSOLVER_HPP_
00032
00033 #include "LinearSystem.hpp"
00034 #include "AbstractNonlinearSolver.hpp"
00035 #include <vector>
00036
00040 class SimpleNewtonNonlinearSolver : public AbstractNonlinearSolver
00041 {
00042 private :
00043 double mLinearSolverRelativeTolerance;
00044 double mTolerance;
00045 bool mWriteStats;
00047 std::vector<double> mTestDampingValues;
00049 public :
00050
00056 SimpleNewtonNonlinearSolver(double linearSolverRelativeTolerance = 1e-6);
00057
00061 virtual ~SimpleNewtonNonlinearSolver();
00062
00108 virtual Vec Solve(PetscErrorCode (*pComputeResidual)(SNES,Vec,Vec,void*),
00109 PetscErrorCode (*pComputeJacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),
00110 Vec initialGuess,
00111 void *pContext);
00112
00118 void SetTolerance(double tolerance);
00119
00125 void SetWriteStats(bool writeStats = true)
00126 {
00127 mWriteStats = writeStats;
00128 }
00129 };
00130
00131 #endif