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