1 #include <../../nrnconf.h> 42 #define NRN_MECH_REORDER 1 75 int nscan, maxtype, imech, nmech,
type, sz1, sz2, ntget, ith, nth,
i,
j,
cnt, seq;
83 long* ntget1 =
new long[maxtype];
84 for (i=0; i < maxtype; ++
i) { ntget1[
i] = 0; }
88 for (ith=0; ith < nth; ++ith) {
90 for (imech=0; imech < nmech; ++imech) {
92 nrn_assert(sscanf(line,
"%d %d %d %d %d", &type, &sz1, &sz2, &ntget, &cnt) == 5);
96 if (!dblpools_[type]) {
103 if (!datumpools_[type]) {
111 for (i = 0; i < maxtype; ++
i) {
112 if (dblpools_[i] && dblpools_[i]->size() < ntget1[i]) {
113 dblpools_[
i]->
grow(ntget1[i] - dblpools_[i]->size());
115 if (datumpools_[i] && datumpools_[i]->size() < ntget1[i]) {
116 datumpools_[
i]->
grow(ntget1[i] - datumpools_[i]->size());
123 for (i = 0; i < maxtype; ++
i) {
125 double** items = dblpools_[
i]->
items();
126 int sz = dblpools_[
i]->
size();
127 for (
int j=0; j < sz; ++
j) {
131 if (datumpools_[i]) {
133 int sz = datumpools_[
i]->
size();
134 for (
int j=0; j < sz; ++
j) {
145 p1[
i] = dblpools_[
i];
146 p2[
i] = datumpools_[
i];
149 for (ith = 0; ith < nth; ++ith) {
151 for (i=0; i <
cnt; ++
i) {
153 nrn_assert(sscanf(line,
"%d %d %d", &type, &j, &seq));
154 if (dblpools_[type]) {
155 double** items = dblpools_[
type]->
items();
160 if (datumpools_[type]) {
169 if (p1[i] && p2[i]) {
170 assert(chain[i] == (p1[i]->chain_size() + p2[i]->chain_size()));
172 assert(chain[i] == p1[i]->chain_size());
174 assert(chain[i] == p2[i]->chain_size());
176 if (p1[i]) {p1[
i] = p1[
i]->
chain();}
177 if (p2[i]) {p2[
i] = p2[
i]->
chain();}
187 int n = dblpools_[
i]->
size();
189 double** items = dblpools_[
i]->
items();
190 for (j = 0; j <
n; ++
j) {
202 int n = datumpools_[
i]->
size();
205 for (j = 0; j <
n; ++
j) {
219 #endif // NRN_MECH_REORDER 226 for (i=0; i <
n; ++
i) {
232 p1[
i] = dblpools_[
i];
233 p2[
i] = datumpools_[
i];
246 if (dblpools_[type]) {
247 if (dblpools_[type]->nget() > 0) {
250 delete dblpools_[
type];
263 if (!dblpools_[type]) {
266 assert(dblpools_[type]->d2() == count);
276 if (!datumpools_[type]) {
279 assert(datumpools_[type]->d2() == count);
283 for (i=0; i < count; ++
i) { ppd[
i].
_pvoid = 0; }
317 if (!secpool_) {
return 0; }
338 if (p[i]->chain_size() != ml->
nodecount) {
345 if (p[i]->element(
j) != ml->
data[
j]) {
379 long ds = op->chain_size() * op->d2();
380 if (old >= op->pool() && old < (op->pool() + ds)) {
382 long offset = old - op->pool();
385 long i = (
long)(*old);
387 assert(i >= 0 && i < np->size());
388 double*
n = np->
items()[
i] + offset;
406 oldpools_[
i] = dblpools_[
i];
419 int ml_total_count = 0;
422 ml_total_count += tml->ml->nodecount;
426 newpool->
grow(tml->ml->nodecount);
433 int extra = oldpool->
nget() - ml_total_count;
434 assert(extra >= 0 && newpool);
436 newpool->
grow(extra);
445 int ntget = newpool->
ntget();
447 for (
int k=0;
k < newpool->
d2(); ++
k) {
452 for (
int k=0;
k < newpool->
d2(); ++
k) {
453 data[
k] = double(ntget);
471 if (!mechstanlist_) {
485 int ntget = newpool->
ntget();
487 for (
int k=0;
k < newpool->
d2(); ++
k) {
492 for (
int k=0;
k < newpool->
d2(); ++
k) {
493 data[
k] = double(ntget);
503 dblpools_[
i] = newpool;
510 assert (oldpool == oldpools_[i]);
520 mlmap[tml->index] = tml->ml;
524 for (
int i=0; i < nt->
end; ++
i) {
546 for (
int i=0; i <
n_memb_func; ++
i)
if (types[i] && oldpools_[i]) {
567 assert(i >= 0 && i < np->size());
568 double* pvar = np->
items()[
i];
607 int sz1 = 0, sz2 = 0, ntget = 0;
609 sz1 = dblpools_[
i]->
d2();
610 ntget = dblpools_[
i]->
ntget();
612 if (datumpools_[i]) {sz2 = datumpools_[
i]->
d2(); }
613 fprintf(f,
"%d %d %d %d %d %s\n", i, sz1, sz2, ntget, cnt,
memb_func[i].sym->name);
623 cnt += tml->ml->nodecount;
624 tml->ml->nodecount = 0;
625 mlmap[tml->index] = tml->ml;
629 for (i=0; i < nt->
end; ++
i) {
663 return (
void*)p->
alloc();
667 p->
hpfree(static_cast<char*>(item));
ArrayPool< char > CharArrayPool
static double * recalc_ptr(double *)
static hoc_List * mechstanlist_
void nrn_prop_data_free(int type, double *pd)
struct NrnThreadMembList * next
void nrn_mk_prop_pools(int)
int nrn_prop_is_cache_efficient()
void nrn_section_free(Section *s)
#define ITERATE(itm, lst)
int iontype(char *s1, char *s2)
Symbol * hoc_lookup(const char *)
void * nrn_pool_alloc(void *pool)
Represent main neuron object computed by single thread.
ArrayPool< double > DoubleArrayPool
static DoubleArrayPool ** oldpools_
static philox4x32_key_t k
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
static DatumArrayPool ** datumpools_
void * nrn_pool_create(long count, int itemsize)
Pool< Section > SectionPool
int const size_t const size_t n
void nrn_recalc_ptrs(double *(*)(double *))
void nrn_prop_datum_free(int type, Datum *ppd)
static void mk_prop_pools(int n)
void nrn_pool_delete(void *pool)
void nrn_pool_freeall(void *pool)
void hoc_execerror(const char *, const char *)
fprintf(stderr, "Don't know the location of params at %p\, pp)
int nrn_is_valid_section_ptr(void *v)
void nrn_update_ion_pointer(Symbol *sion, Datum *dp, int id, int ip)
static SectionPool * secpool_
void nrn_cache_prop_realloc()
HocStruct cTemplate * ctemplate
double * nrn_prop_data_alloc(int type, int count, Prop *p)
Section * nrn_section_alloc()
void nrn_extcell_update_param(void)
static char line[MAXLINE]
Datum * nrn_prop_datum_alloc(int type, int count, Prop *p)
static int in_place_data_realloc()
void nrn_delete_prop_pool(int type)
static DoubleArrayPool ** dblpools_
ArrayPool< Datum > DatumArrayPool
void nrn_pool_free(void *pool, void *item)