00001 #ifndef WEAKFORM_H
00002 #define WEAKFORM_H
00003
00004 #include "SundanceDefs.h"
00005
00006 #include "Expr.h"
00007 #include "BasisFamily.h"
00008 #include "QuadratureFamily.h"
00009 #include "MultiIndex.h"
00010 #include "XMLObject.h"
00011
00012
00013 namespace Sundance
00014 {
00015
00016 using namespace TSF;
00017 using std::string;
00018
00019 using std::ostream;
00020
00021 class EquationSet;
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 class WeakForm
00052 {
00053 public:
00054
00055 WeakForm();
00056
00057
00058 WeakForm(EquationSet* eqnSet, int blockRow, int blockCol,
00059 const Expr& coeff,
00060 const Expr& var, const Expr& unk,
00061 const QuadratureFamily& quad, bool isBC);
00062
00063 WeakForm(EquationSet* eqnSet, int blockRow,
00064 const Expr& coeff, const Expr& var,
00065 const QuadratureFamily& quad, bool isBC);
00066
00067
00068 const QuadratureFamily& quad() const {return quad_;}
00069
00070
00071
00072 const Expr& coeff() const {return coeff_;}
00073
00074
00075
00076 const BasisFamily& test() const {return test_;}
00077
00078
00079
00080 const BasisFamily& unk() const {return unk_;}
00081
00082
00083
00084 const MultiIndex& miTest() const {return miTest_;}
00085
00086
00087
00088 const MultiIndex& miUnk() const {return miUnk_;}
00089
00090
00091
00092 bool usesBlock(int blockRow, int blockCol) const ;
00093
00094
00095
00096 bool usesBlock(int blockRow) const ;
00097
00098
00099 const TSFArray<int>& testIDList(int blockRow,
00100 int blockCol) const ;
00101
00102
00103 const TSFArray<int>& unkIDList(int blockRow,
00104 int blockCol) const ;
00105
00106
00107
00108 const TSFArray<int>& testIDList(int blockRow) const ;
00109
00110
00111
00112 const TSFArray<double>& termCoeff(int blockRow, int blockCol) const ;
00113
00114
00115
00116 const TSFArray<double>& termCoeff(int blockCol) const ;
00117
00118
00119 const TSFArray<bool>& isTransposed(int blockRow, int blockCol) const ;
00120
00121
00122 const TSFArray<bool>& isEssentialBC(int blockRow) const ;
00123
00124
00125 const TSFArray<bool>& isEssentialBC(int blockRow, int blockCol ) const ;
00126
00127
00128 bool isOneForm() const {return isOneForm_;}
00129
00130
00131
00132 bool isSymmetric() const {return isSymmetric_;}
00133
00134
00135
00136 bool tryAppend(int blockRow, int blockCol,
00137 const Expr& coeff, const Expr& var,
00138 const Expr& unk, bool isBC);
00139
00140
00141
00142 bool tryAppend(int blockRow, const Expr& coeff, const Expr& var,
00143 bool isBC);
00144
00145
00146 XMLObject toXML() const ;
00147
00148 private:
00149
00150 void init(int blockRow, int blockCol,
00151 const Expr& var, const Expr& unk, bool isBC);
00152
00153
00154
00155 EquationSet* eqnSet_;
00156
00157
00158
00159
00160 QuadratureFamily quad_;
00161 Expr coeff_;
00162 BasisFamily test_;
00163 BasisFamily unk_;
00164 MultiIndex miTest_;
00165 MultiIndex miUnk_;
00166 bool isOneForm_;
00167 bool isSymmetric_;
00168
00169
00170
00171
00172 TSFArray<TSFArray<TSFArray<double> > > termCoeffs_;
00173 TSFArray<TSFArray<TSFArray<int> > > testID_;
00174 TSFArray<TSFArray<TSFArray<int> > > unkID_;
00175 TSFArray<TSFArray<TSFArray<bool> > > isTransposed_;
00176 TSFArray<TSFArray<TSFArray<bool> > > isEssentialBC_;
00177
00178
00179
00180
00181 TSFArray<TSFArray<bool> > isNonzero_;
00182
00183 };
00184
00185
00186 inline ostream& operator<<(ostream& os, const WeakForm& wf)
00187 {
00188 return os << wf.toXML();
00189 }
00190
00191
00192 }
00193 #endif
00194
00195