Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed Oct 30, 2024
1 parent 972b58f commit b2006ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions src/nrnoc/extcelln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,12 @@ void nrn_setup_ext(NrnThread* _nt) {
Extnode* nde = nd->extnode;
double d = NODED(nd);
/* nde->_d only has -ELECTRODE_CURRENT contribution */
*m.mep(index, index) += NODED(nd);
m(index, index) += NODED(nd);
d = m.getval(index, index);
/* now d is only the membrane current contribution */
/* i.e. d = cm/dt + di/dvm */
*m.mep(index - 1, index) -= d;
*m.mep(index, index - 1) -= d;
m(index - 1, index) -= d;
m(index, index - 1) -= d;
#if I_MEMBRANE
ml->data(i, sav_g_index) = d;
#endif
Expand All @@ -456,24 +456,24 @@ void nrn_setup_ext(NrnThread* _nt) {
int j = 0;
for (;;) { /* between j and j+1 layer */
mfac = (*nde->param[xg_index_ext(j)] + *nde->param[xc_index_ext(j)] * cfac);
*m.mep(index + j, index + j) += mfac;
m(index + j, index + j) += mfac;
++j;
if (j == nrn_nlayer_extracellular) {
break;
}
*m.mep(index + j, index + j) += mfac;
*m.mep(index - 1 + j, index + j) -= mfac;
*m.mep(index + j, index - 1 + j) -= mfac;
m(index + j, index + j) += mfac;
m(index - 1 + j, index + j) -= mfac;
m(index + j, index - 1 + j) -= mfac;
}
Extnode* pnde = pnd->extnode;
/* axial connections */
if (pnde) { /* parent sec may not be extracellular */
int parent_index = pnd->eqn_index_;
for (j = 0; j < nrn_nlayer_extracellular; ++j) {
*m.mep(index + j, index + j) -= nde->_b[j];
*m.mep(parent_index + j, parent_index + j) -= nde->_a[j];
*m.mep(parent_index + j, index + j) += nde->_a[j];
*m.mep(index + j, parent_index + j) += nde->_b[j];
m(index + j, index + j) -= nde->_b[j];
m(parent_index + j, parent_index + j) -= nde->_a[j];
m(parent_index + j, index + j) += nde->_a[j];
m(index + j, parent_index + j) += nde->_b[j];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/nrnoc/membfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int _nrn_mechanism_access_index(const Node* node) {
}
double* _nrn_mechanism_get_matrix_elem(NrnThread* nt, int i, int j) {
OcSparseMatrix& m = *nt->_sp13mat;
return m.mep(i, j);
return m(i, j);
}
neuron::container::data_handle<double> _nrn_mechanism_get_area_handle(Node* node) {
if (node) {
Expand Down
10 changes: 5 additions & 5 deletions src/nrnoc/treeset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void update_sp13_mat_based_on_actual_d(NrnThread* nt) {
for (int i = 0; i < nt->end; ++i) {
const int index = nt->_v_node[i]->eqn_index_;
OcSparseMatrix& m = *nt->_sp13mat;
*m.mep(index - 1, index - 1) = nt->actual_d(i);
m(index - 1, index - 1) = nt->actual_d(i);
}
}

Expand Down Expand Up @@ -580,15 +580,15 @@ void nrn_lhs(neuron::model_sorted_token const& sorted_token, NrnThread& nt) {
// Update entries in sp13_mat
{
const int index = nd->eqn_index_;
*m.mep(index - 1, index - 1) -= nd_b;
m(index - 1, index - 1) -= nd_b;

// used to update NODED (sparse13 matrix) using NODEA and NODEB ("SoA")
Node* const parent_nd = _nt->_v_node[parent_i];
const int parent_index = parent_nd->eqn_index_;
*m.mep(parent_index - 1, parent_index - 1) -= nd_a;
m(parent_index - 1, parent_index - 1) -= nd_a;

*m.mep(parent_index - 1, index - 1) += nd_a;
*m.mep(index - 1, parent_index - 1) += nd_b; /* b may have value from lincir */
m(parent_index - 1, index - 1) += nd_a;
m(index - 1, parent_index - 1) += nd_b; /* b may have value from lincir */
}
// Also update the Node's d value in the SoA storage (is this needed?)
vec_d[i] -= nd_b;
Expand Down

0 comments on commit b2006ea

Please sign in to comment.