-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run context condition checks only once, after model parsing #1105
Conversation
eec6c89
to
45f2a47
Compare
3f1e731
to
0ff3456
Compare
Bencher Report
Click to view all benchmark results
|
0ff3456
to
ceb4f22
Compare
ceb4f22
to
2563e63
Compare
Bencher Report
Click to view all benchmark results
|
pynestml/transformers/assign_implicit_conversion_factors_transformer.py
Outdated
Show resolved
Hide resolved
pynestml/transformers/assign_implicit_conversion_factors_transformer.py
Outdated
Show resolved
Hide resolved
pynestml/utils/model_parser.py
Outdated
@@ -142,10 +144,14 @@ def parse_file(cls, file_path=None): | |||
for model in ast.get_model_list(): | |||
model.accept(ASTSymbolTableVisitor()) | |||
SymbolTable.add_model_scope(model.get_name(), model.get_scope()) | |||
Logger.set_current_node(model) | |||
AssignImplicitConversionFactorsTransformer().transform(model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a Transformer
, this should be part of the transformation step. But, I understand that we have to do this before we check the CoCos. We also cannot move this as part of the transformation step and then check the cocos because some cocos transform the model by moving variables across models, especially when synapse models are present (please correct me if I am wrong). So do you think this shouldn't technically be called a Transformer
but just a visitor doing the conversion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Changed the transformer into a visitor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you!
Thank you for the review! Let's merge as soon as the tests pass. |
This is a spin-off from #1050.
Refactor cocos such that they run only once, after model parsing.
Fixes some other bugs that emerged as part of this refactor. For instance, two cocos turned out to actually make needed changes to the model; the modification part has now been spun off to the new AssignImplicitConversionFactorsTransformer. (I can also make the transformer into a pure visitor; please let me know if you prefer this approach.)
Changes order of operations in compartmental code generator: to prevent symbol not found error, add propagator variable first, then add the update expressions that reference this variable.