Go to the documentation of this file.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_NLOP_H
00032 #define SUNDANCE_NLOP_H
00033
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMesh.hpp"
00036 #include "SundanceExpr.hpp"
00037 #include "SundanceDiscreteFunction.hpp"
00038 #include "SundanceObjectWithVerbosity.hpp"
00039 #include "TSFNonlinearOperatorBase.hpp"
00040 #include "TSFLinearOperatorDecl.hpp"
00041 #include "TSFVectorDecl.hpp"
00042 #include "TSFVectorType.hpp"
00043
00044 namespace Sundance
00045 {
00046 using namespace Teuchos;
00047
00048 class Assembler;
00049
00050
00051
00052
00053
00054
00055 class NLOp
00056 : public ObjectWithClassVerbosity<NLOp>,
00057 public TSFExtended::NonlinearOperatorBase<double>
00058 {
00059 public:
00060
00061 NLOp();
00062
00063
00064
00065 NLOp(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00066 const Expr& test, const Expr& unk, const Expr& u0,
00067 const TSFExtended::VectorType<double>& vecType,
00068 bool partitionBCs = false);
00069
00070
00071
00072 NLOp(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00073 const Expr& test, const Expr& unk, const Expr& u0,
00074 const Expr& params, const Expr& paramVals,
00075 const TSFExtended::VectorType<double>& vecType,
00076 bool partitionBCs = false);
00077
00078
00079
00080 NLOp(const RCP<Assembler>& assembler,
00081 const Expr& u0);
00082
00083
00084 LinearOperator<double> computeJacobianAndFunction(Vector<double>& functionValue) const ;
00085
00086
00087 void computeJacobianAndFunction(LinearOperator<double>& J,
00088 Vector<double>& resid) const ;
00089
00090
00091 Expr computeSensitivities(const LinearSolver<double>& solver) const ;
00092
00093
00094
00095 Expr getU0() const {return u0_;}
00096
00097
00098 TSFExtended::Vector<double> computeFunctionValue() const ;
00099
00100
00101 void computeFunctionValue(Vector<double>& resid) const ;
00102
00103
00104 TSFExtended::Vector<double> getInitialGuess() const ;
00105
00106
00107 LinearOperator<double> allocateJacobian() const ;
00108
00109
00110 void setInitialGuess(const Expr& u0New);
00111
00112
00113
00114 GET_RCP(TSFExtended::NonlinearOperatorBase<double>);
00115
00116 private:
00117
00118
00119 RCP<Assembler> assembler_;
00120
00121
00122 mutable TSFExtended::LinearOperator<double> J_;
00123
00124
00125 Expr u0_;
00126
00127
00128 Expr params_;
00129
00130
00131 Expr paramVals_;
00132
00133
00134 mutable DiscreteFunction* discreteU0_;
00135
00136 };
00137 }
00138
00139
00140
00141
00142 #endif