2008-01-30 12:38:09 +01:00
|
|
|
/*
|
2013-02-26 16:50:05 +01:00
|
|
|
* Copyright (C) 2008-2013 Dynare Team
|
2008-01-30 12:38:09 +01:00
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "ParsingDriver.hh"
|
|
|
|
#include "ModFile.hh"
|
2010-10-25 18:20:58 +02:00
|
|
|
#include "ConfigFile.hh"
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
void
|
2013-07-10 12:02:12 +02:00
|
|
|
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
2010-10-25 18:20:58 +02:00
|
|
|
bool parallel, const string ¶llel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
|
2013-09-13 20:37:31 +02:00
|
|
|
bool parallel_test, bool nostrict
|
2009-12-11 15:46:21 +01:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
|
|
|
, bool cygwin, bool msvc
|
|
|
|
#endif
|
|
|
|
)
|
2008-01-30 12:38:09 +01:00
|
|
|
{
|
2013-02-26 16:50:05 +01:00
|
|
|
WarningConsolidation warnings(no_warn);
|
|
|
|
|
2013-09-16 22:13:56 +02:00
|
|
|
ParsingDriver p(warnings, nostrict);
|
2008-08-25 18:45:39 +02:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Do parsing and construct internal representation of mod file
|
2008-03-28 18:38:10 +01:00
|
|
|
ModFile *mod_file = p.parse(in, debug);
|
2011-02-04 16:25:38 +01:00
|
|
|
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, cluster_name);
|
2010-10-25 18:20:58 +02:00
|
|
|
config_file.getConfigFileInfo(parallel_config_file);
|
2008-08-25 18:45:39 +02:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Run checking pass
|
|
|
|
mod_file->checkPass();
|
2013-02-26 16:50:05 +01:00
|
|
|
config_file.checkPass(warnings);
|
2008-01-30 12:38:09 +01:00
|
|
|
|
2009-09-30 17:10:31 +02:00
|
|
|
// Perform transformations on the model (creation of auxiliary vars and equations)
|
2013-09-13 20:37:31 +02:00
|
|
|
mod_file->transformPass(nostrict);
|
2010-10-25 18:20:58 +02:00
|
|
|
config_file.transformPass();
|
2009-09-30 17:10:31 +02:00
|
|
|
|
2008-12-19 11:24:31 +01:00
|
|
|
// Evaluate parameters initialization, initval, endval and pounds
|
2009-11-06 19:31:03 +01:00
|
|
|
mod_file->evalAllExpressions(warn_uninit);
|
2008-12-19 11:24:31 +01:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Do computations
|
2008-10-29 16:10:51 +01:00
|
|
|
mod_file->computingPass(no_tmp_terms);
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
// Write outputs
|
2013-07-10 12:02:12 +02:00
|
|
|
mod_file->writeOutputFiles(basename, clear_all, no_log, no_warn, console, nograph, nointeractive, config_file
|
2009-12-11 15:46:21 +01:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
2009-12-16 18:13:23 +01:00
|
|
|
, cygwin, msvc
|
2009-12-11 15:46:21 +01:00
|
|
|
#endif
|
2009-12-16 18:13:23 +01:00
|
|
|
);
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
delete mod_file;
|
|
|
|
|
2008-04-02 17:01:52 +02:00
|
|
|
cout << "Preprocessing completed." << endl
|
2009-12-11 15:46:21 +01:00
|
|
|
<< "Starting MATLAB/Octave computing." << endl;
|
2008-01-30 12:38:09 +01:00
|
|
|
}
|