1 #include <../../nrnconf.h> 61 void add(
float,
double*);
86 py_ =
new double*[size_];
87 x_ =
new float[size_];
91 if ( count_ == size_) {
93 double** py =
new double*[size_];
94 float* px =
new float[size_];
95 for (
int i=0;
i<count_;
i++) {
118 virtual void save(ostream&);
120 virtual bool choose_sym(
Graph*);
136 void fill_pointers();
194 int old_color = me -> get_color();
206 long i, cnt = rvp->
count();
210 for (i=0; i <
cnt; ++
i) {
212 y->elem(i) = *rvp->py_data()->p(i);
215 y->elem(i) = *rvp->
py_[
i];
226 hoc_execerror(
"Too many arguments",
"RangeVarPlot.vector takes no arguments; were you thinking of .to_vector?");
231 return y->temp_objvar();
236 hoc_execerror(
"Too many arguments",
"RangeVarPlot.to_vector takes 1 or 2 arguments.");
245 for (i=0; i <
cnt; ++
i) {
247 x->elem(i) = rvp->x_data()->get_val(i);
249 x->elem(i) = rvp->
x_[
i];
261 for (i=0; i <
cnt; ++
i) {
262 *rvp->py_data()->p(i) = y->elem(i);
265 long i, cnt = rvp->
count();
266 for (i=0; i <
cnt; ++
i) {
268 *rvp->
py_[
i] = y->elem(i);
345 if ((var &&
strstr(var,
"$1")) || pyobj) {
457 void RangeVarPlot::request(
Requisition& req)
const {
468 o <<
"objectvar rvp_" << endl;
479 sprintf(buf,
"save_window_.addobject(rvp_, %d, %d, %g, %g)",
486 bool RangeVarPlot::choose_sym(
Graph*
g) {
490 while (
str_chooser(
"Range Variable or expr involving $1", s,
502 if (!rvp->trivial()) {
504 rvp->label(g->
label(s));
508 printf(
"%s doesn't exist along the path %s(%g)", s,
520 void SpacePlot::expr(
const char* expr) {
549 for (
long i=0;
i < xcnt; ++
i) {
569 if (
i == 1 && noexist == 1) {
579 if (
i == xcnt - 1 && noexist == 0) {
593 for (i = 0; i <
cnt; ++
i) {
605 void SpacePlot::plot() {
611 for (
long i=0;
i < xcnt; ++
i) {
621 void SpacePlot::plot() {
632 double d, dist, d2r, x;
634 Node*
nd, *nd1, *nd2, *rootnode;
645 hoc_execerror(
"SpacePlot",
"No path from begin to end points");
647 d2r =
topol_distance(sec1, nd1, rootsec, rootnode, &rootsec, &rootnode);
650 gr_->new_size(-d2r, -80, dist-d2r, 40);
653 Coord y1=gr_->y1(), y2 = gr_->y2();
654 gr_->new_size(-d2r - dist/10, y1 - (y2-y1)/10, dist*1.1 - d2r, y2 + (y2-y1)/10);
657 nd = nd1; sec = sec1;
659 while (nd != rootnode) {
685 nd = nd2; sec = sec2;
687 while (nd != rootnode) {
708 for (icnt=0; icnt<
cnt; ++icnt) {
732 p2 = buf + strlen(buf);
733 for (p1 = expr; *p1;) {
734 if (p1[0] ==
'$' && p1[1] ==
'1') {
736 strcpy(p2,
"hoc_ac_");
756 if (n_ != spl_->count()) {
763 val_ =
new double[n_];
764 exist_ =
new bool[n_];
768 for (
long i=0;
i < n_; ++
i) {
772 if (cmd_->pyobject()) {
775 val_[
i] = cmd_->func_call(1, &err);
776 exist_[
i] = err ? false :
true;
777 if (err) { val_[
i] = 0.0; }
781 if (cmd_->execute(
bool(
false)) == 0) {
787 printf(
"RangeExpr: %s no exist at %s(%g)\n",
788 cmd_->name(),
secname(spl_->item(
i).sec),
799 for (
long i=0;
i < n_; ++
i) {
803 if (cmd_->pyobject()) {
806 val_[
i] = cmd_->func_call(1, &err);
808 cmd_->execute(
bool(
false));
static double s_list(void *v)
static double compute(void *v)
char * hoc_section_pathname(Section *sec)
char * strstr(cs, ct) char *cs
int hoc_is_str_arg(int narg)
static void s_destruct(void *v)
RangeExpr(const char *expr, Object *pyobj, SecPosList *)
struct Section * parentsec
double node_dist(Section *, Node *)
virtual ~NoIVGraphVector()
double nrn_arc_position(Section *sec, Node *node)
Symbol * hoc_lookup(const char *)
static double from_vector(void *v)
static void update(NrnThread *)
check_obj_type(o, "SectionList")
void add_graphVector(GraphVector *)
GLabel * label(float x, float y, const char *s, int fixtype, float scale, float x_align, float y_align, const Color *)
GraphLine * add_var(const char *, const Color *, const Brush *, bool usepointer, int fixtype=1, double *p=NULL, const char *lab=NULL, Object *obj=NULL)
int node_index(Section *, double)
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
const char * string() const
int nrn_multisplit_active_
void notify_detach(Observer *)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static void * s_cons(Object *)
int nrn_exists(Symbol *s, Node *node)
const char * secname(Section *sec)
static Object ** rvp_vector(void *v)
void nrn_pushsec(Section *sec)
static double s_color(void *v)
declareList(SecPosList, SecPos)
double topol_distance(Section *, Node *, Section *, Node *, Section **, Node **)
void hoc_execerror(const char *, const char *)
static long to_vector_helper(RangeVarPlot *rvp, Vect *y)
const Brush * brush(int) const
Object *(* nrnpy_rvp_rxd_to_callable)(Object *)=0
static double s_end(void *v)
virtual void unref() const
Node * nrn_parent_node(Node *)
void x_end(float, Section *)
void notify_attach(Observer *)
virtual void update(Observable *)
static Member_ret_obj_func rvp_retobj_members[]
RangeVarPlot(const char *, Object *pyobj)
void section_ref(Section *)
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
void x_begin(float, Section *)
bool str_chooser(const char *, char *, Window *w=NULL, Coord x=400., Coord y=400.)
NoIVGraphVector(const char *)
static double save(void *v)
double * hoc_val_pointer(const char *s)
static double s_right(void *v)
static double s_d2root(void *v)
Section * nrn_trueparent(Section *sec)
static double s_origin(void *v)
static double s_begin(void *v)
static XYView * current_pick_view()
void section_unref(Section *)
implementList(SecPosList, SecPos)
void add(float, double *)
Object ** hoc_objgetarg(int)
const Color * color(int) const
static double s_left(void *v)
double var(InputIterator begin, InputIterator end)
static double to_vector(void *v)
Node * node_exact(Section *sec, double x)
double chkarg(int, double low, double high)
virtual void request(Requisition &) const
hoc_Item * hoc_l_lappendsec(hoc_List *, struct Section *)
int hoc_execerror_messages
static Member_func s_members[]