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