Skip to content

Commit

Permalink
Demostrate removing a row.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Aug 23, 2023
1 parent 3df0376 commit 01a198e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/nrnoc/hh.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ NEURON {
NONSPECIFIC_CURRENT il
RANGE gnabar, gkbar, gl, el, gna, gk
: `GLOBAL minf` will be replaced with `RANGE minf` if CoreNEURON enabled
GLOBAL minf, hinf, ninf, mtau, htau, ntau
RANGE minf, hinf, ninf, mtau, htau, ntau
THREADSAFE : assigned GLOBALs will be per thread
}

Expand Down Expand Up @@ -94,7 +94,7 @@ PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum, q10
: `TABLE minf` will be replaced with `:TABLE minf` if CoreNEURON enabled)
TABLE minf, mtau, hinf, htau, ninf, ntau DEPEND celsius FROM -100 TO 100 WITH 200
:TABLE minf, mtau, hinf, htau, ninf, ntau DEPEND celsius FROM -100 TO 100 WITH 200

UNITSOFF
q10 = 3^((celsius - 6.3)/10)
Expand Down
13 changes: 9 additions & 4 deletions test/unit_tests/container/generic_data_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ TEST_CASE("POINTER data_handle") {
auto& container = model.node_data();

// These two object create a row each and keep it alive.
auto row1_owner = Node::owning_handle{container};
auto row2_owner = Node::owning_handle{container};
auto row1_owner = std::make_unique<Node::owning_handle>(container);
auto row2_owner = std::make_unique<Node::owning_handle>(container);

// We'd like a data_handle to the both voltages.
auto v1 = container.get_handle<Node::field::Voltage>(row1_owner.id(), 0);
auto v2 = container.get_handle<Node::field::Voltage>(row2_owner.id(), 0);
auto v1 = container.get_handle<Node::field::Voltage>(row1_owner->id(), 0);
auto v2 = container.get_handle<Node::field::Voltage>(row2_owner->id(), 0);

// Initialize with the wrong sign.
*v1 = -1.0;
Expand Down Expand Up @@ -115,5 +115,10 @@ TEST_CASE("POINTER data_handle") {
// This is still a compiler error:
// _ppval[0].get<double*>() = nullptr;

// What happens when the rows are freed?
row1_owner = nullptr;
row2_owner = nullptr;
REQUIRE(_ppval[0].get<double*>() == nullptr);

free(_ppval);
}

0 comments on commit 01a198e

Please sign in to comment.