1 #include <../../nrnconf.h>
57 #include <nrnmpiuse.h>
68 void (*nrnmpi_splitcell_compute_)();
95 double debugsolve(
void)
110 for (inode =
sec->nnode - 1; inode >= 0; inode--) {
111 nd =
sec->pnode[inode];
112 nd->savd =
NODED(nd);
125 for (inode =
sec->nnode - 1; inode >= 0; inode--) {
126 ndP =
sec->pnode + inode;
127 nd =
sec->pnode[inode];
136 if (inode < sec->nnode - 1) {
164 ratio = ((double) inode + .5) / ((double)
sec->nnode - 1.);
186 while (sec1 != sec2) {
206 if (node1 != node2) {
211 }
else if (node1 != node2) {
233 static Node* origin_node;
234 Node* my_origin_node;
244 mode = (int)
chkarg(1, 0., 1.);
250 (*nrnpy_o2loc2_p_)(
o, &my_origin_sec, &d_origin);
252 if (!my_origin_sec) {
254 "If first argument is an Object, it needs to be a Python Segment "
255 "object, a rxd.node object, or something with a segment property.");
257 my_origin_node =
node_exact(my_origin_sec, d_origin);
259 }
else if (
ifarg(1)) {
274 "Need to initialize origin with distance()");
278 my_origin_node = origin_node;
311 for (
i = 0;
i < offset;
i++)
314 for (
i = 2;
i <
sec->nnode;
i++)
316 if (
sec->prop->dparam[4].val == 1) {
319 Printf(
"| %s%s with %g rall branches\n",
322 sec->prop->dparam[4].val);
327 for (scnt = 0, ch =
sec->child; ch; ++scnt, ch = ch->
sibling) {
334 dashes(ch,
i + offset + 1, 0140);
341 printf(
"\nnrn_solve enter %lx\n", (
long)_nt);
347 (*nrn_multisplit_solve_)();
358 Fprintf(stderr,
"solve error = %g\n", err);
380 if (nrnmpi_splitcell_compute_) {
382 (*nrnmpi_splitcell_compute_)();
389 printf(
"\nnrn_solve leave %lx\n", (
long)_nt);
394 #if VECTORIZE && _CRAY
395 extern Node*** v_node_depth_lists;
396 extern Node*** v_parent_depth_lists;
397 extern int* v_node_depth_count;
398 extern int v_node_depth;
410 for (
i = i3 - 1;
i >= i2; --
i) {
418 for (
i = i3 - 1;
i >= i2; --
i) {
433 i2 = i1 + _nt->
ncell;
437 for (
i = i1;
i < i2; ++
i) {
440 for (
i = i2;
i < i3; ++
i) {
447 for (
i = i1;
i < i2; ++
i) {
450 for (
i = i2;
i < i3; ++
i) {
464 sec->volatile_mark = 0;
468 return sec->volatile_mark++;
471 return sec->volatile_mark;
495 sec->logical_connection = (
Pt3d*) 0;
498 sec->recalc_area_ = 0;
511 if (
sec->nnode == 0) {
533 if (ob && ob->
secelm_ == secitem) {
545 if (!
sec->parentsec &&
sec->parentnode) {
550 free((
char*)
sec->pt3d);
555 if (
sec->logical_connection) {
556 free(
sec->logical_connection);
557 sec->logical_connection = (
Pt3d*) 0;
567 if (--
sec->refcount <= 0) {
569 printf(
"section_unref: freed\n");
597 for (child =
sec->child; child; child = child->
sibling) {
608 for (
i =
n - 1;
i >= 0;
i--) {
623 nd->eqnblock = (Eqnblock*) 0;
657 for (
e = nd->eqnblock;
e;
e = e1) {
658 e1 =
e->eqnblock_next;
676 for (
i =
n - 1;
i >= 0;
i--) {
698 for (p1 = nd1->
prop; p1; p1 = p1->
next) {
707 for (
j = 0;
j < jmax; ++
j) {
712 for (
i = 0;
i < imax; ++
i) {
725 for (p1 = nd1->
prop; p1; p1 = p1->
next) {
728 while (p2 && p2->
type != p1->
type) {
751 int n1, n2, i1, i2,
i;
768 for (i1 = 0; i1 < n1; ++i1) {
769 x = (i1 + .5) / (
double) n1;
774 for (i2 = 0; i2 < n2; ++i2)
775 if (pn2[i2] ==
NULL) {
776 x = (i2 + 0.5) / (
double) n2;
780 for (i1 = 0; i1 < n1; ++i1) {
784 for (i2 = 0; i2 < n2; ++i2) {
785 x = (i2 + .5) / (
double) n2;
792 for (i2 = 0; i2 < n2; ++i2) {
794 x2 = (i2 + 1.) / (
double) n2;
795 for (; i1 < n1; ++i1) {
796 x1 = (i1 + .5) / (
double) n1;
800 if (pn1[i1] == (
Node*) 0) {
804 printf(
"moving point processes from pn1[%d] to pn2[%d]\n", i1, i2);
805 printf(
"i.e. x1=%g in the range %g to %g\n", x1, x2-1./n2, x2);
813 for (i2 = 0; i2 < nseg; ++i2) {
817 if (
sec->pnode[
sec->nnode - 1]->extnode) {
841 for (
i = 0;
i < nseg; ++
i) {
875 if (!
sec->parentsec) {
889 for (psec =
sec->parentsec; psec; s = psec, psec = psec->
parentsec) {
890 if (!psec || s->
order >= 0) {
892 }
else if (psec ==
sec) {
898 " %s\nUse <section> disconnect() to break the loop\n ",
double nrn_section_orientation(Section *sec)
const char * secname(Section *sec)
int node_index_exact(Section *sec, double x)
double section_length(Section *sec)
double nrn_connection_position(Section *sec)
Section * chk_access(void)
void nrn_disconnect(Section *sec)
Node * node_exact(Section *sec, double x)
static double order(void *v)
Section * nrn_section_alloc()
void nrn_section_free(Section *s)
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)
double chkarg(int, double low, double high)
void extcell_2d_alloc(Section *sec)
void extnode_free_elements(Extnode *nde)
void nrn_print_matrix(NrnThread *_nt)
void hoc_execerror(const char *, const char *)
size_t hoc_total_array_data(Symbol *s, Objectdata *obd)
void hoc_pushobj(Object **d)
void notify_freed_val_array(double *p, size_t size)
int hoc_is_double_arg(int narg)
void hoc_retpushx(double x)
void * ecalloc(size_t n, size_t size)
void hoc_l_delete(hoc_Item *)
Object ** hoc_objgetarg(int)
#define ITERATE(itm, lst)
char * emalloc(unsigned n)
void nrn_thread_error(const char *)
Prop * prop_alloc(Prop **, int, Node *)
static Node * node(Object *)
void nrn_seg_or_x_arg2(int iarg, Section **psec, double *px)
void nrn_relocate_old_points(Section *oldsec, Node *oldnode, Section *sec, Node *node)
int const size_t const size_t n
void nrn_clear_mark(void)
static void triang(NrnThread *)
static Section * origin_sec
void(* nrnpy_o2loc2_p_)(Object *, Section **, double *)
void nrn_sec_ref(Section **psec, Section *sec)
void sec_free(hoc_Item *secitem)
short nrn_value_mark(Section *sec)
void(* nrn_multisplit_solve_)()
static void node_realloc(Section *sec, short nseg)
Node ** node_construct(int n)
double node_dist(Section *sec, Node *node)
Section * sec_alloc(void)
void nrnhoc_topology(void)
void(* nrnpy_o2loc_p_)(Object *, Section **, double *)
static Node * node_interp(Node *nd1, Node *nd2, double frac)
static Node * node_clone(Node *nd1)
void nrn_node_destruct1(Node *nd)
void section_unref(Section *sec)
double topol_distance(Section *sec1, Node *node1, Section *sec2, Node *node2, Section **prootsec, Node **prootnode)
short nrn_increment_mark(Section *sec)
void node_destruct(Node **pnode, int n)
void nrn_solve(NrnThread *_nt)
void node_alloc(Section *sec, short nseg)
void section_ref(Section *sec)
static void section_unlink(Section *sec)
static void dashes(Section *sec, int offset, int first)
static void bksub(NrnThread *)
Node * nrn_node_construct1(void)
static void pnode(Prop *)
Represent main neuron object computed by single thread.
HocStruct hoc_Item * secelm_
struct Section * parentsec
HocStruct Symbol ** ppsym
struct Symbol::@37::@38 rng