Block decomposition: small simplification in per-block dynamic files

issue#70
Sébastien Villemot 2020-06-19 12:38:28 +02:00
parent dc28aaa5e9
commit 8ec43b1fb2
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 19 additions and 29 deletions

View File

@ -261,35 +261,25 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
<< " //" << endl << " //" << endl
<< " % // Simulation type " << " % // Simulation type "
<< BlockSim(simulation_type) << " //" << endl << BlockSim(simulation_type) << " //" << endl
<< " % ////////////////////////////////////////////////////////////////////////" << endl; << " % ////////////////////////////////////////////////////////////////////////" << endl
<< " if stochastic_mode" << endl
if (simulation_type == BlockSimulationType::evaluateBackward << " g1 = spalloc(" << block_size << ", " << blocks_jacob_cols_endo[blk].size() << ", " << nze << ");" << endl
|| simulation_type == BlockSimulationType::evaluateForward) << " g1_x = spalloc(" << block_size << ", " << blocks_jacob_cols_exo[blk].size() << ", " << nze_exo << ");" << endl
{ << " g1_xd = spalloc(" << block_size << ", " << blocks_jacob_cols_exo_det[blk].size() << ", " << nze_exo_det << ");" << endl
output << " if stochastic_mode" << endl << " g1_o = spalloc(" << block_size << ", " << blocks_jacob_cols_other_endo[blk].size() << ", " << nze_other_endo << ");" << endl;
<< " g1 = spalloc(" << block_mfs_size << ", " << blocks_jacob_cols_endo[blk].size() << ", " << nze << ");" << endl if (simulation_type == BlockSimulationType::solveTwoBoundariesComplete
<< " g1_x = spalloc(" << block_size << ", " << blocks_jacob_cols_exo[blk].size() << ", " << nze_exo << ");" << endl || simulation_type == BlockSimulationType::solveTwoBoundariesSimple)
<< " g1_xd = spalloc(" << block_size << ", " << blocks_jacob_cols_exo_det[blk].size() << ", " << nze_exo_det << ");" << endl output << " else" << endl
<< " g1_o = spalloc(" << block_size << ", " << blocks_jacob_cols_other_endo[blk].size() << ", " << nze_other_endo << ");" << endl << " g1 = spalloc(" << block_mfs_size
<< " end" << endl; << ", " << 3*block_mfs_size << ", " << nze << ");" << endl;
} else if (simulation_type == BlockSimulationType::solveBackwardSimple
else || simulation_type == BlockSimulationType::solveForwardSimple
{ || simulation_type == BlockSimulationType::solveBackwardComplete
output << " if stochastic_mode" << endl || simulation_type == BlockSimulationType::solveForwardComplete)
<< " g1 = spalloc(" << block_size << ", " << blocks_jacob_cols_endo[blk].size() << ", " << nze << ");" << endl output << " else" << endl
<< " g1_x = spalloc(" << block_size << ", " << blocks_jacob_cols_exo[blk].size() << ", " << nze_exo << ");" << endl << " g1 = spalloc(" << block_mfs_size
<< " g1_xd = spalloc(" << block_size << ", " << blocks_jacob_cols_exo_det[blk].size() << ", " << nze_exo_det << ");" << endl << ", " << block_mfs_size << ", " << nze << ");" << endl;
<< " g1_o = spalloc(" << block_size << ", " << blocks_jacob_cols_other_endo[blk].size() << ", " << nze_other_endo << ");" << endl output << " end" << endl;
<< " else" << endl;
if (simulation_type == BlockSimulationType::solveTwoBoundariesComplete
|| simulation_type == BlockSimulationType::solveTwoBoundariesSimple)
output << " g1 = spalloc(" << block_mfs_size
<< ", " << 3*block_mfs_size << ", " << nze << ");" << endl;
else
output << " g1 = spalloc(" << block_mfs_size
<< ", " << block_mfs_size << ", " << nze << ");" << endl;
output << " end" << endl;
}
if (simulation_type == BlockSimulationType::solveBackwardSimple if (simulation_type == BlockSimulationType::solveBackwardSimple
|| simulation_type == BlockSimulationType::solveForwardSimple || simulation_type == BlockSimulationType::solveForwardSimple