1 #include <../../nrnconf.h>
42 #define NRN_MECH_REORDER 1
76 int nscan, maxtype, imech, nmech,
type, sz1, sz2, ntget, ith, nth,
i,
j,
cnt, seq;
87 long* ntget1 =
new long[maxtype];
88 for (
i = 0;
i < maxtype; ++
i) {
95 for (ith = 0; ith < nth; ++ith) {
98 for (imech = 0; imech < nmech; ++imech) {
102 ntget1[
type] = ntget;
119 for (
i = 0;
i < maxtype; ++
i) {
131 for (
i = 0;
i < maxtype; ++
i) {
135 for (
int j = 0;
j < sz; ++
j) {
142 for (
int j = 0;
j < sz; ++
j) {
157 for (ith = 0; ith < nth; ++ith) {
160 for (
i = 0;
i <
cnt; ++
i) {
178 if (p1[
i] && p2[
i]) {
179 assert(chain[
i] == (p1[
i]->chain_size() + p2[
i]->chain_size()));
181 assert(chain[
i] == p1[
i]->chain_size());
183 assert(chain[
i] == p2[
i]->chain_size());
203 for (
j = 0;
j <
n; ++
j) {
218 for (
j = 0;
j <
n; ++
j) {
239 for (
i = 0;
i <
n; ++
i) {
300 for (
i = 0;
i < count; ++
i) {
364 p[
i] =
p[
i]->chain();
368 if (
p[
i]->element(
j) != ml->
data[
j]) {
374 p[
i] =
p[
i]->chain();
402 long ds = op->chain_size() * op->d2();
403 if (old >= op->pool() && old < (op->pool() + ds)) {
405 long offset = old - op->pool();
408 long i = (long) (*old);
410 assert(
i >= 0 && i < np->size());
411 double*
n = np->
items()[
i] + offset;
443 int ml_total_count = 0;
446 if (
i == tml->index) {
447 ml_total_count += tml->ml->nodecount;
451 newpool->
grow(tml->ml->nodecount);
458 int extra = oldpool->
nget() - ml_total_count;
459 assert(extra >= 0 && newpool);
461 newpool->
grow(extra);
467 if (
i == tml->index) {
471 int ntget = newpool->
ntget();
473 for (
int k = 0;
k < newpool->
d2(); ++
k) {
478 for (
int k = 0;
k < newpool->
d2(); ++
k) {
479 data[
k] = double(ntget);
511 double*
data =
p->param;
512 int ntget = newpool->
ntget();
513 p->param = newpool->
alloc();
514 for (
int k = 0;
k < newpool->
d2(); ++
k) {
519 for (
int k = 0;
k < newpool->
d2(); ++
k) {
520 data[
k] = double(ntget);
550 mlmap[tml->index] = tml->ml;
554 for (
int i = 0;
i < nt->
end; ++
i) {
595 long i = (long) (*dp[
id].
pval);
596 assert(
i >= 0 && i < np->size());
597 double* pvar = np->
items()[
i];
607 if ((pdbl && pdbl->nget() == 0)) {
610 if (pdatum && pdatum->nget() == 0) {
616 Printf(
"poolshrink --- type name (dbluse, size) (datumuse, size)\n");
620 if (pdbl || pdatum) {
621 Printf(
"%d %s (%ld, %d) (%ld, %d)\n",
624 (pdbl ? pdbl->nget() : 0),
625 (pdbl ? pdbl->size() : 0),
626 (pdatum ? pdatum->nget() : 0),
627 (pdatum ? pdatum->size() : 0));
671 int sz1 = 0, sz2 = 0, ntget = 0;
692 cnt += tml->ml->nodecount;
693 tml->ml->nodecount = 0;
694 mlmap[tml->index] = tml->ml;
698 for (
i = 0;
i < nt->
end; ++
i) {
733 return (
void*)
p->alloc();
737 p->hpfree(
static_cast<char*
>(item));
void nrn_cache_prop_realloc()
static DoubleArrayPool ** oldpools_
void nrn_pool_free(void *pool, void *item)
void nrn_recalc_ptrs(double *(*)(double *))
Datum * nrn_prop_datum_alloc(int type, int count, Prop *p)
void nrn_prop_datum_free(int type, Datum *ppd)
static int in_place_data_realloc()
void nrn_mk_prop_pools(int)
void nrn_update_ion_pointer(Symbol *sion, Datum *dp, int id, int ip)
ArrayPool< Datum > DatumArrayPool
static SectionPool * secpool_
void * nrn_pool_alloc(void *pool)
void nrn_prop_data_free(int type, double *pd)
static void mk_prop_pools(int n)
static DoubleArrayPool ** dblpools_
static DatumArrayPool ** datumpools_
void * nrn_pool_create(long count, int itemsize)
static hoc_List * mechstanlist_
int nrn_is_valid_section_ptr(void *v)
void nrn_pool_delete(void *pool)
Section * nrn_section_alloc()
static double * recalc_ptr(double *)
void nrn_delete_prop_pool(int type)
ArrayPool< char > CharArrayPool
int nrn_prop_is_cache_efficient()
void nrn_pool_freeall(void *pool)
void nrn_poolshrink(int shrink)
void nrn_section_free(Section *s)
double * nrn_prop_data_alloc(int type, int count, Prop *p)
Pool< Section > SectionPool
ArrayPool< double > DoubleArrayPool
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
void nrn_extcell_update_param(void)
void hoc_execerror(const char *, const char *)
Symbol * hoc_lookup(const char *)
static char line[MAXLINE]
#define ITERATE(itm, lst)
int iontype(char *s1, char *s2)
int const size_t const size_t n
static philox4x32_key_t k
Represent main neuron object computed by single thread.
struct NrnThreadMembList * next
HocStruct cTemplate * ctemplate