Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
preprocessor
Commits
6bee53c6
Commit
6bee53c6
authored
Oct 21, 2013
by
MichelJuillard
Browse files
extended_preprocessor: fixed computation of steady state out of
steady_state_model
parent
1cfaddcd
Changes
2
Show whitespace changes
Inline
Side-by-side
ExprNode.hh
View file @
6bee53c6
...
...
@@ -86,7 +86,10 @@ enum ExprNodeOutputType
|| (output_type) == oMatlabDynamicSparseSteadyStateOperator \
|| (output_type) == oSteadyStateFile)
#define IS_C(output_type) ((output_type) == oCDynamicModel || (output_type) == oCStaticModel || (output_type) == oCDynamicSteadyStateOperator)
#define IS_C(output_type) ((output_type) == oCDynamicModel \
|| (output_type) == oCStaticModel \
|| (output_type) == oCDynamicSteadyStateOperator \
|| (output_type) == oCSteadyStateFile)
#define IS_LATEX(output_type) ((output_type) == oLatexStaticModel \
|| (output_type) == oLatexDynamicModel \
...
...
SteadyStateModel.cc
View file @
6bee53c6
...
...
@@ -158,14 +158,16 @@ SteadyStateModel::writeSteadyStateFileCC(const string &basename, bool ramsey_pol
exit
(
EXIT_FAILURE
);
}
output
<<
"#include <math.h>"
<<
endl
;
if
(
cuda
)
output
<<
"__global__ "
;
output
<<
"void steadystate("
<<
"const double *exo_, const double *params
_
, double *ys_, int *info)"
<<
endl
<<
"const double *exo_, const double *params, double *ys_, int *info)"
<<
endl
<<
"// Steady state file generated by Dynare preprocessor"
<<
endl
<<
"{"
<<
endl
<<
" info = 0;"
<<
endl
;
<<
"
*
info = 0;"
<<
endl
;
if
(
recursive_order
.
size
()
==
0
)
{
...
...
@@ -179,24 +181,18 @@ SteadyStateModel::writeSteadyStateFileCC(const string &basename, bool ramsey_pol
const
vector
<
int
>
&
symb_ids
=
recursive_order
[
i
];
output
<<
" "
;
if
(
symb_ids
.
size
()
>
1
)
output
<<
"["
;
for
(
size_t
j
=
0
;
j
<
symb_ids
.
size
();
j
++
)
{
variable_node_map_t
::
const_iterator
it
=
variable_node_map
.
find
(
make_pair
(
symb_ids
[
j
],
0
));
std
::
cout
<<
"Error: in C, multiple returns are not permitted in steady_state_model"
<<
std
::
endl
;
variable_node_map_t
::
const_iterator
it
=
variable_node_map
.
find
(
make_pair
(
symb_ids
[
0
],
0
));
assert
(
it
!=
variable_node_map
.
end
());
dynamic_cast
<
ExprNode
*>
(
it
->
second
)
->
writeOutput
(
output
,
oSteadyStateFile
);
if
(
j
<
symb_ids
.
size
()
-
1
)
output
<<
","
;
}
if
(
symb_ids
.
size
()
>
1
)
output
<<
"]"
;
if
(
it
->
second
->
get_type
()
==
eModFileLocalVariable
)
output
<<
"double "
;
dynamic_cast
<
ExprNode
*>
(
it
->
second
)
->
writeOutput
(
output
,
oCSteadyStateFile
);
output
<<
"="
;
def_table
.
find
(
symb_ids
)
->
second
->
writeOutput
(
output
,
oSteadyStateFile
);
def_table
.
find
(
symb_ids
)
->
second
->
writeOutput
(
output
,
o
C
SteadyStateFile
);
output
<<
";"
<<
endl
;
}
output
<<
" // Auxiliary equations"
<<
endl
;
static_model
.
writeAuxVarInitval
(
output
,
oSteadyStateFile
);
static_model
.
writeAuxVarInitval
(
output
,
o
C
SteadyStateFile
);
output
<<
"}"
<<
endl
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment