From d9b6d5d93a2742d0b21a7a9f028ed787f52fd61b Mon Sep 17 00:00:00 2001 From: Ferhat Mihoubi <ferhat.mihoubi@univ-evry.fr> Date: Thu, 8 Mar 2012 15:39:16 +0100 Subject: [PATCH] Adds the index of equations (M_.blocksEQU) for a block decomposed model without bytecode option and use this index in resid.m to retrieve the residuals --- matlab/resid.m | 6 +----- preprocessor/StaticModel.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/matlab/resid.m b/matlab/resid.m index 499ce144a..1e769ffb9 100644 --- a/matlab/resid.m +++ b/matlab/resid.m @@ -77,11 +77,7 @@ if options_.block && ~options_.bytecode oo_.steady_state,... [oo_.exo_steady_state; ... oo_.exo_det_steady_state], M_.params); - if isempty(M_.blocksMFS{i}) - idx = var_indx; - else - idx = M_.blocksMFS{i}; - end + idx = M_.blocksEQU{i}; z(idx) = r; end elseif options_.bytecode diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index 7f25803fd..5a59e9489 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1354,6 +1354,15 @@ StaticModel::writeOutput(ostream &output, bool block) const output << "];" << endl; } + output << "M_.blocksEQU = cell(" << nb_blocks << ", 1);" << endl; + for (int b = 0; b < (int) nb_blocks; b++) + { + unsigned int block_size = getBlockSize(b); + output << "M_.blocksEQU{" << b+1 << "} = [ "; + for (int i = 0; i < (int) block_size; i++) + output << getBlockEquationID(b, i)+1 << "; "; + output << "];" << endl; + } } SymbolType -- GitLab