00001 #ifndef FEDISCRETIZER_H
00002 #define FEDISCRETIZER_H
00003
00004 #include "SundanceDefs.h"
00005
00006 #include "WeakForm.h"
00007 #include "TSFRBTree.h"
00008 #include "DistributedDOFMap.h"
00009 #include "TSFSmartPtr.h"
00010 #include "Element.h"
00011 #include "CellType.h"
00012 #include "Mesh.h"
00013 #include "OldIntegral.h"
00014 #include "EssentialBC.h"
00015 #include "EquationSet.h"
00016 #include "TSFVector.h"
00017 #include "TSFMatrixOperator.h"
00018 #include "TSFHashtable.h"
00019
00020
00021 namespace Sundance
00022 {
00023
00024 using namespace TSF;
00025 using std::string;
00026
00027 using std::ostream;
00028
00029
00030
00031
00032
00033 class FEDiscretizer
00034 {
00035 public:
00036
00037 FEDiscretizer(const Mesh& mesh, const OldIntegral& eqn,
00038 const Expr& test, const Expr& shape);
00039
00040 FEDiscretizer(const Mesh& mesh, const OldIntegral& eqn,
00041 const EssentialBC& bc,
00042 const Expr& test, const Expr& shape);
00043
00044
00045 void buildMatrix(MatrixBase& mat) const ;
00046
00047 void buildVector(DistributedVector& vec) const ;
00048
00049
00050 const TSFSmartPtr<DOFMapBase>& shapeDOFMap() const {return shapeDOFMap_;}
00051
00052
00053 bool lookupReducedShapeID(int shapeID, int& reducedShapeID) const ;
00054
00055
00056 void buildSoln(const TSFVector& solnVec,
00057 Expr& soln) const ;
00058
00059
00060 void print(ostream& os) const ;
00061
00062
00063 static void silent() {monitorLocalMatrices_ = false;}
00064
00065 static void verbose() {monitorLocalMatrices_ = true;}
00066
00067 private:
00068
00069 void getGraph(TSFArray<TSFNonDupArray<int> >& columnIndices) const ;
00070
00071 bool isUpdateRow(int globalRowIndex) const ;
00072 bool isBCRow(int globalRowIndex) const ;
00073 void setBCRow(int globalRowIndex) ;
00074
00075 int getLocalRowIndex(int globalRowIndex) const ;
00076
00077 void init(const Mesh& mesh, const EquationSet& eqn,
00078 const Expr& test, const Expr& shape);
00079
00080 void insertLocalMatrix(int cellDim,
00081 int cellIndex,
00082 const WeakForm& wf,
00083 const LocalMatrix& localMat,
00084 MatrixBase& mat) const ;
00085 void insertLocalVector(int cellDim,
00086 int cellIndex,
00087 const WeakForm& wf,
00088 const DenseSerialVector& localVec,
00089 DistributedVector& vec) const ;
00090
00091 TSFArray<CellSet> cellSets_;
00092 TSFArray<TSFArray<WeakForm> > wf_;
00093 TSFRBTree<int, int> testIDMap_;
00094 TSFRBTree<int, int> shapeIDMap_;
00095 TSFSmartPtr<DOFMapBase> testDOFMap_;
00096 TSFSmartPtr<DOFMapBase> shapeDOFMap_;
00097 TSFSmartPtr<TSFArray<int> > updateList_;
00098 TSFSmartPtr<TSFArray<int> > remoteDOFList_;
00099 int lowestLocalDOF_;
00100 int highestLocalDOF_;
00101
00102
00103
00104 TSFArray<bool> localBCRowTable_;
00105 TSFHashtable<int, Bool> remoteBCRowTable_;
00106
00107 TSFArray<TSFArray<TSFRBTree<CellTopologyCode, Element> > > referenceElements_;
00108 TSFArray<TSFArray<Cell> > cells_;
00109 TSFArray<TSFNonDupArray<CellTopologyCode> > cellTypes_;
00110 Expr var_;
00111 Expr unk_;
00112
00113
00114 static bool monitorLocalMatrices_;
00115
00116 };
00117
00118 }
00119 #endif
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135