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

Fix instantiation of array state variables #1081

Merged
merged 5 commits into from
Oct 18, 2023
Merged

Conversation

iomaganaris
Copy link
Contributor

@iomaganaris iomaganaris commented Sep 26, 2023

For example the following code is printed for:

TITLE passive membrane channel

UNITS {
    (mV) = (millivolt)
    (mA) = (milliamp)
    (S) = (siemens)
}

NEURON {
    SUFFIX pas
    NONSPECIFIC_CURRENT i
    RANGE g, e
}

PARAMETER {
    g = .001    (S/cm2) <0,1e9>
    e = -70 (mV)
}

ASSIGNED {v (mV)  i (mA/cm2)}

BREAKPOINT {
    SOLVE states METHOD cnexp
    i = g*(v - e)
}

STATE {
    ar[3]
    s
}

DERIVATIVE states {
    ar[1] = ar[2] + 1
    s' = 1
}
for (std::size_t arr_index = 0; arr_index < 3; ++arr_index) {
    (inst->ar+id*3)[arr_index] = inst->global->ar0;
}

TODO:

  • Add unit test
  • Fix instantiation of the corresponding global variable (name + "0") -> default initialized to 0

Related to striatium mod files

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (420fb2d) 88.61% compared to head (37eefdf) 88.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1081      +/-   ##
==========================================
+ Coverage   88.61%   88.63%   +0.01%     
==========================================
  Files         169      169              
  Lines       12474    12485      +11     
==========================================
+ Hits        11054    11066      +12     
+ Misses       1420     1419       -1     
Files Coverage Δ
src/codegen/codegen_cpp_visitor.cpp 85.59% <100.00%> (+0.05%) ⬆️
test/unit/codegen/codegen_cpp_visitor.cpp 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bbpbuildbot

This comment has been minimized.

@iomaganaris iomaganaris marked this pull request as ready for review October 18, 2023 09:07
@iomaganaris iomaganaris requested a review from pramodk October 18, 2023 09:08
@bbpbuildbot
Copy link
Collaborator

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

Status and direct links:

@iomaganaris iomaganaris merged commit c594621 into master Oct 18, 2023
17 checks passed
@iomaganaris iomaganaris deleted the magkanar/fix_init_array branch October 18, 2023 10:36
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.

3 participants