NEURON
spaceplt.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 #include <stdio.h>
3 #include "classreg.h"
4 
5 
6 #include <vector>
7 #include <OS/string.h>
8 #include <OS/math.h>
9 #include <string.h>
10 #include <ivstream.h>
11 #if HAVE_IV
12 #include "graph.h"
13 #include "scenepic.h"
14 #include "utility.h"
15 #include "ivoc.h"
16 #endif
17 #include "ivocvect.h"
18 #include "nrnoc2iv.h"
19 #include "objcmd.h"
20 
21 extern int nrn_multisplit_active_;
22 extern int hoc_execerror_messages;
23 extern int node_index(Section*, double);
24 extern "C" int structure_change_cnt;
25 extern int nrn_shape_changed_;
26 extern int hoc_return_type_code;
27 Object* (*nrnpy_rvp_rxd_to_callable)(Object*) = 0;
28 
29 class SecPos {
30  public:
31  float x;
32  float len;
34 };
35 
36 using SecPosList = std::vector<SecPos>;
37 
38 class RangeExpr {
39  public:
40  RangeExpr(const char* expr, Object* pyobj, SecPosList*);
41  virtual ~RangeExpr();
42  void fill();
43  void compute();
44  bool exists(int);
45  double* pval(int);
46 
47  private:
48  long n_;
50  double* val_;
51  bool* exist_;
53 };
54 
55 #if !HAVE_IV
57  public:
58  NoIVGraphVector(const char*);
59  virtual ~NoIVGraphVector();
60  void begin();
61  void add(float, double*);
62  int count();
64  int count_, size_;
65  double** py_;
66  float* x_;
67 };
69  name_ = name;
70  size_ = 0;
71  count_ = 0;
72  py_ = NULL;
73  x_ = NULL;
74 }
76  if (py_) {
77  delete[] py_;
78  delete[] x_;
79  }
80 }
82  return count_;
83 }
85  count_ = 0;
86  if (!size_) {
87  size_ = 20;
88  py_ = new double*[size_];
89  x_ = new float[size_];
90  }
91 }
92 void NoIVGraphVector::add(float x, double* y) {
93  if (count_ == size_) {
94  size_ *= 2;
95  double** py = new double*[size_];
96  float* px = new float[size_];
97  for (int i = 0; i < count_; i++) {
98  py[i] = py_[i];
99  px[i] = x_[i];
100  }
101  delete[] py_;
102  delete[] x_;
103  py_ = py;
104  x_ = px;
105  }
106  py_[count_] = y;
107  x_[count_++] = x;
108 }
109 #endif
110 
111 #if HAVE_IV
112 class RangeVarPlot: public GraphVector {
113 #else
115 #endif
116  public:
117  RangeVarPlot(const char*, Object* pyobj);
118  virtual ~RangeVarPlot();
119 #if HAVE_IV
120  virtual void save(ostream&);
121  virtual void request(Requisition& req) const;
122  virtual bool choose_sym(Graph*);
123  virtual void update(Observable*);
124 #endif
125  void x_begin(float, Section*);
126  void x_end(float, Section*);
127  void origin(float);
128  double d2root();
129  float left();
130  float right();
131  void list(Object*);
132  void compute();
133  int get_color(void);
134  void set_color(int);
135 
136  private:
137  int color_;
138  void set_x();
139  void fill_pointers();
140 
141  private:
149  double d2root_; // distance to root of closest point to root
150 };
151 
152 static double s_begin(void* v) {
153  double x;
154  Section* sec;
155  nrn_seg_or_x_arg(1, &sec, &x);
156  ((RangeVarPlot*) v)->x_begin(x, sec);
157  return 1.;
158 }
159 
160 static double s_end(void* v) {
161  double x;
162  Section* sec;
163  nrn_seg_or_x_arg(1, &sec, &x);
164  ((RangeVarPlot*) v)->x_end(x, sec);
165  return 1.;
166 }
167 
168 static double s_origin(void* v) {
169  ((RangeVarPlot*) v)->origin(*getarg(1));
170  return 1.;
171 }
172 
173 static double s_d2root(void* v) {
174  return ((RangeVarPlot*) v)->d2root();
175  return 0.0;
176 }
177 
178 static double s_left(void* v) {
179  return ((RangeVarPlot*) v)->left();
180  return 0.0;
181 }
182 
183 static double s_right(void* v) {
184  return ((RangeVarPlot*) v)->right();
185  return 0.0;
186 }
187 
188 static double s_list(void* v) {
189  Object* ob = *hoc_objgetarg(1);
190  check_obj_type(ob, "SectionList");
191  ((RangeVarPlot*) v)->list(ob);
192  return 0.;
193 }
194 
195 static double s_color(void* v) {
196  RangeVarPlot* me = (RangeVarPlot*) v;
197  hoc_return_type_code = 1; // integer
198  int old_color = me->get_color();
199  if (ifarg(1)) {
200  me->set_color((int) chkarg(1, 0, 100));
201  }
202  return old_color;
203 }
204 
205 
206 static long to_vector_helper(RangeVarPlot* rvp, Vect* y) {
207 #if HAVE_IV
208  long i, cnt = rvp->py_data()->count();
209 #else
210  long i, cnt = rvp->count();
211 #endif
212  rvp->compute();
213  y->resize(cnt);
214  for (i = 0; i < cnt; ++i) {
215 #if HAVE_IV
216  y->elem(i) = *rvp->py_data()->p(i);
217 #else
218  if (rvp->py_[i]) {
219  y->elem(i) = *rvp->py_[i];
220  } else {
221  y->elem(i) = 0.0;
222  }
223 #endif
224  }
225  return cnt;
226 }
227 
228 static Object** rvp_vector(void* v) {
229  if (ifarg(1)) {
230  hoc_execerror("Too many arguments",
231  "RangeVarPlot.vector takes no arguments; were you thinking of .to_vector?");
232  }
233  Vect* y = new Vect(0);
234  RangeVarPlot* rvp = (RangeVarPlot*) v;
235  to_vector_helper(rvp, y);
236  return y->temp_objvar();
237 }
238 
239 static double to_vector(void* v) {
240  if (ifarg(3)) {
241  hoc_execerror("Too many arguments", "RangeVarPlot.to_vector takes 1 or 2 arguments.");
242  }
243  long i;
244  RangeVarPlot* rvp = (RangeVarPlot*) v;
245  Vect* y = vector_arg(1);
246  long cnt = to_vector_helper(rvp, y);
247  if (ifarg(2)) {
248  Vect* x = vector_arg(2);
249  x->resize(cnt);
250  for (i = 0; i < cnt; ++i) {
251 #if HAVE_IV
252  x->elem(i) = rvp->x_data()->get_val(i);
253 #else
254  x->elem(i) = rvp->x_[i];
255 #endif
256  }
257  }
258  return double(cnt);
259 }
260 
261 static double from_vector(void* v) {
262  RangeVarPlot* rvp = (RangeVarPlot*) v;
263  Vect* y = vector_arg(1);
264 #if HAVE_IV
265  long i, cnt = rvp->py_data()->count();
266  for (i = 0; i < cnt; ++i) {
267  *rvp->py_data()->p(i) = y->elem(i);
268  }
269 #else
270  long i, cnt = rvp->count();
271  for (i = 0; i < cnt; ++i) {
272  if (rvp->py_[i]) {
273  *rvp->py_[i] = y->elem(i);
274  }
275  }
276 #endif
277  return double(cnt);
278 }
279 
280 static Member_func s_members[] = {{"begin", s_begin},
281  {"end", s_end},
282  {"origin", s_origin},
283  {"d2root", s_d2root},
284  {"left", s_left},
285  {"right", s_right},
286  {"list", s_list},
287  {"color", s_color},
288  {"to_vector", to_vector},
289  {"from_vector", from_vector},
290  {0, 0}};
291 
292 static Member_ret_obj_func rvp_retobj_members[] = {{"vector", rvp_vector}, {0, 0}};
293 
294 static void* s_cons(Object*) {
295  char* var = NULL;
296  Object* pyobj = NULL;
297  Section* sec;
298  double x;
299  if (hoc_is_str_arg(1)) {
300  var = gargstr(1);
301  } else {
302  pyobj = *hoc_objgetarg(1);
303  }
304  RangeVarPlot* s = new RangeVarPlot(var, pyobj);
305 #if HAVE_IV
306  s->ref();
307 #endif
308  if (ifarg(2)) {
309  nrn_seg_or_x_arg(2, &sec, &x);
310  s->x_begin(x, sec);
311  }
312  if (ifarg(3)) {
313  nrn_seg_or_x_arg(3, &sec, &x);
314  s->x_end(x, sec);
315  }
316  return (void*) s;
317 }
318 
319 static void s_destruct(void* v) {
320 #if HAVE_IV
322 #endif
323 }
324 
326  // printf("RangeVarPlot_reg\n");
328 }
329 
330 #if HAVE_IV
331 RangeVarPlot::RangeVarPlot(const char* var, Object* pyobj)
332  : GraphVector(var ? var : "pyobj") {
333 #else
335  : NoIVGraphVector(var ? var : "pyobj") {
336 #endif
337  color_ = 1;
338  begin_section_ = 0;
339  end_section_ = 0;
340  sec_list_ = new SecPosList;
343 #if HAVE_IV
344  Oc oc;
345  oc.notify_attach(this);
346 #endif
347  if ((var && strstr(var, "$1")) || pyobj) {
348  rexp_ = new RangeExpr(var, pyobj, sec_list_);
349  } else {
350  rexp_ = NULL;
351  }
352  expr_ = var ? var : "pyobj";
353  origin_ = 0.;
354  d2root_ = 0.;
355 }
356 
358  if (begin_section_) {
361  }
362  if (end_section_) {
364  end_section_ = NULL;
365  }
366  delete sec_list_;
367  if (rexp_) {
368  delete rexp_;
369  }
370 #if HAVE_IV
371  Oc oc;
372  oc.notify_detach(this);
373 #endif
374 }
375 
377  return color_;
378 }
379 
380 
381 void RangeVarPlot::set_color(int new_color) {
382  color_ = new_color;
383 #if HAVE_IV
384  IFGUI
386  ENDGUI
387 #endif
388 }
389 
390 
391 #if HAVE_IV
393  if (o) { // must be Oc::notify_change_ because free is NULL
394  // but do not update if multisplit active
396  // printf("RangeVarPlot::update shape_changed %d %d\n", shape_changed_,
397  // nrn_shape_changed_);
399  set_x();
400  fill_pointers();
401  }
402  } else {
403  // printf("RangeVarPlot::update -> GraphVector::update\n");
405  }
406 }
407 #endif
408 
409 void RangeVarPlot::origin(float x) {
410  origin_ = x;
411  fill_pointers();
412 }
413 
415  return d2root_;
416 }
417 
419  if (begin_section_) {
421  }
424  x_begin_ = x;
425  set_x();
426  fill_pointers();
427 }
428 
429 void RangeVarPlot::x_end(float x, Section* sec) {
430  if (end_section_) {
432  }
433  end_section_ = sec;
435  x_end_ = x;
436  set_x();
437  fill_pointers();
438 }
439 
441  if (!sec_list_->empty()) {
442  return sec_list_->front().len + origin_;
443  } else {
444  return origin_;
445  }
446 }
447 
449  if (!sec_list_->empty()) {
450  return sec_list_->back().len + origin_;
451  } else {
452  return origin_;
453  }
454 }
455 
457  if (rexp_) {
458  rexp_->compute();
459  }
460 }
461 
462 #if HAVE_IV
463 void RangeVarPlot::request(Requisition& req) const {
464  if (rexp_) {
465  rexp_->compute();
466  }
468 }
469 #endif
470 
471 #if HAVE_IV
472 void RangeVarPlot::save(ostream& o) {
473  char buf[256];
474  o << "objectvar rvp_" << endl;
475  sprintf(buf, "rvp_ = new RangeVarPlot(\"%s\")", expr_.string());
476  o << buf << endl;
477  sprintf(buf, "%s rvp_.begin(%g)", hoc_section_pathname(begin_section_), x_begin_);
478  o << buf << endl;
479  sprintf(buf, "%s rvp_.end(%g)", hoc_section_pathname(end_section_), x_end_);
480  o << buf << endl;
481  sprintf(buf, "rvp_.origin(%g)", origin_);
482  o << buf << endl;
483  Coord x, y;
484  label_loc(x, y);
485  sprintf(buf,
486  "save_window_.addobject(rvp_, %d, %d, %g, %g)",
487  colors->color(color()),
488  brushes->brush(brush()),
489  x,
490  y);
491  o << buf << endl;
492 }
493 #endif
494 
495 #if HAVE_IV
496 bool RangeVarPlot::choose_sym(Graph* g) {
497  // printf("RangeVarPlot::choose_sym\n");
498  char s[256];
499  s[0] = '\0';
500  while (str_chooser("Range Variable or expr involving $1",
501  s,
502  XYView::current_pick_view()->canvas()->window())) {
503  RangeVarPlot* rvp = new RangeVarPlot(s, NULL);
504  rvp->ref();
505 
507  rvp->x_begin_ = x_begin_;
508  rvp->end_section_ = end_section_;
509  rvp->x_end_ = x_end_;
510  rvp->set_x();
511  rvp->origin(origin_);
512  // check to see if there is anything to plot
513  if (!rvp->trivial()) {
514  g->add_graphVector(rvp);
515  rvp->label(g->label(s));
516  rvp->unref();
517  break;
518  } else {
519  printf("%s doesn't exist along the path %s(%g)", s, secname(begin_section_), x_begin_);
520  printf(" to %s(%g)\n", secname(end_section_), x_end_);
521  }
522  rvp->unref();
523  }
524 
525  return true;
526 }
527 #endif
528 
529 #if 0
530 void SpacePlot::expr(const char* expr) {
531  is_var_ = false;
532  if (gv_) {
533  gv_->begin();
534  }
535  Graph::add_var(expr);
536  set_x();
537 }
538 #endif
539 
541  long xcnt = sec_list_->size();
542  if (xcnt) {
543  Symbol* sym;
544  char buf[200];
545  begin();
546  if (rexp_) {
547  rexp_->fill();
548  } else {
549  sscanf(expr_.string(), "%[^[]", buf);
550  sym = hoc_lookup(buf);
551  if (!sym) {
552  return;
553  }
554  sprintf(buf, "%s(hoc_ac_)", expr_.string());
555  }
556  int noexist = 0; // don't plot single points that don't exist
557  bool does_exist;
558  double* pval = NULL;
559  for (long i = 0; i < xcnt; ++i) {
560  Section* sec = (*sec_list_)[i].sec;
561  hoc_ac_ = (*sec_list_)[i].x;
562  if (rexp_) {
563  does_exist = rexp_->exists(int(i));
564  } else {
565  nrn_pushsec(sec);
566  does_exist = nrn_exists(sym, node_exact(sec, hoc_ac_));
567  // does_exist = nrn_exists(sym, sec->pnode[node_index(sec, hoc_ac_)]);
568  }
569  if (does_exist) {
570  if (rexp_) {
571  pval = rexp_->pval(int(i));
572  } else {
574  }
575  if (noexist > 1) {
576  add((*sec_list_)[i - 1].len + origin_, 0);
577  add((*sec_list_)[i - 1].len + origin_, pval);
578  }
579  if (i == 1 && noexist == 1) {
580  add((*sec_list_)[i - 1].len + origin_, pval);
581  }
582  add((*sec_list_)[i].len + origin_, pval);
583  noexist = 0;
584  } else {
585  if (noexist == 1) {
586  add((*sec_list_)[i - 1].len + origin_, pval);
587  add((*sec_list_)[i - 1].len + origin_, 0);
588  }
589  if (i == xcnt - 1 && noexist == 0) {
590  add((*sec_list_)[i].len + origin_, pval);
591  }
592  ++noexist;
593  }
594  nrn_popsec();
595  }
596  }
597 }
598 
600  hoc_List* l = (hoc_List*) ob->u.this_pointer;
601  Section* sec = nullptr;
602  for (SecPos p: *sec_list_) {
603  if (p.sec != sec) {
604  sec = p.sec;
605  if (sec) {
606  hoc_l_lappendsec(l, sec);
607  section_ref(sec);
608  }
609  }
610  }
611 }
612 
613 #if 0
614 void SpacePlot::plot() {
615  Graph* g = (Graph*)this;
616  long xcnt = sec_list_->count();
617  double* x = hoc_val_pointer("x");
618  if (xcnt) {
619  g->begin();
620  for (long i=0; i < xcnt; ++i) {
621  nrn_pushsec(sec_list_->item(i).sec);
622  *x = sec_list_->item(i).x;
623  gr_->plot(sec_list_->item(i).len);
624  nrn_popsec();
625  }
626  }
627  gr_->flush();
628 }
629 
630 void SpacePlot::plot() {
631  gr_->flush();
632 }
633 #endif
634 
637  sec_list_->clear();
638  return;
639  }
640  SecPos spos;
641  double d, dist, d2r, x;
642  Section *sec, *sec1, *sec2, *rootsec;
643  Node *nd, *nd1, *nd2, *rootnode;
644  sec1 = begin_section_;
645  sec2 = end_section_;
646  v_setup_vectors();
647  sec_list_->clear(); // v_setup_vectors() may recurse once.
648  nd1 = node_exact(sec1, x_begin_);
649  nd2 = node_exact(sec2, x_end_);
650 
651  dist = topol_distance(sec1, nd1, sec2, nd2, &rootsec, &rootnode);
652  // printf("dist=%g\n", dist);
653  if (!rootnode) {
654  hoc_execerror("SpacePlot", "No path from begin to end points");
655  }
656  d2r = topol_distance(sec1, nd1, rootsec, rootnode, &rootsec, &rootnode);
657 #if 0
658  gr_->erase_most();
659  gr_->new_size(-d2r, -80, dist-d2r, 40);
660  gr_->xaxis(0,1,1);
661  gr_->yaxis(0,1,1);
662  Coord y1=gr_->y1(), y2 = gr_->y2();
663  gr_->new_size(-d2r - dist/10, y1 - (y2-y1)/10, dist*1.1 - d2r, y2 + (y2-y1)/10);
664 #endif
665 
666  nd = nd1;
667  sec = sec1;
668  d = -d2r + node_dist(sec, nd);
669  while (nd != rootnode) {
670  x = node_dist(sec, nd);
671  spos.sec = sec;
672  spos.x = nrn_arc_position(sec, nd);
673  spos.len = d - x;
674  // printf("%s(%g) at %g %g\n", secname(spos.sec), spos.x, spos.len, x);
675  sec_list_->push_back(spos);
676  if (x == 0.) {
678  d += node_dist(sec, nd);
679  }
680  nd = nrn_parent_node(nd);
681  }
682 
683  if (sec) {
684  spos.sec = sec;
685  } else {
686  spos.sec = nd->child;
687  }
688  spos.x = nrn_arc_position(spos.sec, nd);
689  spos.len = 0.;
690  // printf("%s(%g) at %g root\n", secname(spos.sec), spos.x, spos.len);
691  sec_list_->push_back(spos);
692 
693  long indx = sec_list_->size();
694 
695  nd = nd2;
696  sec = sec2;
697  d = dist - d2r - node_dist(sec, nd);
698  while (nd != rootnode) {
699  x = node_dist(sec, nd);
700  spos.sec = sec;
701  spos.x = nrn_arc_position(sec, nd);
702  spos.len = d + x;
703  // printf("%s(%g) at %g\n", secname(spos.sec), spos.x, spos.len);
704  sec_list_->insert(sec_list_->begin() + indx, spos);
705  if (x == 0.) {
707  d -= node_dist(sec, nd);
708  }
709  nd = nrn_parent_node(nd);
710  }
711  for (sec = rootsec; sec->parentsec; sec = sec->parentsec) {
712  }
713  nd = sec->parentnode;
714  d2root_ = topol_distance(rootsec, rootnode, sec, nd, &sec, &nd);
715 // debugging
716 #if 0
717 printf("debugging\n");
718  long cnt, icnt;
719  cnt = sec_list_->count();
720  for (icnt=0; icnt<cnt; ++icnt) {
721  printf("%s(%g) at %g\n", secname(sec_list_->item(icnt).sec),
722  sec_list_->item(icnt).x, sec_list_->item(icnt).len);
723  }
724 #endif
725 }
726 
727 RangeExpr::RangeExpr(const char* expr, Object* pycall, SecPosList* spl) {
728  spl_ = spl;
729  n_ = 0;
730  val_ = NULL;
731  exist_ = NULL;
732  if (pycall) {
735  } else {
736  cmd_ = new HocCommand(pycall);
737  }
738  return;
739  }
740  char buf[256];
741  const char* p1;
742  char* p2;
743  sprintf(buf, "hoc_ac_ = ");
744  p2 = buf + strlen(buf);
745  for (p1 = expr; *p1;) {
746  if (p1[0] == '$' && p1[1] == '1') {
747  p1 += 2;
748  strcpy(p2, "hoc_ac_");
749  p2 += 7;
750  } else {
751  *p2++ = *p1++;
752  }
753  }
754  *p2 = '\0';
755  cmd_ = new HocCommand(buf);
756 }
757 
759  if (val_) {
760  delete[] val_;
761  delete[] exist_;
762  }
763  delete cmd_;
764 }
765 
766 
768  if (n_ != spl_->size()) {
769  if (val_) {
770  delete[] val_;
771  delete[] exist_;
772  }
773  n_ = spl_->size();
774  if (n_) {
775  val_ = new double[n_];
776  exist_ = new bool[n_];
777  }
778  }
779  int temp = hoc_execerror_messages;
780  for (long i = 0; i < n_; ++i) {
781  nrn_pushsec((*spl_)[i].sec);
782  hoc_ac_ = (*spl_)[i].x;
784  if (cmd_->pyobject()) {
786  int err = 0; // no messages
787  val_[i] = cmd_->func_call(1, &err); // return err==0 means success
788  exist_[i] = err ? false : true;
789  if (err) {
790  val_[i] = 0.0;
791  }
792  nrn_popsec();
793  continue;
794  }
795  if (cmd_->execute(bool(false)) == 0) {
796  exist_[i] = true;
797  val_[i] = 0.;
798  } else {
799  exist_[i] = false;
800 #if 0
801  printf("RangeExpr: %s no exist at %s(%g)\n",
802  cmd_->name(), secname((*spl_)[i].sec),
803  (*spl_)[i].x
804  );
805 #endif
806  }
807  nrn_popsec();
808  }
809  hoc_execerror_messages = temp;
810 }
811 
813  for (long i = 0; i < n_; ++i) {
814  if (exist_[i]) {
815  nrn_pushsec((*spl_)[i].sec);
816  hoc_ac_ = (*spl_)[i].x;
817  if (cmd_->pyobject()) {
819  int err = 1; // messages
820  val_[i] = cmd_->func_call(1, &err);
821  } else {
822  cmd_->execute(bool(false));
823  val_[i] = hoc_ac_;
824  }
825  nrn_popsec();
826  }
827  }
828 }
829 
830 bool RangeExpr::exists(int i) {
831  if (i < n_) {
832  return exist_[i];
833  } else {
834  return false;
835  }
836 }
837 
838 double* RangeExpr::pval(int i) {
839  if (i < n_) {
840  return val_ + i;
841  } else {
842  return 0;
843  }
844 }
#define Coord
Definition: _defines.h:19
const char * secname(Section *sec)
Definition: cabcode.cpp:1776
void nrn_pushsec(Section *sec)
Definition: cabcode.cpp:99
double nrn_arc_position(Section *sec, Node *node)
Definition: cabcode.cpp:1867
Section * nrn_trueparent(Section *sec)
Definition: cabcode.cpp:1666
int nrn_exists(Symbol *s, Node *node)
Definition: cabcode.cpp:1319
void nrn_popsec(void)
Definition: cabcode.cpp:123
char * hoc_section_pathname(Section *sec)
Definition: cabcode.cpp:1835
Node * node_exact(Section *sec, double x)
Definition: cabcode.cpp:1940
const Brush * brush(int) const
const Color * color(int) const
Definition: graph.h:57
GraphLine * add_var(const char *, const Color *, const Brush *, bool usepointer, int fixtype=1, double *p=NULL, const char *lab=NULL, Object *obj=NULL)
virtual void request(Requisition &) const
virtual void update(Observable *)
double func_call(int narg, int *perr=NULL)
Definition: objcmd.cpp:147
Object * pyobject()
Definition: objcmd.h:33
int execute(bool notify=true)
Definition: objcmd.cpp:102
const char * name()
Definition: objcmd.cpp:81
double ** py_
Definition: spaceplt.cpp:65
NoIVGraphVector(const char *)
Definition: spaceplt.cpp:68
void add(float, double *)
Definition: spaceplt.cpp:92
virtual ~NoIVGraphVector()
Definition: spaceplt.cpp:75
CopyString name_
Definition: spaceplt.cpp:63
Definition: ivoc.h:36
void notify_detach(Observer *)
void notify_attach(Observer *)
RangeExpr(const char *expr, Object *pyobj, SecPosList *)
Definition: spaceplt.cpp:727
long n_
Definition: spaceplt.cpp:48
void fill()
Definition: spaceplt.cpp:767
double * pval(int)
Definition: spaceplt.cpp:838
virtual ~RangeExpr()
Definition: spaceplt.cpp:758
bool * exist_
Definition: spaceplt.cpp:51
void compute()
Definition: spaceplt.cpp:812
double * val_
Definition: spaceplt.cpp:50
SecPosList * spl_
Definition: spaceplt.cpp:49
HocCommand * cmd_
Definition: spaceplt.cpp:52
bool exists(int)
Definition: spaceplt.cpp:830
int get_color(void)
Definition: spaceplt.cpp:376
void x_end(float, Section *)
Definition: spaceplt.cpp:429
double d2root_
Definition: spaceplt.cpp:149
void list(Object *)
Definition: spaceplt.cpp:599
SecPosList * sec_list_
Definition: spaceplt.cpp:145
double d2root()
Definition: spaceplt.cpp:414
virtual ~RangeVarPlot()
Definition: spaceplt.cpp:357
RangeVarPlot(const char *, Object *pyobj)
Definition: spaceplt.cpp:334
void set_color(int)
Definition: spaceplt.cpp:381
void origin(float)
Definition: spaceplt.cpp:409
RangeExpr * rexp_
Definition: spaceplt.cpp:142
void x_begin(float, Section *)
Definition: spaceplt.cpp:418
int struc_changed_
Definition: spaceplt.cpp:148
float left()
Definition: spaceplt.cpp:440
void set_x()
Definition: spaceplt.cpp:635
Section * end_section_
Definition: spaceplt.cpp:143
float x_begin_
Definition: spaceplt.cpp:144
void compute()
Definition: spaceplt.cpp:456
float x_end_
Definition: spaceplt.cpp:144
CopyString expr_
Definition: spaceplt.cpp:146
float origin_
Definition: spaceplt.cpp:144
Section * begin_section_
Definition: spaceplt.cpp:143
float right()
Definition: spaceplt.cpp:448
void fill_pointers()
Definition: spaceplt.cpp:540
int shape_changed_
Definition: spaceplt.cpp:147
virtual void unref() const
Definition: resource.cpp:52
Section * sec
Definition: spaceplt.cpp:33
float x
Definition: spaceplt.cpp:31
float len
Definition: spaceplt.cpp:32
const char * string() const
Definition: string.h:139
static XYView * current_pick_view()
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)
static int indx
Definition: deriv.cpp:294
double chkarg(int, double low, double high)
Definition: code2.cpp:638
static void update(NrnThread *)
Definition: fadvance.cpp:597
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:754
BrushPalette * brushes
ColorPalette * colors
char buf[512]
Definition: init.cpp:13
int hoc_is_str_arg(int narg)
Definition: code.cpp:752
double * hoc_val_pointer(const char *s)
Definition: code2.cpp:727
Vect * vector_arg(int i)
Definition: ivocvect.cpp:397
double hoc_ac_
Definition: hoc_init.cpp:397
Symbol * hoc_lookup(const char *)
#define IFGUI
Definition: hocdec.h:372
#define getarg
Definition: hocdec.h:15
#define gargstr
Definition: hocdec.h:14
#define ENDGUI
Definition: hocdec.h:373
hoc_Item * hoc_l_lappendsec(hoc_List *, struct Section *)
Object ** hoc_objgetarg(int)
Definition: code.cpp:1587
int ifarg(int)
Definition: code.cpp:1581
void hoc_pushx(double)
double var(InputIterator begin, InputIterator end)
Definition: ivocvect.h:101
#define Vect
Definition: ivocvect.h:14
#define pval
Definition: md1redef.h:32
#define v
Definition: md1redef.h:4
#define sec
Definition: md1redef.h:13
#define i
Definition: md1redef.h:12
char * name
Definition: init.cpp:16
#define printf
Definition: mwprefix.h:26
void v_setup_vectors()
Definition: treeset.cpp:1631
void section_ref(Section *)
Definition: solve.cpp:575
double node_dist(Section *, Node *)
Definition: solve.cpp:155
double topol_distance(Section *, Node *, Section *, Node *, Section **, Node **)
Definition: solve.cpp:169
void section_unref(Section *)
Definition: solve.cpp:565
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
Definition: point.cpp:185
for(i=0;i< n;i++)
size_t p
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1560
static double save(void *v)
Definition: ocbox.cpp:346
#define g
Definition: passive0.cpp:21
#define color
Definition: rbtqueue.cpp:50
check_obj_type(o, "SectionList")
o
Definition: seclist.cpp:175
Node * nrn_parent_node(Node *)
Definition: treeset.cpp:838
static double s_right(void *v)
Definition: spaceplt.cpp:183
int node_index(Section *, double)
Definition: cabcode.cpp:1471
int hoc_execerror_messages
Definition: hoc.cpp:680
static double from_vector(void *v)
Definition: spaceplt.cpp:261
int nrn_multisplit_active_
Definition: multisplit.cpp:15
int nrn_shape_changed_
Definition: neuron.h:33
static void s_destruct(void *v)
Definition: spaceplt.cpp:319
int structure_change_cnt
Definition: spaceplt.cpp:24
static double to_vector(void *v)
Definition: spaceplt.cpp:239
static double s_list(void *v)
Definition: spaceplt.cpp:188
void RangeVarPlot_reg()
Definition: spaceplt.cpp:325
static Member_func s_members[]
Definition: spaceplt.cpp:280
static double s_begin(void *v)
Definition: spaceplt.cpp:152
static double s_color(void *v)
Definition: spaceplt.cpp:195
static double s_end(void *v)
Definition: spaceplt.cpp:160
int hoc_return_type_code
Definition: code.cpp:42
static double s_left(void *v)
Definition: spaceplt.cpp:178
static Object ** rvp_vector(void *v)
Definition: spaceplt.cpp:228
static double s_origin(void *v)
Definition: spaceplt.cpp:168
std::vector< SecPos > SecPosList
Definition: spaceplt.cpp:36
Object *(* nrnpy_rvp_rxd_to_callable)(Object *)=0
Definition: spaceplt.cpp:27
static void * s_cons(Object *)
Definition: spaceplt.cpp:294
static Member_ret_obj_func rvp_retobj_members[]
Definition: spaceplt.cpp:292
static double s_d2root(void *v)
Definition: spaceplt.cpp:173
static long to_vector_helper(RangeVarPlot *rvp, Vect *y)
Definition: spaceplt.cpp:206
#define cnt
Definition: spt2queue.cpp:19
#define NULL
Definition: sptree.h:16
Definition: section.h:133
Section * child
Definition: section.h:153
Definition: hocdec.h:227
void * this_pointer
Definition: hocdec.h:232
union Object::@39 u
struct Prop * prop
Definition: section.h:63
Definition: model.h:57
bool str_chooser(const char *, char *, Window *w=NULL, Coord x=400., Coord y=400.)
char * strstr(char *cs, char *ct)
Definition: xred.cpp:173