SimpleNewtonNonlinearSolver.hpp
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 #ifndef SIMPLENEWTONNONLINEARSOLVER_HPP_
00030 #define SIMPLENEWTONNONLINEARSOLVER_HPP_
00031
00032 #include "LinearSystem.hpp"
00033 #include "AbstractNonlinearSolver.hpp"
00034 #include <vector>
00035
00039 class SimpleNewtonNonlinearSolver : public AbstractNonlinearSolver
00040 {
00041 private:
00042
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
00110 virtual Vec Solve(PetscErrorCode (*pComputeResidual)(SNES,Vec,Vec,void*),
00111 PetscErrorCode (*pComputeJacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,void*),
00112 Vec initialGuess,
00113 unsigned fill,
00114 void* pContext);
00115
00121 void SetTolerance(double tolerance);
00122
00128 void SetWriteStats(bool writeStats = true)
00129 {
00130 mWriteStats = writeStats;
00131 }
00132 };
00133
00134 #endif