00001 #ifndef NEWTONLINEARIZATION_H 00002 #define NEWTONLINEARIZATION_H 00003 00004 #include "SundanceDefs.h" 00005 #include "StaticLinearProblem.h" 00006 #include "TSFNonlinearOperatorBase.h" 00007 #include "TSFNonlinearOperator.h" 00008 #include "NewtonSolver.h" 00009 00010 namespace Sundance 00011 { 00012 00013 using namespace TSF; 00014 using std::string; 00015 00016 using std::ostream; 00017 00018 /** \ingroup UserLevelFE 00019 */ 00020 00021 class NewtonLinearization : public TSFNonlinearOperatorBase 00022 { 00023 public: 00024 /** */ 00025 NewtonLinearization(); 00026 /** */ 00027 NewtonLinearization(const StaticLinearProblem& linearizedProblem, 00028 const Expr& guess, 00029 const TSFLinearSolver& solver); 00030 /** */ 00031 virtual ~NewtonLinearization(); 00032 00033 /** apply the operator to a vector. */ 00034 virtual void apply(const TSFVector& arg, TSFVector& out) const ; 00035 00036 /** get a linear operator representing the derivative at an eval point */ 00037 virtual TSFLinearOperator derivative(const TSFVector& evalPt) const ; 00038 00039 /** */ 00040 Expr solve(const NewtonSolver& solver) const ; 00041 00042 static int& verbose() {static int v=false; return v;} 00043 private: 00044 mutable StaticLinearProblem linearizedProblem_; 00045 00046 mutable Expr guess_; 00047 00048 TSFLinearSolver solver_; 00049 00050 int numBlocks_; 00051 00052 00053 }; 00054 00055 00056 } 00057 #endif