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
cb9d603e
Commit
cb9d603e
authored
Feb 24, 2014
by
Sébastien Villemot
Browse files
Add a warning if some endogenous is not present in steady_state_model block.
Closes #556
parent
eaf02155
Changes
3
Hide whitespace changes
Inline
Side-by-side
SteadyStateModel.cc
View file @
cb9d603e
...
...
@@ -93,6 +93,15 @@ SteadyStateModel::checkPass(bool ramsey_policy, WarningConsolidation &warnings)
copy
(
symb_ids
.
begin
(),
symb_ids
.
end
(),
back_inserter
(
so_far_defined
));
}
set
<
int
>
orig_endogs
=
symbol_table
.
getOrigEndogenous
();
for
(
set
<
int
>::
const_iterator
it
=
orig_endogs
.
begin
();
it
!=
orig_endogs
.
end
();
++
it
)
{
if
(
find
(
so_far_defined
.
begin
(),
so_far_defined
.
end
(),
*
it
)
==
so_far_defined
.
end
())
warnings
<<
"WARNING: in the 'steady_state_model' block, variable '"
<<
symbol_table
.
getName
(
*
it
)
<<
"' is not assigned a value"
<<
endl
;
}
}
void
...
...
SymbolTable.cc
View file @
cb9d603e
/*
* Copyright (C) 2003-201
3
Dynare Team
* Copyright (C) 2003-201
4
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -591,3 +591,23 @@ SymbolTable::getEndogenous() const
endogs
.
insert
(
it
->
second
);
return
endogs
;
}
bool
SymbolTable
::
isAuxiliaryVariable
(
int
symb_id
)
const
{
for
(
int
i
=
0
;
i
<
aux_vars
.
size
();
i
++
)
if
(
aux_vars
[
i
].
get_symb_id
()
==
symb_id
)
return
true
;
return
false
;
}
set
<
int
>
SymbolTable
::
getOrigEndogenous
()
const
{
set
<
int
>
origendogs
;
for
(
symbol_table_type
::
const_iterator
it
=
symbol_table
.
begin
();
it
!=
symbol_table
.
end
();
it
++
)
if
(
getType
(
it
->
second
)
==
eEndogenous
&&
!
isAuxiliaryVariable
(
it
->
second
))
origendogs
.
insert
(
it
->
second
);
return
origendogs
;
}
SymbolTable.hh
View file @
cb9d603e
/*
* Copyright (C) 2003-201
3
Dynare Team
* Copyright (C) 2003-201
4
Dynare Team
*
* This file is part of Dynare.
*
...
...
@@ -297,6 +297,10 @@ public:
set
<
int
>
getExogenous
()
const
;
//! Get list of endogenous variables
set
<
int
>
getEndogenous
()
const
;
//! Is a given symbol an auxiliary variable
bool
isAuxiliaryVariable
(
int
symb_id
)
const
;
//! Get list of endogenous variables without aux vars
set
<
int
>
getOrigEndogenous
()
const
;
};
inline
bool
...
...
Write
Preview
Markdown
is supported
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