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 
00031 #ifndef SUNDANCE_NONLINEARPROBLEM_H
00032 #define SUNDANCE_NONLINEARPROBLEM_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceNLOp.hpp"
00036 #include "PlayaNOXSolver.hpp"
00037 #include "PlayaNonlinearSolver.hpp"
00038 #include "PlayaNewtonArmijoSolverDecl.hpp"
00039 #ifndef HAVE_TEUCHOS_EXPLICIT_INSTANTIATION
00040 #include "PlayaNewtonArmijoSolverImpl.hpp"
00041 #endif
00042 
00043 namespace Sundance
00044 {
00045 using namespace Teuchos;
00046 
00047 
00048 
00049 
00050 
00051 class NonlinearProblem 
00052   : public ObjectWithClassVerbosity<NonlinearProblem>
00053 {
00054 public:
00055 
00056   NonlinearProblem();
00057 
00058 
00059 
00060   NonlinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00061     const Expr& test, const Expr& unk, const Expr& u0, 
00062     const Playa::VectorType<double>& vecType);
00063 
00064 
00065 
00066   NonlinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00067     const Expr& test, const Expr& unk, const Expr& u0, 
00068     const Expr& params, const Expr& paramVals,  
00069     const Playa::VectorType<double>& vecType);
00070 
00071 
00072 
00073   NonlinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00074     const BlockArray& test, const BlockArray& unk, const Expr& u0);
00075 
00076 
00077 
00078   NonlinearProblem(const RCP<Assembler>& assembler, 
00079     const Expr& u0);
00080 
00081 
00082   Expr computeSensitivities(const LinearSolver<double>& solver) const 
00083     {return op_->computeSensitivities(solver);}
00084 
00085 
00086   SolverState<double> solve(const NOXSolver& solver) const ;
00087 
00088 
00089   SolverState<double> solve(const NonlinearSolver<double>& solver) const ;
00090 
00091 
00092   Expr getU0() const {return op_->getU0();}
00093 
00094 
00095   void setInitialGuess(const Expr& u0New) {op_->setInitialGuess(u0New);}
00096 
00097 
00098   void setEvalPoint(const Expr& u0New) {op_->setInitialGuess(u0New);}
00099       
00100 
00101 
00102   LinearOperator<double> computeJacobianAndFunction(Vector<double>& functionValue) const 
00103     {return op_->computeJacobianAndFunction(functionValue);}
00104       
00105 
00106   void computeJacobianAndFunction(LinearOperator<double>& J,
00107     Vector<double>& resid) const 
00108     {op_->computeJacobianAndFunction(J, resid);}
00109 
00110 
00111   Playa::Vector<double> computeFunctionValue() const 
00112     {return op_->computeFunctionValue();}
00113       
00114 
00115   void computeFunctionValue(Vector<double>& resid) const 
00116     {op_->computeFunctionValue(resid);}
00117       
00118 
00119   Playa::Vector<double> getInitialGuess() const 
00120     {return op_->getInitialGuess();}
00121       
00122 
00123   LinearOperator<double> allocateJacobian() const 
00124     {return op_->allocateJacobian();}
00125 
00126 
00127   void reAssembleProblem() const { op_->reAssembleProblem();}
00128 
00129 private:
00130   RCP<NLOp> op_;
00131 };
00132 }
00133 
00134 
00135 
00136 
00137 #endif