#include "backend.h"
#include "AmplModel.h"
#include "GlobalVariables.h"
#include "ModelComp.h"
#include "nodes.h"
#include "sml.tab.h"
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <fstream>
Functions | |
static void | write_ampl_for_submodel (ostream &fout, AmplModel *submodel) |
static void | print_entry (const ModelComp *entry) |
static void | print_entries (const AmplModel *model, compType type) |
static void | print_model (const AmplModel *model) |
static void | fill_model_list_ (AmplModel *model, list< AmplModel * > &listam) |
static void | print_indent (ofstream &out, int k) |
Prettyprinting. | |
int | process_model (AmplModel *model, const string &datafilename) |
void | write_ampl_for_submodel_ (ostream &fout, int thislevel, int sublevel, AmplModel **list, AmplModel *submodel) |
void | modified_write (ostream &fout, ModelComp *comp) |
Writes out a component of a model. | |
Variables | |
static const int | MAX_NESTED_BLOCKS = 5 |
static bool | prt_modwrite = false |
vector< list< add_index > > | l_addIndex |
References AmplModel::comps, AmplModel::level, AmplModel::n_submodels, ModelComp::other, AmplModel::parent, TMODEL, and ModelComp::type.
Referenced by process_model().
void modified_write | ( | ostream & | fout, | |
ModelComp * | comp | |||
) |
Writes out a component of a model.
Components can be modified: if this is down into a submodel, then
[in] | fout | The file to write to. |
[in] | comp | The component definition to write out. |
Prints the global definition of the given ModelComponent to the given file.
The last part is simply done by a call to (comp->attributes)->print() (SyntaxNode::print) (with SyntaxNode::use_global_names set to true => the argument list version of ModelComp::getGlobalName is called)
References ModelComp::attributes, ModelComp::compTypes, add_index::dummyVar, SyntaxNode::front(), getGlobalName(), SyntaxNode::getOpCode(), ModelComp::id, ModelComp::indexing, l_addIndex, ModelComp::model, NOARG, AmplModel::parent, prt_modwrite, add_index::set, TCON, TMAX, TMIN, TMODEL, and ModelComp::type.
Referenced by ModelComp::modifiedWriteAllTagged(), write_ampl_for_submodel_(), and AmplModel::writeTaggedComponents().
References AmplModel::comps, print_entry(), and ModelComp::type.
Referenced by print_model().
static void print_entry | ( | const ModelComp * | entry | ) | [static] |
References ModelComp::attributes, ModelComp::id, and ModelComp::indexing.
Referenced by print_entries(), and print_model().
static void print_indent | ( | ofstream & | out, | |
int | k | |||
) | [static] |
Prettyprinting.
Referenced by process_model().
static void print_model | ( | const AmplModel * | model | ) | [static] |
References AmplModel::comps, AmplModel::n_cons, AmplModel::n_objs, AmplModel::n_params, AmplModel::n_sets, AmplModel::n_submodels, AmplModel::n_vars, AmplModel::name, ModelComp::other, print_entries(), print_entry(), TCON, TMAX, TMODEL, TPARAM, TSET, TVAR, ModelComp::type, and SyntaxNode::use_global_names.
int process_model | ( | AmplModel * | model, | |
const string & | datafilename | |||
) |
References SyntaxNode::begin(), AmplModel::comps, SyntaxNode::default_model, add_index::dummyVar, fill_model_list_(), SyntaxNode::front(), getGlobalName(), SyntaxNodeIx::getIndexingSet(), SyntaxNodeIx::getListDummyVars(), SyntaxNodeIDREF::getModelComp(), SyntaxNode::getOpCode(), ModelComp::id, ModelComp::indexing, l_addIndex, AmplModel::level, AmplModel::n_submodels, AmplModel::name, AmplModel::node, ModelComp::other, AmplModel::parent, print_indent(), PRINT_LOG, GlobalVariables::prtLvl, SyntaxNode::push_back(), add_index::set, TMODEL, ModelComp::type, and write_ampl_for_submodel().
Referenced by sml_generate().
void write_ampl_for_submodel | ( | ostream & | fout, | |
AmplModel * | submodel | |||
) | [static] |
void write_ampl_for_submodel_ | ( | ostream & | fout, | |
int | thislevel, | |||
int | sublevel, | |||
AmplModel ** | list, | |||
AmplModel * | submodel | |||
) |
References SyntaxNode::begin(), ModelComp::clone(), SyntaxNodeIDREF::clone(), AmplModel::comps, SyntaxNode::default_model, add_index::dummyVar, SyntaxNode::front(), SyntaxNodeIDREF::getModelComp(), SyntaxNode::getOpCode(), AmplModel::global_name, ModelComp::id, ModelComp::indexing, l_addIndex, ModelComp::model, modified_write(), ModelComp::other, SyntaxNode::print(), SyntaxNode::push_back(), SyntaxNodeIDREF::ref, add_index::set, TMODEL, TPARAM, TSET, TVAR, ModelComp::type, WITHIN, and AmplModel::writeTaggedComponents().
Referenced by write_ampl_for_submodel().
vector<list<add_index> > l_addIndex |
const int MAX_NESTED_BLOCKS = 5 [static] |
Referenced by write_ampl_for_submodel().
bool prt_modwrite = false [static] |
Referenced by modified_write().