Select Git revision
StaticModel.hh
Forked from
Dynare / preprocessor
Source project has a limited visibility.
StaticModel.hh 8.13 KiB
/*
* Copyright © 2003-2022 Dynare Team
*
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef _STATIC_MODEL_HH
#define _STATIC_MODEL_HH
#include <fstream>
#include <filesystem>
#include "ModelTree.hh"
using namespace std;
class DynamicModel;
//! Stores a static model, as derived from the "model" block when leads and lags have been removed
class StaticModel : public ModelTree
{
private:
//! Writes static model file (standard Matlab version)
void writeStaticMFile(const string &basename) const;
//! Writes static model file (C version)
void writeStaticCFile(const string &basename) const;
//! Writes static model file (Julia version)
void writeStaticJuliaFile(const string &basename) const;
//! Writes the static model equations and its derivatives
void writeStaticModel(const string &basename, ostream &StaticOutput, bool use_dll, bool julia) const;
//! Writes the main static function of block decomposed model (MATLAB version)
void writeStaticBlockMFile(const string &basename) const;
//! Writes the main static function of block decomposed model (C version)
void writeStaticBlockCFile(const string &basename) const;
//! Helper for writing a per-block static file of block decomposed model
void writeStaticPerBlockHelper(int blk, ostream &output, ExprNodeOutputType output_type, temporary_terms_t &temporary_terms) const;
//! Writes the per-block static files of block decomposed model (MATLAB version)
void writeStaticPerBlockMFiles(const string &basename) const;
//! Writes the per-block static files of block decomposed model (C version)
void writeStaticPerBlockCFiles(const string &basename) const;
//! Writes the code of the block-decomposed model in virtual machine bytecode
void writeStaticBlockBytecode(const string &basename) const;
//! Writes the code of the model in virtual machine bytecode
void writeStaticBytecode(const string &basename) const;
//! Adds per-block information for bytecode simulation in a separate .bin file
void writeBlockBytecodeBinFile(const string &basename, int num,