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

Fixes for new data structures #4

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 30 additions & 23 deletions Na12 Analysis/mechanisms/branching.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ VERBATIM
#ifndef _NrnThread
#define _NrnThread NrnThread
#endif
#ifdef NRN_MECHANISM_DATA_IS_SOA
#define get_nnode(sec) _nrn_mechanism_get_nnode(sec)
#define get_node(sec, node_index) _nrn_mechanism_get_node(sec, node_index)
#else
#define get_nnode(sec) sec->nnode
#define get_node(sec, node_index) sec->pnode[node_index]
#endif
ENDVERBATIM
PROCEDURE init_files(){
VERBATIM {
Expand All @@ -30,13 +37,13 @@ Section* sec;
Node* nd;
sec = chk_access();
if (_lx < 0. || _lx > 1.) {
//printf("_lx is %f and _lx*(double)(sec->nnode-1) is %f\n",_lx,_lx*(double)(sec->nnode-1));
//printf("_lx is %f and _lx*(double)(get_nnode(sec)-1) is %f\n",_lx,_lx*(double)(get_nnode(sec)-1));
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
return NODEA(nd);
}
Expand All @@ -51,13 +58,13 @@ Section* sec;
Node* nd;
sec = chk_access();
if (_lx < 0. || _lx > 1.) {
//printf("_lx is %f and _lx*(double)(sec->nnode-1) is %f\n",_lx,_lx*(double)(sec->nnode-1));
//printf("_lx is %f and _lx*(double)(get_nnode(sec)-1) is %f\n",_lx,_lx*(double)(get_nnode(sec)-1));
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec) - 1)));
}
return NODEB(nd);
}
Expand All @@ -75,9 +82,9 @@ Section* sec;
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
//printf("index is %d,NODEA(nd) is %f _la is %f\n",nd->v_node_index,NODEA(nd),_la);
NODEA(nd) = _la;
Expand All @@ -96,9 +103,9 @@ Section* sec;
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
//printf("index is %d,NODEB(nd) is %f _lb is %f\n",nd->v_node_index,NODEB(nd),_lb);
NODEB(nd) = _lb;
Expand All @@ -124,19 +131,19 @@ fclose(fm);
}
ENDVERBATIM
}
PROCEDURE MyAdb() {
VERBATIM {
int ii;
#if defined(t)
_NrnThread* _nt = nrn_threads;
#endif
for(ii=0;ii<_nt->end;ii++){

printf("%d,%1.15f %1.15f %1.15f %1.15f\n",ii, _nt->_actual_a[ii],_nt->_actual_d[ii],_nt->_actual_b[ii],_nt->_actual_rhs[ii]);
}
}
ENDVERBATIM
}
:PROCEDURE MyAdb() {
:VERBATIM {
: int ii;
:#if defined(t)
: _NrnThread* _nt = nrn_threads;
:#endif
:for(ii=0;ii<_nt->end;ii++){
:
:printf("%d,%1.15f %1.15f %1.15f %1.15f\n",ii, _nt->_actual_a[ii],_nt->_actual_d[ii],_nt->_actual_b[ii],_nt->_actual_rhs[ii]);
:}
:}
:ENDVERBATIM
:}

PROCEDURE PrintRHS_D() {
VERBATIM {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ For additional information, please contact [email protected] or henry.kyoung@uc

## Changelog
2023-02-28: updated for C++ compatibility (NEURON 9+)
2023-04-20: updated for SoA data compatibility (NEURON 9+)
59 changes: 34 additions & 25 deletions Ri Increase/mechanisms/branching.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ ENDCOMMENT
NEURON { SUFFIX nothing }

VERBATIM

#ifndef _NrnThread
#define _NrnThread NrnThread
#endif
#ifdef NRN_MECHANISM_DATA_IS_SOA
#define get_nnode(sec) _nrn_mechanism_get_nnode(sec)
#define get_node(sec, node_index) _nrn_mechanism_get_node(sec, node_index)
#else
#define get_nnode(sec) sec->nnode
#define get_node(sec, node_index) sec->pnode[node_index]
#endif
ENDVERBATIM
PROCEDURE init_files(){
VERBATIM {
Expand All @@ -28,13 +37,13 @@ Section* sec;
Node* nd;
sec = chk_access();
if (_lx < 0. || _lx > 1.) {
//printf("_lx is %f and _lx*(double)(sec->nnode-1) is %f\n",_lx,_lx*(double)(sec->nnode-1));
//printf("_lx is %f and _lx*(double)(get_nnode(sec)-1) is %f\n",_lx,_lx*(double)(get_nnode(sec)-1));
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
return NODEA(nd);
}
Expand All @@ -49,13 +58,13 @@ Section* sec;
Node* nd;
sec = chk_access();
if (_lx < 0. || _lx > 1.) {
//printf("_lx is %f and _lx*(double)(sec->nnode-1) is %f\n",_lx,_lx*(double)(sec->nnode-1));
//printf("_lx is %f and _lx*(double)(get_nnode(sec)-1) is %f\n",_lx,_lx*(double)(get_nnode(sec)-1));
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec) - 1)));
}
return NODEB(nd);
}
Expand All @@ -73,9 +82,9 @@ Section* sec;
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
//printf("index is %d,NODEA(nd) is %f _la is %f\n",nd->v_node_index,NODEA(nd),_la);
NODEA(nd) = _la;
Expand All @@ -94,9 +103,9 @@ Section* sec;
hoc_execerror("out of range, must be 0 < x <= 1", (char*)0);
}
if (_lx == 1.) {
nd = sec->pnode[sec->nnode-1];
nd = get_node(sec, get_nnode(sec) - 1);
}else{
nd = sec->pnode[(int) (_lx*(double)(sec->nnode-1))];
nd = get_node(sec, (int) (_lx*(double)(get_nnode(sec)-1)));
}
//printf("index is %d,NODEB(nd) is %f _lb is %f\n",nd->v_node_index,NODEB(nd),_lb);
NODEB(nd) = _lb;
Expand All @@ -122,19 +131,19 @@ fclose(fm);
}
ENDVERBATIM
}
PROCEDURE MyAdb() {
VERBATIM {
int ii;
#if defined(t)
_NrnThread* _nt = nrn_threads;
#endif
for(ii=0;ii<_nt->end;ii++){

printf("%d,%1.15f %1.15f %1.15f %1.15f\n",ii, _nt->_actual_a[ii],_nt->_actual_d[ii],_nt->_actual_b[ii],_nt->_actual_rhs[ii]);
}
}
ENDVERBATIM
}
:PROCEDURE MyAdb() {
:VERBATIM {
: int ii;
:#if defined(t)
: _NrnThread* _nt = nrn_threads;
:#endif
:for(ii=0;ii<_nt->end;ii++){
:
:printf("%d,%1.15f %1.15f %1.15f %1.15f\n",ii, _nt->_actual_a[ii],_nt->_actual_d[ii],_nt->_actual_b[ii],_nt->_actual_rhs[ii]);
:}
:}
:ENDVERBATIM
:}

PROCEDURE PrintRHS_D() {
VERBATIM {
Expand Down Expand Up @@ -235,4 +244,4 @@ fprintf(fm,"%d %1.15f %1.15f %1.15f %1.15f\n", ii, NODEB(nd), NODEA(nd), NODED(n
fclose (fm);
}
ENDVERBATIM
}
}