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
176732ee
Verified
Commit
176732ee
authored
Jul 05, 2019
by
Sébastien Villemot
Browse files
ModelTree: pass argument by const-reference rather than by value in some methods
parent
17c41042
Pipeline
#1505
passed with stage
in 1 minute and 53 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/ModelTree.cc
View file @
176732ee
...
...
@@ -1965,29 +1965,23 @@ ModelTree::addAuxEquation(expr_t eq)
}
void
ModelTree
::
addTrendVariables
(
vector
<
int
>
trend_vars
,
expr_t
growth_factor
)
noexcept
(
false
)
ModelTree
::
addTrendVariables
(
const
vector
<
int
>
&
trend_vars
,
expr_t
growth_factor
)
noexcept
(
false
)
{
while
(
!
trend_vars
.
empty
()
)
if
(
trend_symbols_map
.
find
(
trend_vars
.
back
()
)
!=
trend_symbols_map
.
end
())
throw
TrendException
(
symbol_table
.
getName
(
trend_vars
.
back
()
));
for
(
int
id
:
trend_vars
)
if
(
trend_symbols_map
.
find
(
id
)
!=
trend_symbols_map
.
end
())
throw
TrendException
(
symbol_table
.
getName
(
id
));
else
{
trend_symbols_map
[
trend_vars
.
back
()]
=
growth_factor
;
trend_vars
.
pop_back
();
}
trend_symbols_map
[
id
]
=
growth_factor
;
}
void
ModelTree
::
addNonstationaryVariables
(
vector
<
int
>
nonstationary_vars
,
bool
log_deflator
,
expr_t
deflator
)
noexcept
(
false
)
ModelTree
::
addNonstationaryVariables
(
const
vector
<
int
>
&
nonstationary_vars
,
bool
log_deflator
,
expr_t
deflator
)
noexcept
(
false
)
{
while
(
!
nonstationary_vars
.
empty
()
)
if
(
nonstationary_symbols_map
.
find
(
nonstationary_vars
.
back
()
)
!=
nonstationary_symbols_map
.
end
())
throw
TrendException
(
symbol_table
.
getName
(
nonstationary_vars
.
back
()
));
for
(
int
id
:
nonstationary_vars
)
if
(
nonstationary_symbols_map
.
find
(
id
)
!=
nonstationary_symbols_map
.
end
())
throw
TrendException
(
symbol_table
.
getName
(
id
));
else
{
nonstationary_symbols_map
[
nonstationary_vars
.
back
()]
=
{
log_deflator
,
deflator
};
nonstationary_vars
.
pop_back
();
}
nonstationary_symbols_map
[
id
]
=
{
log_deflator
,
deflator
};
}
void
...
...
src/ModelTree.hh
View file @
176732ee
...
...
@@ -343,9 +343,9 @@ public:
//! Returns the number of equations in the model
int
equation_number
()
const
;
//! Adds a trend variable with its growth factor
void
addTrendVariables
(
vector
<
int
>
trend_vars
,
expr_t
growth_factor
)
noexcept
(
false
);
void
addTrendVariables
(
const
vector
<
int
>
&
trend_vars
,
expr_t
growth_factor
)
noexcept
(
false
);
//! Adds a nonstationary variables with their (common) deflator
void
addNonstationaryVariables
(
vector
<
int
>
nonstationary_vars
,
bool
log_deflator
,
expr_t
deflator
)
noexcept
(
false
);
void
addNonstationaryVariables
(
const
vector
<
int
>
&
nonstationary_vars
,
bool
log_deflator
,
expr_t
deflator
)
noexcept
(
false
);
//! Is a given variable non-stationary?
bool
isNonstationary
(
int
symb_id
)
const
;
void
set_cutoff_to_zero
();
...
...
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