From b5baf45f36199751e8157d09483b03ac4b2a7c36 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 18 Jun 2010 15:09:47 +0200 Subject: [PATCH] move validation check from constructor to checkpass --- preprocessor/ComputingTasks.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index eee520674..3e681ef6d 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -351,15 +351,6 @@ EstimatedParamsStatement::EstimatedParamsStatement(const vector::const_iterator it = estim_params_list.begin(); - it != estim_params_list.end(); it++) - if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy - if (dynamic_cast(it->mean)->isNumConstNodeEqualTo(0.5) && - dynamic_cast(it->std)->isNumConstNodeEqualTo(0.5)) - { - cerr << "ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl; - exit(EXIT_FAILURE); - } } void @@ -367,8 +358,18 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct) { for (vector::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++) - if (it->name == "dsge_prior_weight") - mod_file_struct.dsge_prior_weight_in_estimated_params = true; + { + if (it->name == "dsge_prior_weight") + mod_file_struct.dsge_prior_weight_in_estimated_params = true; + + if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy + if (dynamic_cast(it->mean)->isNumConstNodeEqualTo(0.5) && + dynamic_cast(it->std)->isNumConstNodeEqualTo(0.5)) + { + cerr << "ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl; + exit(EXIT_FAILURE); + } + } } void