Block decomposition: turn BlockType into an enum class

parent fcef9cf8
......@@ -105,12 +105,12 @@ enum Tags
};
enum BlockType
enum class BlockType
{
SIMULTANS, //!< Simultaneous time separable block
PROLOGUE, //!< Prologue block (one equation at the beginning, later merged)
EPILOGUE, //!< Epilogue block (one equation at the beginning, later merged)
SIMULTAN //!< Simultaneous time unseparable block
simultans, //!< Simultaneous time separable block
prologue, //!< Prologue block (one equation at the beginning, later merged)
epilogue, //!< Epilogue block (one equation at the beginning, later merged)
simultan //!< Simultaneous time unseparable block
};
enum EquationType
......
......@@ -431,19 +431,19 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
output << "function [residual, y, g1, g2, g3, b, varargout] = dynamic_" << block+1 << "(y, x, params, steady_state, periods, jacobian_eval, y_kmin, y_size, Periods)" << endl;
BlockType block_type;
if (simulation_type == SOLVE_TWO_BOUNDARIES_COMPLETE || simulation_type == SOLVE_TWO_BOUNDARIES_SIMPLE)
block_type = SIMULTAN;
block_type = BlockType::simultan;
else if (simulation_type == SOLVE_FORWARD_COMPLETE || simulation_type == SOLVE_BACKWARD_COMPLETE)
block_type = SIMULTANS;
block_type = BlockType::simultans;
else if ((simulation_type == SOLVE_FORWARD_SIMPLE || simulation_type == SOLVE_BACKWARD_SIMPLE
|| simulation_type == EVALUATE_BACKWARD || simulation_type == EVALUATE_FORWARD)
&& getBlockFirstEquation(block) < prologue)
block_type = PROLOGUE;
block_type = BlockType::prologue;
else if ((simulation_type == SOLVE_FORWARD_SIMPLE || simulation_type == SOLVE_BACKWARD_SIMPLE
|| simulation_type == EVALUATE_BACKWARD || simulation_type == EVALUATE_FORWARD)
&& getBlockFirstEquation(block) >= equations.size() - epilogue)
block_type = EPILOGUE;
block_type = BlockType::epilogue;
else
block_type = SIMULTANS;
block_type = BlockType::simultans;
output << " % ////////////////////////////////////////////////////////////////////////" << endl
<< " % //" << string(" Block ").substr(int (log10(block + 1))) << block + 1 << " " << BlockType0(block_type)
<< " //" << endl
......
......@@ -454,13 +454,13 @@ public:
{
switch (type)
{
case SIMULTANS:
case BlockType::simultans:
return "SIMULTANEOUS TIME SEPARABLE ";
case PROLOGUE:
case BlockType::prologue:
return "PROLOGUE ";
case EPILOGUE:
case BlockType::epilogue:
return "EPILOGUE ";
case SIMULTAN:
case BlockType::simultan:
return "SIMULTANEOUS TIME UNSEPARABLE";
default:
return "UNKNOWN ";
......
......@@ -312,17 +312,17 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
BlockType block_type;
if (simulation_type == SOLVE_FORWARD_COMPLETE || simulation_type == SOLVE_BACKWARD_COMPLETE)
block_type = SIMULTANS;
block_type = BlockType::simultans;
else if ((simulation_type == SOLVE_FORWARD_SIMPLE || simulation_type == SOLVE_BACKWARD_SIMPLE
|| simulation_type == EVALUATE_BACKWARD || simulation_type == EVALUATE_FORWARD)
&& getBlockFirstEquation(block) < prologue)
block_type = PROLOGUE;
block_type = BlockType::prologue;
else if ((simulation_type == SOLVE_FORWARD_SIMPLE || simulation_type == SOLVE_BACKWARD_SIMPLE
|| simulation_type == EVALUATE_BACKWARD || simulation_type == EVALUATE_FORWARD)
&& getBlockFirstEquation(block) >= equations.size() - epilogue)
block_type = EPILOGUE;
block_type = BlockType::epilogue;
else
block_type = SIMULTANS;
block_type = BlockType::simultans;
output << " % ////////////////////////////////////////////////////////////////////////" << endl
<< " % //" << string(" Block ").substr(int (log10(block + 1))) << block + 1 << " " << BlockType0(block_type)
<< " //" << endl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment