From a6d9ba6e558c9f149ee81cc0e00837623563cb50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 20 May 2020 11:49:32 +0200
Subject: [PATCH] Rename EquationType::evaluate_s to evaluateRenormalized, for
 clarity

---
 src/CodeInterpreter.hh | 2 +-
 src/DynamicModel.cc    | 8 ++++----
 src/ModelTree.cc       | 4 ++--
 src/ModelTree.hh       | 2 +-
 src/StaticModel.cc     | 8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/CodeInterpreter.hh b/src/CodeInterpreter.hh
index e4cf5bbd..fdd93d26 100644
--- a/src/CodeInterpreter.hh
+++ b/src/CodeInterpreter.hh
@@ -109,7 +109,7 @@ enum class EquationType
   {
    unknown, //!< Unknown equation type
    evaluate, //!< Simple evaluation, normalized variable on left-hand side (written as such by the user)
-   evaluate_s, //!< Simple evaluation, normalized variable on left-hand side (normalization computed by the preprocessor)
+   evaluateRenormalized, //!< Simple evaluation, normalized variable on left-hand side (normalization computed by the preprocessor)
    solve //!< No simple evaluation of the equation, it has to be solved
   };
 
diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 71782a1e..11a9f0bb 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -394,7 +394,7 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
             case BlockSimulationType::evaluateBackward:
             case BlockSimulationType::evaluateForward:
             evaluation:
-              if (equ_type == EquationType::evaluate_s)
+              if (equ_type == EquationType::evaluateRenormalized)
                 {
                   e = getBlockEquationRenormalizedExpr(blk, eq);
                   lhs = e->arg1;
@@ -955,7 +955,7 @@ DynamicModel::writeDynamicBlockBytecode(const string &basename, bool linear_deco
                   rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, true, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, true, false);
                 }
-              else if (equ_type == EquationType::evaluate_s)
+              else if (equ_type == EquationType::evaluateRenormalized)
                 {
                   eq_node = getBlockEquationRenormalizedExpr(block, i);
                   lhs = eq_node->arg1;
@@ -4449,7 +4449,7 @@ DynamicModel::determineBlockDerivativesType(int blk)
           if (int var_orig = getBlockVariableID(blk, var);
               endos_and_lags.find({ var_orig, lag }) != endos_and_lags.end())
             {
-              if (getBlockEquationType(blk, eq) == EquationType::evaluate_s
+              if (getBlockEquationType(blk, eq) == EquationType::evaluateRenormalized
                   && eq < nb_recursive)
                 /* It’s a normalized recursive equation, we have to recompute
                    the derivative using the chain rule */
@@ -4483,7 +4483,7 @@ DynamicModel::computeChainRuleJacobian()
       for (int i = 0; i < nb_recursives; i++)
         {
           int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0);
-          if (getBlockEquationType(blk, i) == EquationType::evaluate_s)
+          if (getBlockEquationType(blk, i) == EquationType::evaluateRenormalized)
             recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i);
           else
             recursive_vars[deriv_id] = getBlockEquationExpr(blk, i);
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index bd44fd2f..f7616518 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -542,7 +542,7 @@ ModelTree::equationTypeDetermination(const map<tuple<int, int, int>, expr_t> &fi
                 {
                   normalized_eq = equations[eq]->normalizeEquation(symbol_table.getID(SymbolType::endogenous, var), 0);
                   if ((mfs == 2 && variable_not_in_derivative) || mfs == 3)
-                    Equation_Simulation_Type = EquationType::evaluate_s;
+                    Equation_Simulation_Type = EquationType::evaluateRenormalized;
                 }
               catch (ExprNode::NormalizationFailed &e)
                 {
@@ -643,7 +643,7 @@ ModelTree::computeSimulationTypeOfBlock(int blk)
   else
     {
       bool can_eval = (getBlockEquationType(blk, 0) == EquationType::evaluate
-                       || getBlockEquationType(blk, 0) == EquationType::evaluate_s);
+                       || getBlockEquationType(blk, 0) == EquationType::evaluateRenormalized);
       if (blocks[blk].max_endo_lead > 0)
         type = can_eval ? BlockSimulationType::evaluateBackward :
           BlockSimulationType::solveBackwardSimple;
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index c9d3dbfe..adde1434 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -353,7 +353,7 @@ protected:
   bool
   isBlockEquationRenormalized(int blk, int eq) const
   {
-    return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].first == EquationType::evaluate_s;
+    return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].first == EquationType::evaluateRenormalized;
   };
   //! Return the expr_t of equation belonging to the block
   BinaryOpNode *
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index a1d5de10..2a7958b7 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -218,7 +218,7 @@ StaticModel::writeStaticPerBlockMFiles(const string &basename) const
             case BlockSimulationType::evaluateBackward:
             case BlockSimulationType::evaluateForward:
             evaluation:
-              if (equ_type == EquationType::evaluate_s)
+              if (equ_type == EquationType::evaluateRenormalized)
                 {
                   e = getBlockEquationRenormalizedExpr(blk, eq);
                   lhs = e->arg1;
@@ -569,7 +569,7 @@ StaticModel::writeStaticBlockBytecode(const string &basename) const
                   rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
                 }
-              else if (equ_type == EquationType::evaluate_s)
+              else if (equ_type == EquationType::evaluateRenormalized)
                 {
                   eq_node = getBlockEquationRenormalizedExpr(block, i);
                   lhs = eq_node->arg1;
@@ -745,7 +745,7 @@ StaticModel::writeStaticBlockBytecode(const string &basename) const
                   rhs->compile(code_file, instruction_number, false, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
                   lhs->compile(code_file, instruction_number, true, temporary_terms_union, blocks_temporary_terms_idxs, false, false);
                 }
-              else if (equ_type == EquationType::evaluate_s)
+              else if (equ_type == EquationType::evaluateRenormalized)
                 {
                   eq_node = getBlockEquationRenormalizedExpr(block, i);
                   lhs = eq_node->arg1;
@@ -1903,7 +1903,7 @@ StaticModel::computeChainRuleJacobian()
       for (int i = 0; i < nb_recursives; i++)
         {
           int deriv_id = getDerivID(symbol_table.getID(SymbolType::endogenous, getBlockVariableID(blk, i)), 0);
-          if (getBlockEquationType(blk, i) == EquationType::evaluate_s)
+          if (getBlockEquationType(blk, i) == EquationType::evaluateRenormalized)
             recursive_vars[deriv_id] = getBlockEquationRenormalizedExpr(blk, i);
           else
             recursive_vars[deriv_id] = getBlockEquationExpr(blk, i);
-- 
GitLab