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_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 TSFExtended::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 TSFExtended::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 Array<Vector<double> > getRHS() const ;
00090
00091
00092 Vector<double> getSingleRHS() const {return getRHS()[0];}
00093
00094
00095 LinearOperator<double> getOperator() const ;
00096
00097
00098 const RCP<DOFMapBase>& rowMap(int blockRow) const ;
00099
00100
00101 const RCP<DOFMapBase>& colMap(int blockCol) const ;
00102
00103
00104 const Array<RCP<DiscreteSpace> >& solnSpace() const ;
00105
00106
00107
00108
00109 const RCP<Set<int> >& bcRows(int blockRow) const ;
00110
00111
00112 int numBlockRows() const ;
00113
00114
00115 int numBlockCols() const ;
00116
00117
00118
00119
00120 Vector<double>
00121 convertToMonolithicVector(const Array<Vector<double> >& internalBlock,
00122 const Array<Vector<double> >& bcBlock) const ;
00123
00124
00125 Expr formSolutionExpr(const Array<Vector<double> >& vec) const ;
00126
00127
00128 static bool& solveFailureIsFatal()
00129 {return LinearSolveDriver::solveFailureIsFatal();}
00130
00131
00132
00133
00134 static bool& dumpBadMatrix()
00135 {return LinearSolveDriver::dumpBadMatrix();}
00136
00137
00138 static std::string& badMatrixFilename()
00139 {return LinearSolveDriver::badMatrixFilename();}
00140
00141
00142 static std::string& badVectorFilename()
00143 {return LinearSolveDriver::badVectorFilename();}
00144
00145
00146
00147 private:
00148
00149
00150
00151 RCP<Assembler> assembler_;
00152
00153
00154 mutable LinearOperator<double> A_;
00155
00156
00157 mutable Array<Vector<double> > rhs_;
00158
00159
00160 Array<Array<string> > names_;
00161
00162
00163 LinearSolveDriver solveDriver_;
00164
00165 };
00166 }
00167
00168
00169 #endif