From 28a9a11878f34fc70b40a00b9824af6ee173066e Mon Sep 17 00:00:00 2001 From: sebastien Date: Fri, 6 Nov 2009 18:19:52 +0000 Subject: [PATCH] preprocessor: cosmetic changes git-svn-id: https://www.dynare.org/svn/dynare/trunk@3134 ac1d8469-bf42-47a9-8791-bf33cf982152 --- preprocessor/ExprNode.cc | 14 +++++++------- preprocessor/ExprNode.hh | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/preprocessor/ExprNode.cc b/preprocessor/ExprNode.cc index cb8ba7fb2..9e997ebf1 100644 --- a/preprocessor/ExprNode.cc +++ b/preprocessor/ExprNode.cc @@ -966,10 +966,10 @@ VariableNode::substituteExpectation(subst_table_t &subst_table, vector(this); } -UnaryOpNode::UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const NodeID arg_arg, const int arg_exp_info_set) : +UnaryOpNode::UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const NodeID arg_arg, const int expectation_information_set_arg) : ExprNode(datatree_arg), arg(arg_arg), - Expectation_information_set(arg_exp_info_set), + expectation_information_set(expectation_information_set_arg), op_code(op_code_arg) { // Add myself to the unary op map @@ -1593,7 +1593,7 @@ UnaryOpNode::buildSimilarUnaryOpNode(NodeID alt_arg, DataTree &alt_datatree) con case oSteadyState: return alt_datatree.AddSteadyState(alt_arg); case oExpectation: - return alt_datatree.AddExpectation(Expectation_information_set, alt_arg); + return alt_datatree.AddExpectation(expectation_information_set, alt_arg); } // Suppress GCC warning exit(EXIT_FAILURE); @@ -1687,11 +1687,11 @@ UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector(it->second); //Arriving here, we need to create an auxiliary variable for this Expectation Operator: - int symb_id = datatree.symbol_table.addExpectationAuxiliaryVar(Expectation_information_set, arg->idx); //AUXE_period_arg.idx + int symb_id = datatree.symbol_table.addExpectationAuxiliaryVar(expectation_information_set, arg->idx); //AUXE_period_arg.idx NodeID newAuxE = datatree.AddVariable(symb_id, 0); assert(dynamic_cast(newAuxE) != NULL); - if (partial_information_model && Expectation_information_set==0) + if (partial_information_model && expectation_information_set==0) { //Ensure x is a single variable as opposed to an expression if (dynamic_cast(arg) == NULL) @@ -1704,12 +1704,12 @@ UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vectorsubstituteExpectation(.), then decreaseLeadsLags for this oExp operator //arg(lag-period) (holds entire subtree of arg(lag-period) - NodeID substexpr = (arg->substituteExpectation(subst_table, neweqs, partial_information_model))->decreaseLeadsLags(Expectation_information_set); + NodeID substexpr = (arg->substituteExpectation(subst_table, neweqs, partial_information_model))->decreaseLeadsLags(expectation_information_set); assert(substexpr != NULL); neweqs.push_back(dynamic_cast(datatree.AddEqual(newAuxE, substexpr))); //AUXE_period_arg.idx = arg(lag-period) - newAuxE = newAuxE->decreaseLeadsLags(-1*Expectation_information_set); + newAuxE = newAuxE->decreaseLeadsLags(-1*expectation_information_set); assert(dynamic_cast(newAuxE) != NULL); } diff --git a/preprocessor/ExprNode.hh b/preprocessor/ExprNode.hh index 752e31d35..9091d33ae 100644 --- a/preprocessor/ExprNode.hh +++ b/preprocessor/ExprNode.hh @@ -387,14 +387,15 @@ class UnaryOpNode : public ExprNode { private: const NodeID arg; - const int Expectation_information_set; + //! Stores the information set. Only used for expectation operator + const int expectation_information_set; const UnaryOpcode op_code; virtual NodeID computeDerivative(int deriv_id); virtual int cost(const temporary_terms_type &temporary_terms, bool is_matlab) const; //! Returns the derivative of this node if darg is the derivative of the argument NodeID composeDerivatives(NodeID darg); public: - UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const NodeID arg_arg, const int arg_exp_info_set); + UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const NodeID arg_arg, const int expectation_information_set_arg); virtual void prepareForDerivation(); virtual void computeTemporaryTerms(map &reference_count, temporary_terms_type &temporary_terms, bool is_matlab) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;