Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

StaticLinearProblem.h

Go to the documentation of this file.
00001 #ifndef STATICLINEARPROBLEM_H
00002 #define STATICLINEARPROBLEM_H
00003 
00004 #include "SundanceDefs.h"
00005 #include "DistributedMatrixBuilder.h"
00006 #include "TSFMatrixOperator.h"
00007 #include "TSFMultiVectorOperator.h"
00008 #include "TSFLinearProblemBase.h"
00009 #include "TSFLinearSolver.h"
00010 #include "TSFSmartPtr.h"
00011 #include "Block.h"
00012 #include "DirectSolver.h"
00013 #include "Defaults.h"
00014 #include "TSFTimeMonitor.h"
00015 
00016 
00017 namespace Sundance
00018 {
00019 
00020   using namespace TSF;
00021   using std::string;
00022 
00023   using std::ostream;
00024 
00025   /** \ingroup UserLevelFE
00026    * StaticLinearProblem combines a mesh and a variational expression
00027    * into an object that can build a matrix.
00028    */
00029 
00030   class StaticLinearProblem : public TSFLinearProblemBase
00031     {
00032     public:
00033       /** */
00034       StaticLinearProblem();
00035       /** */
00036       StaticLinearProblem(const Mesh& mesh,
00037                           const Expr& integral,
00038                           const EssentialBC& bc,
00039                           const Expr& var,
00040                           const Expr& unk,
00041                           const TSFVectorType& vt = Defaults::vectorType());
00042       /** */
00043       StaticLinearProblem(const Mesh& mesh,
00044                           const Expr& integral,
00045                           const Expr& var,
00046                           const Expr& unk,
00047                           const TSFVectorType& vt = Defaults::vectorType());
00048 
00049       /** */
00050       StaticLinearProblem(const Mesh& mesh,
00051                           const Expr& integral,
00052                           const Expr& var,
00053                           const TSFVectorType& vt = Defaults::vectorType());
00054 
00055       /** */
00056       StaticLinearProblem(const Mesh& mesh,
00057                           const Expr& integral,
00058                           const TSFArray<Block>& varBlocks,
00059                           const TSFArray<Block>& unkBlocks);
00060       /** */
00061       StaticLinearProblem(const Mesh& mesh,
00062                           const Expr& integral,
00063                           const TSFArray<Block>& varBlocks);
00064 
00065       /** */
00066       StaticLinearProblem(const Mesh& mesh,
00067                           const Expr& integral,
00068                           const EssentialBC& bc,
00069                           const TSFArray<Block>& varBlocks,
00070                           const TSFArray<Block>& unkBlocks);
00071       /** */
00072       virtual ~StaticLinearProblem(){;}
00073 
00074       /** */
00075       Expr formSolnExpr(const TSFVector& x) const ;
00076 
00077       /** */
00078       Expr formSolnExpr(const TSFArray<TSFVector>& x) const ;
00079 
00080       /** */
00081       virtual TSFVector getRHS() const ;
00082 
00083       /** */
00084       //      virtual void fillRHS(TSFVector& rhs) const ;
00085 
00086       /** */
00087       virtual TSFVector getRHS(const TSFVectorSpace& space) const ;
00088 
00089       /** */
00090       virtual TSFLinearOperator getOperator() const ;
00091 
00092       /** */
00093       Expr solve(const TSFLinearSolver& solver = new DirectSolver()) const ;
00094 
00095       /** */
00096       Expr getRHSExpr() const ;
00097 
00098       /** */
00099       void flushMatrixValues() {matrixNeedsBuilding_=true; vectorNeedsBuilding_=true;}
00100       void flushVectorValues() {vectorNeedsBuilding_=true;}
00101       void flushMatrixConfiguration() {builder_->flushConfiguration();}
00102 
00103       /** */
00104       void printRowMaps() const {builder_->printRowMaps();}
00105 
00106       /** */
00107       void printColumnMaps() const {builder_->printColumnMaps();}
00108 
00109       /** */
00110       void showGraph(ostream& os) const {builder_->showGraph(os);}
00111 
00112       /** */
00113       void showBCRows(ostream& os) const {builder_->showBCRows(os);}
00114 
00115       /** */
00116       int numBlocks() const {return vectorBlocks_.length();}
00117 
00118       /** */
00119       void printEqns(ostream& os) const ;
00120 
00121       /** */
00122       void printDiscreteFunctions(ostream& os) const ;
00123 
00124     private:
00125       /** initialization steps common to all ctors */
00126       void init(const Mesh& mesh,
00127                 const Expr& integral,
00128                 const EssentialBC& bc,
00129                 const TSFArray<Block>& varBlocks,
00130                 const TSFArray<Block>& unkBlocks);
00131 
00132       Expr integral_;
00133       EssentialBC bc_;
00134 
00135       TSFSmartPtr<DistributedMatrixBuilder> builder_;
00136 
00137       mutable TSFLinearOperator op_;
00138 
00139       mutable TSFVector rhs_;
00140 
00141       mutable TSFArray<TSFArray<TSFMatrixOperator*> > matrixBlocks_;
00142 
00143       mutable TSFArray<TSFArray<TSFMultiVectorOperator*> > multiVectorBlocks_;
00144 
00145       mutable TSFArray<TSFVector> vectorBlocks_;
00146 
00147       mutable bool matrixNeedsBuilding_;
00148 
00149       mutable bool vectorNeedsBuilding_;
00150 
00151       mutable bool graphNeedsBuilding_;
00152 
00153       static TSFTimer& solveTimer();
00154 
00155       static TSFTimer& initTimer();
00156 
00157       static TSFTimer& rhsTimer();
00158 
00159       static TSFTimer& opTimer();
00160     };
00161 
00162 
00163 
00164 
00165 
00166 }
00167 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by