00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MULTI_LINEAR_EXPRESSION_HPP
00021 #define MULTI_LINEAR_EXPRESSION_HPP
00022
00023 #include <Expression.hpp>
00024 #include <LinearExpression.hpp>
00025
00026 #include <VariationalOperator.hpp>
00027
00028 #include <list>
00029
00030 class MultiLinearExpression
00031 : public Expression
00032 {
00033 public:
00034 enum LinearFormType {
00035 linear,
00036 biLinear
00037 };
00038
00039 enum OperatorType {
00040 gradUgradV,
00041 dxUdxV,
00042 dxUV,
00043 UdxV,
00044 UV,
00045 gradV,
00046 gradFgradV,
00047 dxV,
00048 V,
00049 dxFV,
00050 undefined
00051 };
00052
00053 typedef std::list<ReferenceCounting<LinearExpression> > LinearListType;
00054 typedef std::list<ReferenceCounting<FunctionExpression> > FunctionListType;
00055 typedef std::list<ReferenceCounting<RealExpression> > RealListType;
00056
00057 private:
00058 LinearListType __linearList;
00059 FunctionListType __functionList;
00060 RealListType __realList;
00061
00062 std::ostream& put(std::ostream& os) const;
00063
00064 public:
00065
00066 ReferenceCounting<FunctionExpression>
00067 getFunction();
00068
00069 const std::string& getUnknownName() const;
00070
00071 const std::string& getTestFunctionName() const;
00072
00073 IntegratedOperatorExpression::OperatorType
00074 getUnknownOperator() const;
00075
00076 IntegratedOperatorExpression::OperatorType
00077 getTestFunctionOperator() const;
00078
00079 IntegratedOperatorExpression::OperatorType
00080 getFunctionOperator() const;
00081
00082 VariationalOperator::Property
00083 getUnknownProperty() const;
00084
00085 VariationalOperator::Property
00086 getTestFunctionProperty() const;
00087
00088 ReferenceCounting<FunctionExpression> getFunctionExpression() const;
00089
00090 LinearListType::iterator beginLinear()
00091 {
00092 return __linearList.begin();
00093 }
00094
00095 LinearListType::iterator endLinear()
00096 {
00097 return __linearList.end();
00098 }
00099
00100 FunctionListType::iterator beginFunction()
00101 {
00102 return __functionList.begin();
00103 }
00104
00105 FunctionListType::iterator endFunction()
00106 {
00107 return __functionList.end();
00108 }
00109
00110 RealListType::iterator beginReal()
00111 {
00112 return __realList.begin();
00113 }
00114
00115 RealListType::iterator endReal()
00116 {
00117 return __realList.end();
00118 }
00119
00120 OperatorType operatorType() const;
00121
00122 LinearFormType linearFormType() const;
00123
00124 void check();
00125
00126 void execute()
00127 {
00128 for (LinearListType::iterator i = __linearList.begin();
00129 i != __linearList.end(); ++i) {
00130 (*(*i)).execute();
00131 }
00132
00133 for (FunctionListType::iterator i = __functionList.begin();
00134 i != __functionList.end(); ++i) {
00135 (*(*i)).execute();
00136 }
00137
00138 for (RealListType::iterator i = __realList.begin();
00139 i != __realList.end(); ++i) {
00140 (*(*i)).execute();
00141 }
00142 }
00143
00144 void times(ReferenceCounting<LinearExpression> LF)
00145 {
00146 __linearList.push_back(LF);
00147 }
00148
00149 void times(ReferenceCounting<FunctionExpression> f)
00150 {
00151 __functionList.push_back(f);
00152 }
00153
00154 void times(ReferenceCounting<RealExpression> r)
00155 {
00156 __realList.push_back(r);
00157 }
00158
00159 MultiLinearExpression(ReferenceCounting<LinearExpression> LF)
00160 : Expression(Expression::multiLinearExp)
00161 {
00162 __linearList.push_back(LF);
00163 }
00164
00165 MultiLinearExpression(const MultiLinearExpression& MLF)
00166 : Expression(MLF),
00167 __linearList(MLF.__linearList),
00168 __functionList(MLF.__functionList),
00169 __realList(MLF.__realList)
00170 {
00171 ;
00172 }
00173
00174 virtual ~MultiLinearExpression()
00175 {
00176 ;
00177 }
00178 };
00179
00180 #endif // MULTI_LINEAR_EXPRESSION_HPP
00181