00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef EXPRESSION_HPP
00021 #define EXPRESSION_HPP
00022
00023 #include <Types.hpp>
00024 #include <ReferenceCounting.hpp>
00025 #include <StreamCenter.hpp>
00026
00027 #include <ErrorHandler.hpp>
00028
00039 class Expression
00040 {
00041 public:
00042 enum Type {
00043 boolean,
00044 boundary,
00045 boundaryCondition,
00046 boundaryConditionList,
00047
00048 domain,
00049
00050 field,
00051 fieldlist,
00052 function,
00053
00054 ifstreamexpression,
00055 integrated,
00056 integratedOperator,
00057 insideExpression,
00058 insideListExpression,
00059 istreamexpression,
00060 istreamExpressionList,
00061
00062 linearExp,
00063
00064 mesh,
00065 multiLinearExp,
00066 multiLinearExpSum,
00067 multiLinearForm,
00068 multiLinearFormSum,
00069
00070 ofstreamexpression,
00071 option,
00072 ostreamexpression,
00073 ostreamExpressionList,
00074
00075 pdeEquation,
00076 pdeOperator,
00077 pdeOperatorSum,
00078 pdeProblem,
00079 problem,
00080
00081 real,
00082
00083 scene,
00084 solver,
00085 solverOptions,
00086 string,
00087 subOption,
00088 subOptionList,
00089
00090 testFunctionList,
00091
00092 unknown,
00093 unknownList,
00094
00095 variationalFormula,
00096 variationalBilinearOperator,
00097 variationalLinearOperator,
00098 variationalDirichlet,
00099 vector3
00100 };
00101
00102 private:
00104 Expression::Type __type;
00105
00106 protected:
00111 static Expression::Type
00112 getType(ReferenceCounting<Expression> e1,
00113 ReferenceCounting<Expression> e2)
00114 {
00115 return Expression::real;
00116 }
00117
00119 virtual std::ostream& put(std::ostream& os) const = 0;
00120
00122 virtual std::istream& _get(std::istream& is)
00123 {
00124 throw ErrorHandler(__FILE__,__LINE__,
00125 "operator >> is not supported for this expression",
00126 ErrorHandler::normal);
00127 return is;
00128 }
00129
00130 public:
00132 const Expression::Type& type() const
00133 {
00134 return __type;
00135 }
00136
00140 virtual void execute() = 0;
00141
00143 friend std::ostream& operator << (std::ostream& os, const Expression& e)
00144 {
00145 return e.put(os);
00146 }
00147
00149 friend std::istream& operator >> (std::istream& is, Expression& e)
00150 {
00151 return e._get(is);
00152 }
00153
00154 Expression(const Expression::Type& t)
00155 : __type(t)
00156 {
00157 ;
00158 }
00159
00160 Expression(const Expression& e)
00161 : __type(e.__type)
00162 {
00163 ;
00164 }
00165
00166 virtual ~Expression()
00167 {
00168 ;
00169 }
00170 };
00171
00172 #endif // EXPRESSION_HPP