Skip to content
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

Stop registering FactorDefs to the UnitTable #1030

Merged
merged 9 commits into from
Apr 19, 2023
Merged

Conversation

iomaganaris
Copy link
Contributor

Prior to this PR we were registering Factor Definitions from the UNITS block of the mod file to the UnitTable which holds all the registered units with their values and dimensions.
For example before this PR when we defined in the mod file:

R = 8 (joule/degC)

We inserted to the UnitTable the new value for R and all the consequent unit declarations based on R where done using the new value.
With this PR this is not allowed any more.
Factor Definitions which are in the form:

<unit_name> = <value> <units>

are only used to be printed to the generated C++ file.
Also redefinitions of Units which are in the form:

(<unit_name>) = (<value> <units>)

are also not allowed anymore and an exception is thrown in case they exist.
All of the above were done so that we follow the same logic as the NEURON code generator.

Fixes: #703

@iomaganaris iomaganaris requested a review from alkino April 18, 2023 11:20
@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Merging #1030 (aa5a76f) into master (3b148fc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1030   +/-   ##
=======================================
  Coverage   70.04%   70.04%           
=======================================
  Files         190      190           
  Lines       25789    25786    -3     
=======================================
- Hits        18064    18063    -1     
+ Misses       7725     7723    -2     
Impacted Files Coverage Δ
src/units/units.cpp 98.32% <100.00%> (+1.14%) ⬆️
src/visitors/units_visitor.cpp 100.00% <100.00%> (ø)
test/unit/units/parser.cpp 100.00% <100.00%> (ø)
test/unit/visitor/units.cpp 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot
Copy link
Collaborator

Logfiles from GitLab pipeline #116651 (:white_check_mark:) have been uploaded here!

Status and direct links:

@iomaganaris iomaganaris merged commit 5f864dc into master Apr 19, 2023
16 checks passed
@iomaganaris iomaganaris deleted the magkanar/unit_defs branch April 19, 2023 07:16
alkino pushed a commit that referenced this pull request Apr 20, 2023
* Stop parsing of FactorDefs by the UnitParser that registered them in the UnitTable to follow the same policy as NEURON

* Throw error when trying to register unit that already exists in the UnitTable

* Added tests for UNITS redefinition and correct registration of UnitDefs and FactorDefs

* Use :g for printing factors of units in unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NMODL UNITS redefinition behavior
3 participants