1 #include <../../nrnconf.h>
4 #define USE_MIN_DELAY 1
39 #include "utils/profile/profiler_interface.h"
47 #include <unordered_set>
52 #define lvardtloop(i, j) \
53 for (i = 0; i < nrn_nthread; ++i) \
54 for (j = 0; j < p[i].nlcv_; ++j)
57 #define PP2NT(pp) ((NrnThread*) ((pp)->_vnt))
58 #define PP2t(pp) (PP2NT(pp)->_t)
61 #define POINT_RECEIVE(type, tar, w, f) (*pnt_receive[type])(tar, w, f)
71 extern void nrn_cvfun(
double t,
double* y,
double* ydot);
73 #define nt_dt nrn_threads->_dt
74 #define nt_t nrn_threads->_t
127 #if COLLECT_TQueue_STATISTICS
129 return (stats[0] - stats[2]);
166 return ps->
dil_.size();
198 void ncs2nrn_inputevent(
int netcon_input_index,
double tdeliver);
211 void nrn2ncs_netcons();
315 sscanf(
buf,
"%d %d\n", &
type, &plr_index);
387 printf(
"NetCon from %s to ",
390 printf(
" weight index=%d\n", l);
431 if (
v ==
s->parentnode->v_handle()) {
434 for (
int i = 0;
i <
s->nnode; ++
i) {
435 if (
v ==
s->pnode[
i]->v_handle()) {
459 if (
v ==
s->parentnode->v_handle()) {
462 for (
int i = 0;
i <
s->nnode; ++
i) {
463 if (
v ==
s->pnode[
i]->v_handle()) {
470 obj = (*nrnpy_seg_from_sec_x)(
s, x);
492 obj = (*nrnpy_seg_from_sec_x)(d->
target_->
sec, x);
521 o = (
OcList*) ((*po)->u.this_pointer);
536 for (
const auto& nc: d->
src_->
dil_) {
551 for (
const auto& nc: ps->
dil_) {
552 if (nc->obj_ && nc->target_ == d->
target_) {
570 for (
const auto& nc: ps->
dil_) {
589 for (
const auto& nc: ps->
dil_) {
623 hoc_execerror(
"argument must be a point process or NULLobject", 0);
630 #if DISCRETE_EVENT_OBSERVER
639 #if DISCRETE_EVENT_OBSERVER
647 delete[] std::exchange(d->
weight_,
new double[d->
cnt_]);
676 double td =
chkarg(1, -1e20, 1e20);
682 const auto nrn_thread_not_initialized_for_nc_target = nt && nt >=
nrn_threads &&
684 nrn_assert(nrn_thread_not_initialized_for_nc_target);
690 hoc_execerror(
"Can only send fake self-events to ARTIFICIAL_CELLs", 0);
706 recid = (int) (*
getarg(3));
776 if (strcmp(
s->name,
"delay") == 0) {
780 }
else if (strcmp(
s->name,
"weight") == 0) {
783 s->arayinfo->sub[0] = d->
cnt_;
787 }
else if (strcmp(
s->name,
"x") == 0) {
788 static double dummy = 0.;
796 }
else if (strcmp(
s->name,
"threshold") == 0) {
808 Object *osrc =
nullptr, *otar;
814 hoc_execerror(
"if arg 1 is an object it must be a point process or NULLObject", 0);
817 psrc = hoc_hgetarg<double>(1);
822 hoc_execerror(
"arg 2 must be a point process or NULLobject", 0);
824 double thresh = -1.e9;
830 delay =
chkarg(4, 0, 1e15);
839 delete static_cast<NetCon*
>(
v);
849 s->arayinfo =
nullptr;
852 s->arayinfo =
nullptr;
855 s->arayinfo =
nullptr;
859 s->arayinfo->refcount = 1;
860 s->arayinfo->a_varn =
nullptr;
861 s->arayinfo->nsub = 1;
862 s->arayinfo->sub[0] = 1;
872 for (p1 =
s, p2 = b; *p1; ++p1, ++p2) {
897 return std::regex(
".*");
901 }
catch (std::regex_error&) {
913 Object *opre =
nullptr, *opost =
nullptr, *otar =
nullptr;
914 std::regex spre, spost, star;
941 b = std::regex_search(
s, spre);
943 }
else if (ps->osrc_) {
944 Object* presyn = ps->osrc_;
949 b = std::regex_search(
s, spre);
953 for (
const auto& d: ps->dil_) {
954 Object* postcell =
nullptr;
964 b = postcell == opost;
967 b = std::regex_search(
s, spost);
974 b = std::regex_search(
s, star);
1011 delete std::exchange(
tq_,
nullptr);
1012 delete std::exchange(
tqe_,
nullptr);
1013 delete std::exchange(
tpool_,
nullptr);
1018 delete std::exchange(
sepool_,
nullptr);
1023 delete[] std::exchange(
lcv_,
nullptr);
1033 Printf(
"interthread send td=%.15g DE type=%d thread=%d target=%d %s\n",
1071 Printf(
"interthread enqueue td=%.15g DE type=%d thread=%d target=%d %s\n",
1100 eps_ = 100. * UNIT_ROUNDOFF;
1124 prl_ =
new std::vector<PlayRecord*>();
1145 delete std::exchange(
mst_,
nullptr);
1148 std::for_each(ps->dil_.rbegin(), ps->dil_.rend(), [](
NetCon*& d) {
1150 delete std::exchange(d, nullptr);
1154 delete std::exchange(
psl_,
nullptr);
1156 delete std::exchange(
pst_,
nullptr);
1159 for (
auto& item: *
prl_) {
1162 delete std::exchange(
prl_,
nullptr);
1216 for (last = *first; last->
next; last = last->
next) {
1226 for (b = *first; b; b = bn) {
1266 delete std::exchange(
gcv_,
nullptr);
1274 delete[] std::exchange(d.
lcv_,
nullptr);
1277 delete std::exchange(d.
tq_,
nullptr);
1286 delete[] std::exchange(cv.
ctd_,
nullptr);
1295 for (
int j = 0;
j < d.
nlcv_; ++
j) {
1305 for (
int j = 0;
j < cv.
nctd_; ++
j) {
1309 delete std::exchange(z.
psl_th_,
nullptr);
1311 if (cvode !=
gcv_) {
1315 for (cml = std::exchange(z.
cv_memb_list_,
nullptr); cml; cml = cmlnext) {
1316 cmlnext = cml->
next;
1328 for (cml = cmlist; cml; cml = cmlnext) {
1329 cmlnext = cml->
next;
1330 for (
auto& ml: cml->
ml) {
1331 delete[] std::exchange(ml.nodelist,
nullptr);
1332 delete[] std::exchange(ml.nodeindices,
nullptr);
1333 delete[] std::exchange(ml.prop,
nullptr);
1335 delete[] std::exchange(ml.pdata,
nullptr);
1357 }
else if (ps->ssrc_) {
1358 nt = ps->ssrc_->pnode[0]->_nt;
1363 z = cvsrc->
ctd_ + nt->
id;
1373 }
else if (ps->ssrc_) {
1374 j = ps->ssrc_->pnode[0]->v_node_index;
1375 nt = ps->ssrc_->pnode[0]->_nt;
1380 if (tid == nt->
id) {
1381 cvsrc =
p[tid].
lcv_ + cellnum[
j];
1383 if (nt == cvsrc->
nth_) {
1495 cml->
next =
nullptr;
1496 auto const mech_offset = cache_token.thread_cache(_nt->id).mechanism_offset.at(
1500 cml->
ml[0].set_storage_offset(mech_offset);
1506 cml->
ml[0].prop = ml->
prop;
1553 if (_nt->
end == 0) {
1556 std::vector<int> cellnum(_nt->
end);
1560 for (
i = _nt->
ncell; i < _nt->end; ++
i) {
1567 z.rootnode_end_index_ =
i + 1;
1569 z.vnode_begin_index_ = 0;
1570 z.vnode_end_index_ = 0;
1572 for (
i = _nt->
ncell; i < _nt->end; ++
i) {
1575 if (!z.vnode_begin_index_) {
1578 if (z.vnode_end_index_ > 0) {
1579 assert(z.vnode_end_index_ ==
i);
1581 z.vnode_end_index_ =
i + 1;
1585 std::vector<CvMembList*> last(_nt->
ncell);
1590 std::unordered_set<int> ba_candidate;
1593 for (
auto const bat: batypes) {
1595 ba_candidate.insert(bam->type);
1618 mf.
state ||
i ==
CAP || ba_candidate.count(
i) == 1)) {
1628 int icell = cellnum[inode];
1638 cml->
next =
nullptr;
1642 }
else if (last[icell]->
index !=
i) {
1644 last[icell]->next = cml;
1645 cml->
next =
nullptr;
1651 auto& cvml = cml->
ml.back();
1652 auto cvml_offset = cvml.get_storage_offset() + cvml.nodecount;
1653 if (cvml_offset != offset) {
1656 cml->
ml.emplace_back(cml->
index);
1657 assert(cml->
ml.back().nodecount == 0);
1664 auto& cvml = cml->
ml.back();
1665 if (cvml.nodecount == 0) {
1666 cvml.set_storage_offset(offset);
1674 std::vector<CvMembList*> cvml(d.
nlcv_);
1685 mf.
state ||
i ==
CAP || ba_candidate.count(
i) == 1)) {
1689 if (cvml[icell]->
index !=
i) {
1690 cvml[icell] = cvml[icell]->next;
1693 auto& cml = cvml[icell];
1695 for (
auto& newml: cml->
ml) {
1696 if (!newml.nodelist) {
1712 assert(cellnum[newml.nodeindices[
k]] ==
1714 newml.prop[
k] = ml->
prop[
j +
k];
1743 pp->nvi_ = d.
lcv_ + cellnum[inode];
1757 for (tbl = nt->
tbl[bat]; tbl; tbl = tbl->
next) {
1760 ba->
ml.push_back(tbl->
ml);
1773 for (
int icv = 0; icv < d.
nlcv_; ++icv) {
1777 if (cml->index == bam->
type) {
1780 for (
auto& ml: cml->ml) {
1781 bl->
ml.push_back(&ml);
1802 for (ba = *pbml; ba; ba = ba->
next) {
1957 while (
p[0].tqe_->least_t() <= tout &&
stoprun == 0) {
1960 (*nrn_allthread_handle)();
1967 if (
p[0].tqe_->least()) {
1974 (*nrn_allthread_handle)();
1982 (*nrn_allthread_handle)();
1997 (*nrn_allthread_handle)();
2007 time_t rt = time(
nullptr);
2015 (*nrn_allthread_handle)();
2022 if (rt < time(
nullptr)) {
2035 for (
int i = 0;
i <
n; ++
i) {
2049 (*nrn_allthread_handle)();
2075 de->
pr(
"deliver", tt,
this);
2090 de->
pr(
"deliver", tt,
this);
2102 auto*
const nt = &ntr;
2120 double tdiff = tt -
gcv_->
t_;
2130 if (
p[0].tqe_->least_t() <
gcv_->
t_) {
2174 }
else if (te <=
tn_) {
2176 }
else if (
t_ <
tn_) {
2195 if (tt <
PP2t(pnt)) {
2219 Sprintf(
buf,
"artcell_net_move tt-nt_t = %g", tt - nt->
_t);
2224 if (tt <
p.immediate_deliver_) {
2241 Printf(
"NetCvode::move_event self event target %s t=%g, old=%g new=%g\n",
2267 ++
p.unreffed_event_cnt_;
2294 ++
p.unreffed_event_cnt_;
2301 TQItem*
q =
p.selfqueue_->insert(se);
2305 if (
q->t_ <
p.immediate_deliver_) {
2309 p.selfqueue_->remove(
q);
2330 if (time <
PP2t(pnt)) {
2359 for (
auto wc1: *wl) {
2361 if (wc1->qthresh_) {
2363 wc1->qthresh_ =
nullptr;
2438 if (!d[
i].get<WatchCondition*>()) {
2459 for (
auto* wl: htlists_of_thread) {
2471 int nn = offset +
n;
2472 if (
auto* d_offset = d[offset].get<WatchList*>(); d_offset) {
2474 d[offset] =
nullptr;
2476 for (
i = offset + 1;
i < nn; ++
i) {
2477 if (
auto* wc = d[
i].get<WatchCondition*>(); wc) {
2496 #define fifo_event event
2502 db->
pr(
"binq send", td,
this);
2515 db->
pr(
"send", td,
this);
2525 db->
pr(
"send", td,
this);
2539 if (tt - nt->
_t < 0) {
2546 if (!ppobj && tt -
nt_t < 0) {
2580 HocEvent* he = (*allthread_hocevents_)[0];
2593 for (
i = 0;
i <
n; ++
i) {
2631 static PPArgs* ppargs;
2633 static void point_receive_job(
NrnThread* nt) {
2634 PPArgs*
p = ppargs + nt->
id;
2641 int id =
PP2NT(pp)->id;
2646 PPArgs*
p = ppargs +
id;
2739 delete std::exchange(d.
sepool_,
nullptr);
2741 delete std::exchange(d.
tqe_,
nullptr);
2744 delete std::exchange(d.
tpool_,
nullptr);
2764 ps->use_min_delay_ = 0;
2770 if (dil.size() > 2) {
2771 ps->use_min_delay_ = 1;
2772 ps->delay_ = dil[0]->delay_;
2777 for (
const auto& d: dil) {
2778 if (ps->use_min_delay_ && ps->delay_ != d->delay_) {
2779 ps->use_min_delay_ =
false;
2796 int type = d->target_->prop->_type;
2801 for (
j = d->cnt_ - 1;
j > 0; --
j) {
2827 for (
const auto& d:
dil_) {
2828 if (md > d->delay_) {
2873 switch (d->
type()) {
2876 auto* nc =
static_cast<NetCon*
>(d);
2891 auto* ps =
static_cast<PreSyn*
>(d);
2892 for (
const auto& nc:
reverse(ps->dil_)) {
2893 double td = nc->
delay_ - ps->delay_;
2922 ns->
event(tt,
this, nt);
2938 Printf(
"%s DiscreteEvent %.15g\n",
s, tt);
2954 std::string ss(
"net-receive-");
2965 while ((
q = datum.get<
TQItem*>()) &&
q->t_ < tt) {
2985 hoc_warning(
"errno set during NetCon deliver to NET_RECEIVE", (
char*) 0);
3001 hoc_warning(
"errno set during NetCon deliver to NET_RECEIVE", (
char*) 0);
3031 for (
const auto& d:
dil_) {
3032 if (d->active_ && d->target_) {
3043 #if USENCS || NRNMPI
3084 Printf(
"warning: cv->handle_step failed with error %d", err);
3094 for (
const auto& d:
dil_) {
3095 if (d->active_ && d->target_ &&
PP2NT(d->target_) == nt) {
3096 double dtt = d->delay_ -
delay_;
3100 d->deliver(tt, ns, nt);
3101 }
else if (dtt < 0.) {
3102 hoc_execerror(
"internal error: Source delay is > NetCon delay", 0);
3105 ns->
event(tt + dtt, d, nt);
3115 for (
const auto& d:
dil_) {
3116 if (d->active_ && d->target_ &&
PP2NT(d->target_) == nt) {
3117 double dtt = d->delay_ -
delay_;
3138 for (
const auto& d:
dil_) {
3139 if (d->active_ && d->target_) {
3140 double dtt = d->delay_ -
delay_;
3142 hoc_execerror(
"internal error: Source delay is > NetCon delay", 0);
3145 ns->
event(tt + dtt, d, nt);
3179 int ppindex, ncindex, moff, pptype;
3183 sscanf(
buf,
"%s %d %d %d %d %lf\n", ppname, &ppindex, &pptype, &ncindex, &moff, &flag) ==
3203 sepp_->reserve(211);
3217 return iter->second;
3236 "%s %d %d %d %d %g\n",
3286 hoc_warning(
"errno set during SelfEvent deliver to NET_RECEIVE", (
char*) 0);
3317 Printf(
"%s PlayRecordEvent %.15g ",
s, tt);
3349 he->
stmt_ =
nullptr;
3385 "multiple threads and/or local variable time step method require an "
3386 "appropriate POINT_PROCESS arg to CVode.event to safely execute:",
3466 nc->
event(tt, he, nt);
3471 int have_stmt, have_obj,
index;
3472 char stmt[256], objname[100],
buf[200];
3476 nrn_assert(sscanf(
buf,
"%d %d\n", &have_stmt, &have_obj) == 2);
3510 Printf(
"microstep local retreat from %g (cvode_%p is at %g) for event onset=%g\n",
3521 Printf(
"after target solve time for %p is %g , dt=%g\n",
3539 Printf(
"microstep retreat from %g (cvode_%p is at %g) for event onset=%g\n",
3552 Printf(
"after target solve time for %p is %g , dt=%g\n", fmt::ptr(cv), cv->
time(),
dt);
3586 while (
p[0].tqe_->least_t() == tt) {
3599 (*nrn_allthread_handle)();
3646 if (nrnmpi_pgvts_least(&tt, &op, &
init)) {
3650 }
else if (op == 4) {
3652 }
else if (ts == tt &&
q && ops == op) {
3692 return gcv_->use_partrans_;
3719 int n = (int) ((tstop -
nt_t) /
dt + 1e-9);
3725 #if NRNMPI && !defined(USENCS)
3729 while (
nt_t <= ts) {
3731 ts = tstop - .5 *
dt;
3766 for (q1 = sq->
first(); q1; q1 = q2) {
3796 void ncs2nrn_inputevent(
int i,
double tdeliver) {
3804 void nrn2ncs_netcons() {
3811 if (ncs2nrn_input_) {
3812 for (
i = 0;
i < ncs2nrn_input_->count(); ++
i) {
3815 ncs2nrn_input_->remove_all();
3819 for (
i = 0;
i < list->
count(); ++
i) {
3822 ncs2nrn_input_->append(nc);
3828 for (
i = 0;
i < list->
count(); ++
i) {
3843 if (
i < 0 ||
ii++ ==
i) {
3848 Printf(
"NetCon active=%lu (not sent)=%lu delivered=%lu\n",
3853 "Condition O2 thresh detect=%lu via init=%lu effective=%lu abandoned=%lu (unnecesarily=%lu "
3854 "init+=%lu init-=%lu above=%lu below=%lu)\n",
3864 Printf(
"PreSyn send: mindelay=%lu direct=%lu\n",
3867 Printf(
"PreSyn deliver: O2 thresh=%lu NetCon=%lu (send=%lu deliver=%lu)\n",
3872 Printf(
"SelfEvent send=%lu move=%lu deliver=%lu\n",
3876 Printf(
"Watch send=%lu deliver=%lu\n",
3879 Printf(
"PlayRecord send=%lu deliver=%lu\n",
3882 Printf(
"HocEvent send=%lu deliver=%lu\n",
3885 Printf(
"SingleEvent deliver=%lu move=%lu\n",
3888 Printf(
"DiscreteEvent send=%lu deliver=%lu\n",
3892 Printf(
"Discrete event TQueue\n");
3895 Printf(
"Variable step integrator TQueue\n");
3973 double dtsav =
nt_dt;
4015 for (
j = 0;
j < m->nodecount; ++
j) {
4018 void**
v = &(m->pdata[
j][
index].literal_value<
void*>());
4027 for (tml = nt->
tml; tml; tml = tml->
next)
4046 for (
const auto& d1: dil) {
4048 if (pnt && t2i[pnt->
prop->
_type] > -1) {
4063 for (
j = 0;
j < m->nodecount; ++
j) {
4065 if (fnc->size > 0) {
4066 fnc->
argslist =
new double*[fnc->size];
4072 for (tml = nt->
tml; tml; tml = tml->
next)
4078 if (fnc->size > 0) {
4079 fnc->
argslist =
new double*[fnc->size];
4090 for (
const auto& d1: dil) {
4092 if (pnt && t2i[pnt->
prop->
_type] > -1) {
4095 fnc->
argslist[fnc->size] = d1->weight_;
4106 *argslist = fnc->argslist;
4112 delete[] std::exchange(fnc->argslist,
nullptr);
4124 if (!
prl_->empty()) {
4134 for (
auto& item: *
prl_) {
4135 item->record_init();
4140 for (
auto& item: *
prl_) {
4146 int NetCvode::cellindex() {
4242 if (
s->size() !=
size_t(d->
gcv_->
neq_)) {
4243 hoc_execerror(
"size of state vector != number of state equations", 0);
4259 if (
s->size() !=
size_t(d->
gcv_->
neq_)) {
4260 hoc_execerror(
"size of state vector != number of state equations", 0);
4363 hdp.append(
static_cast<double*
>(z.
pv_[
j]));
4371 for (
int j = 0;
j < neq; ++
j) {
4372 hdp.append(
static_cast<double*
>(pv[
j]));
4384 auto const n = [&]() {
4397 hoc_execerror(
"Cvode::statename argument out of range",
nullptr);
4399 auto const impl = [hdp =
create_hdp(style), style,
this](
auto&
handle) -> std::string {
4400 auto*
const raw_ptr =
static_cast<double*
>(
handle);
4402 auto* sym = hdp.retrieve_sym(raw_ptr);
4406 std::string
s = hdp.retrieve(raw_ptr);
4407 return !
s.empty() ?
s.c_str() :
"unknown";
4415 return impl(z.
pv_[is -
j]);
4422 if (
j +
p[it].lcv_[
i].neq_ > is) {
4424 return impl(z.
pv_[is -
j]);
4434 static char buf[200];
4443 std::vector<char>
buf(strlen(
name) + 1);
4446 for (cp =
buf.data(); *cp; ++cp) {
4457 if (sym && *cp ==
'\0' && (sym->
type == RANGEVAR || strcmp(sym->
name,
"Vector") == 0)) {
4459 }
else if (sym && sym->
type == TEMPLATE && *cp !=
'\0') {
4476 if ((
stiff_ == 0) != (x == 0)) {
4568 psl_ =
new std::vector<PreSyn*>();
4585 auto psti =
pst_->find(psrc);
4586 if (psti ==
pst_->end()) {
4587 ps =
new PreSyn(psrc, osrc, ssrc);
4588 psl_->push_back(ps);
4602 ps =
new PreSyn(psrc, osrc, ssrc);
4606 psl_->push_back(ps);
4609 }
else if (target) {
4626 psl_ =
new std::vector<PreSyn*>();
4628 psl_->push_back(ps);
4637 if (it !=
psl_->end()) {
4651 for (
int it = 0; it <
gcv_->
nctd_; ++it) {
4654 for (
size_t j = 0;
j < psl->size(); ++
j) {
4655 if ((*psl)[
j] == ps) {
4656 psl->erase(psl->begin() +
j);
4666 for (
size_t j = 0;
j < psl->size(); ++
j) {
4667 if ((*psl)[
j] == ps) {
4668 psl->erase(psl->begin() +
j);
4683 hoc_execerror(
"DiscreteEvent::savestate_save:",
" is not the null_event_");
4690 Printf(
"null_event_ onto queue\n");
4711 if (target ==
nullptr) {
4721 #if DISCRETE_EVENT_OBSERVER
4731 for (
int i = 0;
i <
cnt_; ++
i) {
4744 #if DISCRETE_EVENT_OBSERVER
4758 delete std::exchange(
src_,
nullptr);
4819 delete std::exchange(
wtable_,
nullptr);
4820 delete std::exchange(
idxtable_,
nullptr);
4857 (*idxtable_)[obj->
index] = nc;
4883 }
else if (ps->
ssrc_) {
4892 if (!
p[
i].psl_thr_) {
4905 if (
p[
i].psl_thr_) {
4919 delete[] std::exchange(
p,
nullptr);
4925 for (
i = 0;
i <
n; ++
i) {
4931 : thvar_{std::
move(src)} {
4957 #if 1 || USENCS || NRNMPI
4961 bgp.multisend_send_ = 0;
4966 #if DISCRETE_EVENT_OBSERVER
4979 delete std::exchange(
stmt_,
nullptr);
4980 #if DISCRETE_EVENT_OBSERVER
4991 #if DISCRETE_EVENT_OBSERVER
5002 for (
const auto& d:
dil_) {
5043 delete std::exchange(
idxtable_,
nullptr);
5051 (*idxtable_)[ps->hi_index_] = ps;
5056 PreSyn* ps = idxti->second;
5075 delete std::exchange(
stmt_,
nullptr);
5076 if (strlen(stmt) > 0) {
5082 delete std::exchange(
stmt_,
nullptr);
5089 #if DISCRETE_EVENT_OBSERVER
5100 #if DISCRETE_EVENT_OBSERVER
5152 for (
const auto& d:
dil_) {
5162 #if DISCRETE_EVENT_OBSERVER
5168 #if DISCRETE_EVENT_OBSERVER
5180 if (
value() > 0.0) {
5181 if (
flag_ ==
false) {
5213 double val =
value();
5214 if (
flag_ ==
false && val >= 0.0) {
5217 if (cv->
t0_ == cv->
tn_) {
5231 th = th * nt->
_t + (1. - th) *
told_;
5260 Printf(
"abandon when t == qthresh_->t_ = %20.15g\n",
nt_t);
5262 if (cv->
t0_ == cv->
tn_) {
5263 if (
value() > 0.0) {
5269 if (
value() > 0.0) {
5311 wl =
new HTList(
nullptr);
5348 hoc_warning(
"errno set during WatchCondition deliver to NET_RECEIVE", (
char*) 0);
5357 std::unique_ptr<HocCommand> hc) {
5370 &
stec_->thread()->_t};
5372 if (
stec_->qthresh_) {
5380 if (
stec_->qthresh_) {
5382 stec_->qthresh_ =
nullptr;
5439 hoc_warning(
"errno set during WatchCondition deliver to NET_RECEIVE", (
char*) 0);
5455 hoc_warning(
"errno set during STECondition pgvts_deliver to NET_RECEIVE", (
char*) 0);
5484 ps->condition(
this);
5489 item = item->
Next()) {
5513 ps->check(nt, nt->
_t);
5518 item = item->
Next()) {
5528 if (
pr->ith_ == nt.
id) {
5529 pr->continuous(nt.
_t);
5536 if (
pr->ith_ == nt->
id) {
5537 pr->continuous(nt->
_t);
5565 int cur_size =
v->size();
5566 if (
v->buffer_size() < bsize + cur_size) {
5567 v->buffer_size(bsize + cur_size);
5570 v->resize(bsize + cur_size);
5574 pvars[i_trajec] =
static_cast<double*
>(pd);
5577 if (
static_cast<double const*
>(pd) == &nt.
_t) {
5578 types[i_trajec] = 0;
5579 indices[i_trajec] = 0;
5584 "Pointer %p of PlayRecord type %d ignored because not a Range Variable",
5585 fmt::ptr(
static_cast<double*
>(pd)),
5615 double**& varrays) {
5632 for (
auto&
pr: *fr) {
5633 if (
pr->ith_ == tid) {
5657 for (
int j = 0;
j < gvr->
count(); ++
j) {
5670 vpr =
new void*[n_pr];
5671 types =
new int[n_trajec];
5672 indices =
new int[n_trajec];
5674 varrays =
new double*[n_trajec];
5676 pvars =
new double*[n_trajec];
5681 for (
auto&
pr: *fr) {
5683 if (
pr->ith_ == tid) {
5726 if (bsize && !glr->
v_) {
5750 if (bsize &&
v ==
nullptr) {
5780 for (
int j = 0;
j < gvr->
count(); ++
j) {
5810 if (n_trajec == 0) {
5812 delete[] std::exchange(types,
nullptr);
5813 delete[] std::exchange(indices,
nullptr);
5814 delete[] std::exchange(vpr,
nullptr);
5815 delete[] std::exchange(varrays,
nullptr);
5816 delete[] std::exchange(pvars,
nullptr);
5819 printf(
"nrnthread_get_trajectory_requests tid=%d bsize=%d n_pr=%d n_trajec=%d\n", tid, bsize, n_pr, n_trajec);
5822 for (
int i=0;
i < n_pr; ++
i) {
5826 printf(
" %d %d prtype=%d %p type=%d index=%d\n",
i, i_trajec,
pr->type(), pd, types[i_trajec], indices[i_trajec]);
5832 i_trajec += ed.size();
5853 for (
int i = 0;
i < n_pr; ++
i) {
5863 oc.
run(
"screen_update()\n");
5890 for (
int i = 0;
i < n_pr; ++
i) {
5896 v->resize(
v->size() - (bsize - vecsz));
5899 v->resize(
v->size() - (bsize - vecsz));
5903 glr->
plot(vecsz, tt);
5923 if (ps->
nt_ == nt) {
5941 void (*cb)(
int,
int,
int,
int,
int));
5949 for (
HTList* wl: htlists_of_thread) {
5968 tm = nt->
_t + 0.5 * nt->
_dt;
5989 extern bool nrn_use_compress_;
5994 while ((
q =
p[tid].tqe_->dequeue_bin()) != 0) {
5998 db->
pr(
"binq deliver",
nt_t,
this);
6010 if (
p[tid].tqe_->top()) {
6046 for (
auto& item: *
prl_) {
6047 if (item->uses(
v)) {
6055 : pd_{std::
move(pd)} {
6286 auto*
const ptr =
static_cast<double*
>(
pd_);
6296 auto const pd = hoc_hgetarg<double>(1);
6301 bool discrete = ((
ifarg(4) && (int)
chkarg(4, 0, 1) == 1) ?
true :
false);
6328 std::vector<PlayRecord*> to_delete{};
6334 to_delete.push_back(
pr);
6357 hoc_execerror(
"We were unable to associate a PlayRecord item with a RANGE variable",
6367 hoc_execerror(
"We were unable to associate a PlayRecord item with a thread",
nullptr);
6371 for (
auto*
pr: to_delete) {
6393 auto* pd =
static_cast<double const*
>(
handle);
6395 for (
p = nd->
prop;
p;
p =
p->next) {
6424 for (in = i1; in < i3; ++in) {
6435 auto* pd =
static_cast<double const*
>(
handle);
6452 for (in = -1; in <
sec->nnode; ++in) {
6454 nd =
sec->parentnode;
6459 nd =
sec->pnode[in];
6465 auto*
const pd =
static_cast<double const*
>(
handle);
6466 for (
p = nd->
prop;
p;
p =
p->next) {
6480 " pointer not associated with currently accessed section\n\
6481 Use section ... (&var(x)...) intead of ...(§ion.var(x)...)\n");
6486 int on = (int)
chkarg(1, 0, 2);
6503 double* pamax = &
dummy;
6528 getacor = (int)
chkarg(2, 0, 1);
6564 for (
j = 0;
j <
n; ++
j) {
6565 sym = hdp.retrieve_sym(
static_cast<double*
>(z.
pv_[
j]));
6566 auto msti =
mst_->find((
void*) sym);
6568 if (msti ==
mst_->end()) {
6573 (*mst_)[(
void*) sym] = msi;
6580 if (msi->
amax_ < ma[
j]) {
6596 for (
auto ti: *
mst_) {
6619 auto msti =
mst_->find((
void*) sym);
6620 if (msti !=
mst_->end()) {
6621 *pamax = msti->second->amax_;
6622 return msti->second->max_;
6632 auto*
const nt = &ntr;
6654 for (
int i = 0;
i <
n; ++
i) {
6674 (*nrn_allthread_handle)();
6687 (*nrn_allthread_handle)();
6695 (*nrn_allthread_handle)();
6710 (*nrn_allthread_handle)();
6724 while (
nt_t < tout) {
6727 (*nrn_allthread_handle)();
6741 "presently limited to single thread.");
6760 de->
pr(
"deliver", tt, nc);
6783 double tdiff = tt -
gcv_->
t_;
6813 double tt, min = 1e50;
6822 for (
int id = 0;
id <
pcnt_; ++
id) {
ReceiveFunc * pnt_receive
const char * secname(Section *sec)
name of section (for use in error messages)
void nrn_pushsec(Section *sec)
void nrn_parent_info(Section *s)
double nrn_arc_position(Section *sec, Node *node)
void setup_topology(void)
int nrn_sec2cell_equals(Section *sec, Object *obj)
static unsigned long abandon_
static unsigned long deliver_qthresh_
virtual void check(NrnThread *, double sendtime, double teps=0.0)
static unsigned long send_qthresh_
virtual ~ConditionEvent()
void abandon_statistics(Cvode *)
static unsigned long init_above_
static unsigned long abandon_above_
static unsigned long abandon_init_above_
static unsigned long eq_abandon_
static unsigned long abandon_below_
static unsigned long abandon_init_below_
virtual int handle_step(neuron::model_sorted_token const &, NetCvode *, double)
void record_add(PlayRecord *)
void play_add(PlayRecord *)
void check_deliver(NrnThread *nt=0)
void fun_thread(neuron::model_sorted_token const &, double t, double *y, double *ydot, NrnThread *nt)
void evaluate_conditions(NrnThread *nt=0)
virtual int init(double t)
double * n_vector_data(N_Vector, int)
virtual int interpolate(double t)
void activate_maxstate(bool)
bool is_owner(neuron::container::data_handle< double > const &)
void scatter_y(neuron::model_sorted_token const &, double *, int)
void error_weights(double *)
virtual int advance_tn(neuron::model_sorted_token const &)
virtual ~CvodeThreadData()
int nonvint_extra_offset_
std::vector< double * > pv_
CvMembList * cv_memb_list_
void delete_memb_list(CvMembList *)
CvMembList * no_cap_memb_
BAMechList * before_breakpoint_
BAMechList * after_solve_
int rootnode_begin_index_
std::vector< PlayRecord * > * record_
BAMechList * before_step_
std::vector< PlayRecord * > * play_
virtual DiscreteEvent * savestate_save()
virtual void pr(const char *, double t, NetCvode *)
virtual void savestate_write(FILE *)
virtual void deliver(double t, NetCvode *, NrnThread *)
static unsigned long discretevent_send_
static unsigned long discretevent_deliver_
static DiscreteEvent * savestate_read(FILE *)
virtual void pgvts_deliver(double t, NetCvode *)
virtual void send(double deliverytime, NetCvode *, NrnThread *)
virtual void savestate_restore(double deliverytime, NetCvode *)
virtual int pgvts_op(int &i)
virtual void frecord_init(TQItem *)
virtual NrnThread * thread()
GLineRecordEData pd_and_vec_
neuron::container::data_handle< double > pdata(int)
int execute(bool notify=true)
static DiscreteEvent * savestate_read(FILE *)
static HocEvent * alloc(const char *stmt, Object *, int, Object *pyact=nullptr)
virtual void savestate_restore(double deliverytime, NetCvode *)
virtual void allthread_handle()
static unsigned long hocevent_deliver_
virtual void deliver(double, NetCvode *, NrnThread *)
virtual void savestate_write(FILE *)
virtual void pr(const char *, double t, NetCvode *)
virtual DiscreteEvent * savestate_save()
static HocEventPool * hepool_
static unsigned long hocevent_send_
virtual void pgvts_deliver(double t, NetCvode *)
static unsigned long singleevent_deliver_
static unsigned long singleevent_move_
static bool eq2(double x, double y, double e)
static bool eq(T x, T y, T e)
virtual void pr(const char *, double t, NetCvode *)
virtual NrnThread * thread()
virtual void deliver(double, NetCvode *, NrnThread *)
void replace_src(PreSyn *)
static unsigned long netcon_send_active_
virtual void disconnect(Observable *)
virtual DiscreteEvent * savestate_save()
virtual void send(double sendtime, NetCvode *, NrnThread *)
NetCon(PreSyn *src, Object *target)
static DiscreteEvent * savestate_read(FILE *)
static unsigned long netcon_deliver_
static unsigned long netcon_send_inactive_
virtual void pgvts_deliver(double t, NetCvode *)
static NetCon * weight2netcon(double *)
static NetCon * index2netcon(long)
virtual void savestate_restore(double deliverytime, NetCvode *)
virtual void savestate_write(FILE *)
static NetConSaveWeightTable * wtable_
static NetConSaveIndexTable * idxtable_
std::vector< PreSyn * > * psl_
TQItem * bin_event(double tdeliver, DiscreteEvent *, NrnThread *)
double state_magnitudes()
void ps_thread_link(PreSyn *)
std::string statename(int, int style=1)
void deliver_events(double til, NrnThread *)
double allthread_least_t(int &tid)
int pgvts_event(double &tt)
BAMechList * cvbml(int, BAMech *, Cvode *)
HocEventList * allthread_hocevents_
void deliver_least_event(NrnThread *)
static double eps(double x)
void local_retreat(double, Cvode *)
IvocVect * vec_event_store_
void check_thresh(NrnThread *)
void playrec_add(PlayRecord *)
std::vector< PlayRecord * > * prl_
void retreat(double, Cvode *)
int owned_by_thread(neuron::container::data_handle< double > const &)
std::vector< PlayRecord * > * playrec_list()
DiscreteEvent * pgvts_least(double &tt, int &op, int &init)
HocDataPaths create_hdp(int style)
Create a lookup table for variable names.
std::vector< PlayRecord * > * fixed_record_
void deliver_net_events(NrnThread *)
void fixed_record_continuous(neuron::model_sorted_token const &, NrnThread &nt)
int pgvts_cvode(double tt, int op)
const char * sym2name(Symbol *)
int fornetcon_change_cnt_
int solve_when_threads(double)
void point_receive(int, Point_process *, double *, double)
std::vector< PlayRecord * > * fixed_play_
void consist_sec_pd(const char *, Section *, neuron::container::data_handle< double > const &)
void fill_local_ba_cnt(int, int *, NetCvodeThreadData &)
NetCvode(bool single=true)
void maxstate_analyze_1(int, Cvode &, CvodeThreadData &)
void distribute_dinfo(int *, int)
void fill_global_ba(NrnThread *, int, BAMechList **)
MUTDEC void set_enqueueing()
void remove_event(TQItem *, int threadid)
void playrec_remove(PlayRecord *)
void psl_append(PreSyn *)
void presyn_disconnect(PreSyn *)
int global_microstep_when_threads()
void hoc_event(double, const char *hoc_stmt, Object *ppobj=nullptr, int reinit=0, Object *pyact=nullptr)
void re_init(double t0=0.)
void fill_local_ba(int *, NetCvodeThreadData &)
int local_microstep(neuron::model_sorted_token const &, NrnThread &)
TQueue * event_queue(NrnThread *nt)
void move_event(TQItem *, double, NrnThread *)
bool deliver_event(double til, NrnThread *)
void deliver_events_when_threads(double)
Symbol * name2sym(const char *)
void allthread_handle(double, HocEvent *, NrnThread *)
int playrec_item(PlayRecord *)
void fixed_play_continuous(NrnThread *)
NetCon * install_deliver(neuron::container::data_handle< double > psrc, Section *ssrc, Object *osrc, Object *target, double threshold, double delay, double weight)
int structure_change_cnt_
PlayRecord * playrec_uses(void *)
TQItem * event(double tdeliver, DiscreteEvent *, NrnThread *)
virtual ~NetCvodeThreadData()
double immediate_deliver_
void interthread_send(double, DiscreteEvent *, NrnThread *)
InterThreadEvent * inter_thread_events_
void enqueue(NetCvode *, NrnThread *)
static void Detach(Object *, Observer *)
static void Attach(Object *, Observer *)
int run(int argc, const char **argv)
virtual void deliver(double, NetCvode *, NrnThread *)
virtual void frecord_init(TQItem *q)
static unsigned long playrecord_send_
virtual ~PlayRecordEvent()
static DiscreteEvent * savestate_read(FILE *)
virtual NrnThread * thread()
virtual void savestate_restore(double deliverytime, NetCvode *)
virtual void pr(const char *, double t, NetCvode *)
static unsigned long playrecord_deliver_
virtual void savestate_write(FILE *)
virtual DiscreteEvent * savestate_save()
static PlayRecordSave * savestate_read(FILE *)
neuron::container::data_handle< double > pd_
PlayRecord(neuron::container::data_handle< double > pd, Object *ppobj=nullptr)
virtual void frecord_init(TQItem *)
virtual void disconnect(Observable *)
virtual PlayRecordSave * savestate_save()
virtual PlayRecordEvent * event()
virtual void deliver(double t, NetCvode *)
virtual void savestate_read(FILE *)
PlayRecordSave(PlayRecord *)
virtual ~PlayRecordSave()
virtual void pr(const char *, double t, NetCvode *)
static unsigned long presyn_send_direct_
virtual void send(double sendtime, NetCvode *, NrnThread *)
void update(Observable *)
static unsigned long presyn_deliver_ncsend_
void record_stmt(const char *)
void fanout(double, NetCvode *, NrnThread *)
PreSyn(neuron::container::data_handle< double > src, Object *osrc, Section *ssrc=nullptr)
void record(IvocVect *, IvocVect *idvec=nullptr, int rec_id=0)
virtual void deliver(double, NetCvode *, NrnThread *)
virtual NrnThread * thread()
static unsigned long presyn_deliver_direct_
virtual void pgvts_deliver(double t, NetCvode *)
static DiscreteEvent * savestate_read(FILE *)
virtual DiscreteEvent * savestate_save()
void disconnect(Observable *)
neuron::container::data_handle< double > thvar_
static unsigned long presyn_deliver_netcon_
static unsigned long presyn_send_mindelay_
virtual void savestate_write(FILE *)
virtual void savestate_restore(double deliverytime, NetCvode *)
static PreSynSaveIndexTable * idxtable_
static PreSyn * hindx2presyn(long)
NrnThread * thread() override
void deliver(double, NetCvode *, NrnThread *) override
STECondition(Point_process *, double(*)(Point_process *)=NULL)
void pgvts_deliver(double t, NetCvode *) override
static DiscreteEvent * savestate_read(FILE *)
static void savestate_free()
void call_net_receive(NetCvode *)
virtual void savestate_restore(double deliverytime, NetCvode *)
virtual NrnThread * thread()
static unsigned long selfevent_deliver_
virtual void pr(const char *, double t, NetCvode *)
static unsigned long selfevent_send_
static unsigned long selfevent_move_
virtual void savestate_write(FILE *)
static std::unique_ptr< SelfEventPPTable > sepp_
static Point_process * index2pp(int type, int oindex)
virtual void deliver(double, NetCvode *, NrnThread *)
virtual DiscreteEvent * savestate_save()
virtual void pgvts_deliver(double t, NetCvode *)
TQItem * second_least(double t)
TQItem * insert(double t, void *data)
TQItem * enqueue_bin(double t, void *data)
void move(TQItem *, double tnew)
TQItem * atomic_dq(double til)
void forall_callback(void(*)(const TQItem *, int))
void move_least(double tnew)
void spike_stat(double *)
virtual void record_init()
TvecRecord(Section *, IvocVect *tvec, Object *ppobj=nullptr)
virtual void disconnect(Observable *)
virtual void install(Cvode *)
virtual void continuous(double t)
virtual void frecord_init(TQItem *)
virtual void install(Cvode *)
VecRecordDiscrete(neuron::container::data_handle< double >, IvocVect *y, IvocVect *t, Object *ppobj=nullptr)
virtual void deliver(double t, NetCvode *)
virtual ~VecRecordDiscrete()
virtual PlayRecordSave * savestate_save()
virtual void record_init()
virtual void disconnect(Observable *)
VecRecordDiscreteSave(PlayRecord *)
virtual ~VecRecordDiscreteSave()
virtual void savestate_write(FILE *)
virtual void savestate_read(FILE *)
virtual void savestate_restore()
virtual void record_init()
virtual void disconnect(Observable *)
virtual void frecord_init(TQItem *)
virtual void deliver(double t, NetCvode *)
virtual void install(Cvode *)
VecRecordDt(neuron::container::data_handle< double >, IvocVect *y, double dt, Object *ppobj=nullptr)
virtual PlayRecordSave * savestate_save()
VecRecordDtSave(PlayRecord *)
virtual ~VecRecordDtSave()
virtual void savestate_restore()
virtual NrnThread * thread()
static unsigned long watch_send_
static unsigned long watch_deliver_
virtual ~WatchCondition()
double(* c_)(Point_process *)
void activate(double flag)
virtual void deliver(double, NetCvode *, NrnThread *)
virtual void pgvts_deliver(double t, NetCvode *)
virtual void pr(const char *, double t, NetCvode *)
virtual void send(double, NetCvode *, NrnThread *)
WatchCondition(Point_process *, double(*)(Point_process *))
virtual void disconnect(Observable *)
virtual void install(Cvode *)
YvecRecord(neuron::container::data_handle< double >, IvocVect *y, Object *ppobj=nullptr)
virtual void continuous(double t)
virtual void record_init()
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
Symbol * hoc_table_lookup(const char *, Symlist *)
HocReturnType hoc_return_type_code
#define VecPlayContinuousType
#define PlayRecordEventType
std::vector< PreSyn * > PreSynList
void erase_first(T &&iterable, value_type &&value)
constexpr auto reverse(T &&iterable)
constexpr auto enumerate(T &&iterable)
double chkarg(int, double low, double high)
void nrn_fixed_step_group(neuron::model_sorted_token const &cache_token, int n)
void nrn_fixed_step(neuron::model_sorted_token const &cache_token)
int nrn_errno_check(int i)
std::vector< std::pair< double *, IvocVect * > > GLineRecordEData
int hoc_is_object_arg(int narg)
Object * hoc_name2obj(const char *name, int index)
void hoc_execerr_ext(const char *fmt,...)
printf style specification of hoc_execerror message.
neuron::container::data_handle< double > hoc_val_handle(std::string_view s)
Object ** hoc_temp_objvar(Symbol *symtemp, void *v)
void hoc_pushpx(double *d)
int hoc_is_str_arg(int narg)
bool hoc_stack_type_is_ndim()
int hoc_is_double_arg(int narg)
void check_obj_type(Object *obj, const char *type_name)
IvocVect * vector_arg(int i)
void hoc_obj_ref(Object *obj)
char * hoc_object_name(Object *ob)
double * hoc_pgetarg(int narg)
Symbol * hoc_lookup(const char *)
void hoc_obj_unref(Object *obj)
void hoc_push(neuron::container::generic_data_handle handle)
hoc_List * hoc_l_newlist()
hoc_Item * hoc_l_insertvoid(hoc_Item *, void *)
void hoc_l_freelist(hoc_List **)
void hoc_l_delete(hoc_Item *)
Point_process * ob2pntproc(Object *ob)
Point_process * ob2pntproc_0(Object *ob)
Object ** hoc_objgetarg(int)
Symlist * hoc_top_level_symlist
int hoc_araypt(Symbol *, int)
void nrn_notify_when_void_freed(void *p, Observer *ob)
void nrn_notify_pointer_disconnect(Observer *ob)
#define BEFORE_BREAKPOINT
#define ITERATE(itm, lst)
void move(Item *q1, Item *q2, Item *q3)
auto for_threads(NrnThread *threads, int num_threads)
phase
Reading phase number.
fixed_vector< double > IvocVect
double * vector_vec(IvocVect *v)
void nrn2ncs_outputevent(int netcon_output_index, double firetime)
void hoc_execerror(const char *s1, const char *s2)
void nrn_outputevent(unsigned char, double)
void nrn_multisend_advance()
void nrn_multithread_job(F &&job, Args &&... args)
void hoc_warning(const char *s1, const char *s2)
void nrn_ba(NrnThread *nt, int bat)
handle_interface< non_owning_identifier< storage > > handle
Non-owning handle to a Mechanism instance.
void notify_when_handle_dies(data_handle< double > dh, Observer *obs)
Register that obs should be notified when dh dies.
constexpr std::size_t invalid_row
constexpr do_not_search_t do_not_search
icycle< ncycle;++icycle) { int istride=stride[icycle];nrn_pragma_acc(loop vector) nrn_pragma_omp(loop bind(parallel)) for(int icore=0;icore< warpsize;++icore) { int i=ii+icore;if(icore< istride) { int ip=GPU_PARENT(i);GPU_RHS(i) -=GPU_B(i) *GPU_RHS(ip);GPU_RHS(i)/=GPU_D(i);} i+=istride;} ii+=istride;} }}void solve_interleaved2(int ith) { NrnThread *nt=nrn_threads+ith;InterleaveInfo &ii=interleave_info[ith];int nwarp=ii.nwarp;if(nwarp==0) return;int ncore=nwarp *warpsize;int *ncycles=ii.cellsize;int *stridedispl=ii.stridedispl;int *strides=ii.stride;int *rootbegin=ii.firstnode;int *nodebegin=ii.lastnode;if(0) { nrn_pragma_acc(parallel loop gang present(nt[0:1], strides[0:nstride], ncycles[0:nwarp], stridedispl[0:nwarp+1], rootbegin[0:nwarp+1], nodebegin[0:nwarp+1]) async(nt->stream_id)) nrn_pragma_omp(target teams loop map(present, alloc:nt[:1], strides[:nstride], ncycles[:nwarp], stridedispl[:nwarp+1], rootbegin[:nwarp+1], nodebegin[:nwarp+1])) for(int icore=0;icore< ncore;icore+=warpsize) { solve_interleaved2_loop_body(nt, icore, ncycles, strides, stridedispl, rootbegin, nodebegin);} nrn_pragma_acc(wait(nt->stream_id)) } else { for(int icore=0;icore< ncore;icore+=warpsize) { solve_interleaved2_loop_body(nt, icore, ncycles, strides, stridedispl, rootbegin, nodebegin);} }}void solve_interleaved1(int ith) { NrnThread *nt=nrn_threads+ith;int ncell=nt-> ncell
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
std::unordered_map< void *, NetCon * > NetConSaveWeightTable
std::unordered_map< long, Point_process * > SelfEventPPTable
std::vector< NetCon * > NetConPList
std::unordered_map< long, PreSyn * > PreSynSaveIndexTable
std::unordered_map< long, NetCon * > NetConSaveIndexTable
#define DiscreteEventType
std::unordered_map< void *, MaxStateItem * > MaxStateTable
std::vector< HocEvent * > HocEventList
std::unordered_map< neuron::container::data_handle< double >, PreSyn * > PreSynTable
int is_point_process(Object *)
neuron::model_sorted_token nrn_ensure_model_data_are_sorted()
Ensure neuron::container::* data are sorted.
#define nrn_assert(x)
assert()-like macro, independent of NDEBUG status
int nrn_dblpntr2nrncore(neuron::container::data_handle< double > dh, NrnThread &nt, int &type, int &index)
static Node * node(Object *)
#define POINT_RECEIVE(type, tar, w, f)
std::vector< PreSyn * > * net_cvode_instance_psl()
void nrn2core_transfer_WATCH(void(*cb)(int, int, int, int, int))
static double nc_setpost(void *v)
static TQList * record_init_items_
static int trajec_buffered(NrnThread &nt, int bsize, IvocVect *v, neuron::container::data_handle< double > pd, int i_pr, PlayRecord *pr, void **vpr, int i_trajec, int *types, int *indices, double **pvars, double **varrays)
short * nrn_is_artificial_
short * nrn_artcell_qindex_
static Object ** nc_precelllist(void *v)
static double nc_event(void *v)
void nrn_netcon_event(NetCon *nc, double td)
static void * pending_selfqueue(NrnThread *)
double nrn_hoc2scatter_y(void *v)
void nrn2core_transfer_WatchCondition(WatchCondition *wc, void(*cb)(int, int, int, int, int))
In nrncore_callbacks.cpp.
void(* nrnthread_v_transfer_)(NrnThread *)
int nrn_presyn_count(PreSyn *ps)
static Object ** nc_syn(void *v)
static double nc_active(void *v)
Point_process * nrn_netcon_target(NetCon *nc)
static double lvardt_tout_
static PreSyn * unused_presyn
int * nrn_fornetcon_type_
std::vector< WatchCondition * > WatchList
void artcell_net_move(Datum *v, Point_process *pnt, double tt)
void _nrn_watch_allocate(Datum *d, double(*c)(Point_process *), int i, Point_process *pnt, double flag)
Introduced so corenrn->nrn can request the mod file to make sure all WatchCondition are allocated.
void * nrn_presyn_netcon(PreSyn *ps, int i)
void nrnthread_trajectory_values(int tid, int n_pr, void **vpr, double t)
static void allthread_handle_callback()
void nrn_use_busywait(int)
double nrn_hoc2fixed_step(void *)
static std::regex get_regex(int id)
void ncs2nrn_integrate(double tstop)
static Object ** nc_prelist(void *v)
void nrn_cleanup_presyn(PreSyn *)
int * nrn_fornetcon_index_
static double nc_preloc(void *v)
static Object ** nc_preseg(void *v)
double nrn_hoc2gather_y(void *v)
static Member_func members[]
static IvocVect * event_info_tvec_
static void event_info_callback(const TQItem *, int)
static Object ** nc_get_recordvec(void *v)
void _nrn_free_fornetcon(void **v)
void nrn_cvfun(double t, double *y, double *ydot)
void record_init_clear(const TQItem *q, int)
int nrn_netcon_info(NetCon *nc, double **pw, Point_process **target, double **th, double **del)
static double nc_wcnt(void *v)
double nrn_netcon_get_thresh(NetCon *nc)
static void destruct(void *v)
void net_event(Point_process *pnt, double time)
cTemplate ** nrn_pnt_template_
static Object ** nc_postcell(void *v)
void nrn_net_send(Datum *v, double *weight, Point_process *pnt, double td, double flag)
void nrn_netcon_set_thresh(NetCon *nc, double th)
int nrn_netcon_weight(NetCon *nc, double **pw)
void * nrn_interthread_enqueue(NrnThread *)
void(* ReceiveFunc)(Point_process *, double *, double)
double nrn_hoc2fun(void *v)
void _nrn_free_watch(Datum *d, int offset, int n)
Called by Point_process destructor in translated mod file.
void(* nrn_allthread_handle)()
int linmod_extra_eqn_count()
Object *(* nrnpy_seg_from_sec_x)(Section *, double)
static double nc_record(void *v)
void nrn_net_move(Datum *v, Point_process *pnt, double tt)
void nrnthread_trajectory_return(int tid, int n_pr, int bsize, int vecsz, void **vpr, double t)
static Member_ret_obj_func omembers[]
static char * escape_bracket(const char *s)
static Object ** nc_postseg(void *v)
static Object ** nc_postcelllist(void *v)
static DiscreteEvent * null_event_
void artcell_net_send(Datum *v, double *weight, Point_process *pnt, double td, double flag)
double nrn_event_queue_stats(double *stats)
static void all_pending_selfqueue(double tt)
static Object ** newoclist(int i, OcList *&o)
TQueue * net_cvode_instance_event_queue(NrnThread *)
double nrn_netcon_get_delay(NetCon *nc)
static void steer_val(void *v)
std::vector< TQItem * > TQList
void nrnthread_get_trajectory_requests(int tid, int &bsize, int &n_pr, void **&vpr, int &n_trajec, int *&types, int *&indices, double **&pvars, double **&varrays)
static void * cons(Object *o)
MutexPool< SelfEvent > SelfEventPool
static unsigned long net_event_cnt_
static Object ** nc_precell(void *v)
static Object ** nc_synlist(void *v)
static double nc_valid(void *v)
static void * chk_deliv(NrnThread *nt)
static int event_info_type_
void nrn_pending_selfqueue(double tt, NrnThread *)
MutexPool< HocEvent > HocEventPool
static double nc_srcgid(void *v)
static void lvardt_integrate(neuron::model_sorted_token const &token, NrnThread &ntr)
int _nrn_netcon_args(void *v, double ***argslist)
NetCvode * net_cvode_instance
static double pending_selfqueue_deliver_
static double nc_postloc(void *v)
void nrn_netcon_set_delay(NetCon *nc, double d)
bool nrn_trajectory_request_per_time_step_
static IvocVect * event_info_flagvec_
static void peq(const TQItem *, int)
void nrn_use_daspk(int b)
void nrn_watch_clear()
Watch info corenrn->nrn transfer requires all activated WatchCondition be deactivated prior to mirror...
static void * deliver_for_thread(NrnThread *nt)
void _nrn_watch_activate(Datum *d, double(*c)(Point_process *), int i, Point_process *pnt, int r, double flag)
static OcList * event_info_list_
static Object ** nc_pre(void *v)
static unsigned long deliver_cnt_
static void * eval_cond(NrnThread *nt)
std::vector< PlayRecord * > * net_cvode_instance_prl()
MutexPool< TQItem > TQItemPool
#define GVectorRecordType
#define VecRecordDiscreteType
int const size_t const size_t n
TBUF void nrn_multisend_send(PreSyn *ps, double t)
Object * nrn_sec2cell(Section *)
void nrnmusic_injectlist(void *vp, double tt)
#define MUTCONSTRUCT(mkmut)
std::vector< Memb_func > memb_func
std::vector< Memb_list > memb_list
pnt_receive_init_t * pnt_receive_init
void nrn_onethread_job(int i, void *(*job)(NrnThread *))
void nrn_wait_for_threads()
static void pr(N_Vector x)
static double cell(void *v)
static void pnode(Prop *)
int find(const int, const int, const int, const int, const int)
Object ** hoc_temp_objptr(Object *)
Symlist * hoc_built_in_symlist
std::vector< Memb_list * > ml
static void destruct(BAMechList **first)
BAMechList(BAMechList **first)
Wrapper for Memb_list in CVode related code.
std::vector< Memb_list > ml
nrn_ode_count_t ode_count
nrn_ode_matsol_t ode_matsol
A view into a set of mechanism instances.
std::size_t get_storage_offset() const
Get the offset of this Memb_list into global storage for this type.
struct NrnThreadBAList * next
Represent main neuron object computed by single thread.
NrnThreadBAList * tbl[BEFORE_AFTER_SIZE]
struct NrnThreadMembList * next
A point process is computed just like regular mechanisms.
neuron::container::data_handle< double > var1_
neuron::container::data_handle< double > var2_
StateTransitionEvent * ste_
std::unique_ptr< HocCommand > hc_
std::unique_ptr< STECondition > stec_
std::vector< STEState > states_
void transition(int src, int dest, neuron::container::data_handle< double > var1, neuron::container::data_handle< double > var2, std::unique_ptr< HocCommand >)
struct Symbol::@45::@46 rng
Non-template stable handle to a generic value.
T & literal_value()
Obtain a reference to the literal value held by this handle.
T get() const
Explicit conversion to any T.
int Fprintf(FILE *stream, const char *fmt, Args... args)
int Printf(const char *fmt, Args... args)