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_LINEARPROBLEM_H
00032 #define SUNDANCE_LINEARPROBLEM_H
00033
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceLinearSolveDriver.hpp"
00036 #include "SundanceObjectWithVerbosity.hpp"
00037
00038 namespace Sundance
00039 {
00040 using namespace Teuchos;
00041
00042 class Assembler;
00043
00044
00045
00046
00047
00048 class LinearProblem
00049 {
00050 public:
00051
00052 LinearProblem();
00053
00054
00055
00056 LinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00057 const Expr& test, const Expr& unk,
00058 const Playa::VectorType<double>& vecType
00059 );
00060
00061
00062 LinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00063 const BlockArray& test, const BlockArray& unk);
00064
00065
00066
00067 LinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00068 const Expr& test, const Expr& unk,
00069 const Expr& unkParams, const Expr& unkParamVals,
00070 const Playa::VectorType<double>& vecType);
00071
00072
00073
00074 LinearProblem(const Mesh& mesh, const Expr& eqn, const Expr& bc,
00075 const BlockArray& test, const BlockArray& unk,
00076 const Expr& unkParams, const Expr& unkParamVals);
00077
00078
00079 LinearProblem(const RCP<Assembler>& assembler);
00080
00081
00082 Expr solve(const LinearSolver<double>& solver) const ;
00083
00084
00085 SolverState<double> solve(const LinearSolver<double>& solver,
00086 Expr& soln) const ;
00087
00088
00089
00090 Array<Vector<double> > getRHS() const ;
00091
00092
00093 Vector<double> getSingleRHS() const {return getRHS()[0];}
00094
00095
00096 LinearOperator<double> getOperator() const ;
00097
00098
00099 const RCP<DOFMapBase>& rowMap(int blockRow) const ;
00100
00101
00102 const RCP<DOFMapBase>& colMap(int blockCol) const ;
00103
00104
00105 const Array<RCP<DiscreteSpace> >& solnSpace() const ;
00106
00107
00108
00109
00110 const RCP<Set<int> >& bcRows(int blockRow) const ;
00111
00112
00113 int numBlockRows() const ;
00114
00115
00116 int numBlockCols() const ;
00117
00118
00119 void reAssembleProblem() const ;
00120
00121
00122 Expr formSolutionExpr(const Array<Vector<double> >& vec) const ;
00123
00124
00125 static bool& solveFailureIsFatal()
00126 {return LinearSolveDriver::solveFailureIsFatal();}
00127
00128
00129
00130
00131 static bool& dumpBadMatrix()
00132 {return LinearSolveDriver::dumpBadMatrix();}
00133
00134
00135 static std::string& badMatrixFilename()
00136 {return LinearSolveDriver::badMatrixFilename();}
00137
00138
00139 static std::string& badVectorFilename()
00140 {return LinearSolveDriver::badVectorFilename();}
00141
00142
00143
00144 private:
00145
00146
00147
00148 RCP<Assembler> assembler_;
00149
00150
00151 mutable LinearOperator<double> A_;
00152
00153
00154 mutable Array<Vector<double> > rhs_;
00155
00156
00157 Array<Array<string> > names_;
00158
00159
00160 LinearSolveDriver solveDriver_;
00161
00162
00163 Expr params_;
00164
00165 };
00166
00167 }
00168
00169
00170 #endif