1 #include <../../nrnconf.h>
58 std::vector<float>
x_{};
59 std::vector<neuron::container::data_handle<double>>
py_{};
62 auto const s =
x_.size();
87 virtual void save(std::ostream&);
89 virtual bool choose_sym(
Graph*);
181 for (
i = 0;
i <
cnt; ++
i) {
183 y->
elem(
i) = *rvp->py_data()->p(
i);
198 "RangeVarPlot.vector takes no arguments; were you thinking of .to_vector?");
208 hoc_execerror(
"Too many arguments",
"RangeVarPlot.to_vector takes 1 or 2 arguments.");
217 for (
i = 0;
i <
cnt; ++
i) {
219 x->
elem(
i) = rvp->x_data()->get_val(
i);
233 for (
i = 0;
i <
cnt; ++
i) {
234 *rvp->py_data()->p(
i) = y->
elem(
i);
238 for (
i = 0;
i <
cnt; ++
i) {
314 if ((
var && strstr(
var,
"$1")) || pyobj) {
430 void RangeVarPlot::request(
Requisition& req)
const {
440 o <<
"objectvar rvp_" << std::endl;
441 o <<
"rvp_ = new RangeVarPlot(\"" <<
expr_ <<
"\")" << std::endl;
444 o <<
"rvp_.origin(" <<
origin_ <<
")" << std::endl;
447 o <<
"save_window_.addobject(rvp_, " <<
colors->
color(color()) <<
", "
448 <<
brushes->
brush(brush()) <<
", " << x <<
", " << y <<
")" << std::endl;
453 bool RangeVarPlot::choose_sym(
Graph* g) {
457 while (
str_chooser(
"Range Variable or expr involving $1",
470 if (!rvp->trivial()) {
487 void SpacePlot::expr(
const char* expr) {
506 sscanf(
expr_.c_str(),
"%[^[]",
buf);
516 for (
long i = 0;
i < xcnt; ++
i) {
537 if (
i == 1 && noexist == 1) {
547 if (
i == xcnt - 1 && noexist == 0) {
572 void SpacePlot::plot() {
574 long xcnt = sec_list_->
count();
578 for (
long i=0;
i < xcnt; ++
i) {
580 *x = sec_list_->item(
i).x;
581 gr_->plot(sec_list_->item(
i).len);
588 void SpacePlot::plot() {
599 double d, dist, d2r, x;
601 Node *nd, *nd1, *nd2, *rootnode;
612 hoc_execerror(
"SpacePlot",
"No path from begin to end points");
614 d2r =
topol_distance(sec1, nd1, rootsec, rootnode, &rootsec, &rootnode);
617 gr_->new_size(-d2r, -80, dist-d2r, 40);
620 Coord y1=gr_->y1(), y2 = gr_->y2();
621 gr_->new_size(-d2r - dist/10, y1 - (y2-y1)/10, dist*1.1 - d2r, y2 + (y2-y1)/10);
627 while (nd != rootnode) {
656 while (nd != rootnode) {
669 for (
sec = rootsec;
sec->parentsec;
sec =
sec->parentsec) {
671 nd =
sec->parentnode;
678 for (icnt=0; icnt<
cnt; ++icnt) {
703 for (p1 = expr; *p1;) {
704 if (p1[0] ==
'$' && p1[1] ==
'1') {
706 strcpy(p2,
"hoc_ac_");
738 for (
long i = 0;
i <
n_; ++
i) {
746 exist_[
i] = err ? false :
true;
759 printf(
"RangeExpr: %s no exist at %s(%g)\n",
771 for (
long i = 0;
i <
n_; ++
i) {
const char * secname(Section *sec)
name of section (for use in error messages)
void nrn_pushsec(Section *sec)
double nrn_arc_position(Section *sec, Node *node)
Section * nrn_trueparent(Section *sec)
int nrn_exists(Symbol *s, Node *node)
char * hoc_section_pathname(Section *sec)
Node * node_exact(Section *sec, double x)
like node_index but give proper node when x is 0 or 1 as well as in between
const Brush * brush(int) const
const Color * color(int) const
GraphLine * add_var(const char *, const Color *, const Brush *, bool usepointer, int fixtype=1, neuron::container::data_handle< double > p={}, const char *lab=NULL, Object *obj=NULL)
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 *)
virtual void request(Requisition &) const
virtual void update(Observable *)
double func_call(int narg, int *perr=NULL)
int execute(bool notify=true)
void notify_detach(Observer *)
void notify_attach(Observer *)
RangeExpr(const char *expr, Object *pyobj, SecPosList *)
void x_end(float, Section *)
RangeVarPlot(const char *, Object *pyobj)
void x_begin(float, Section *)
virtual void unref() const
virtual GlyphIndex count() const
static XYView * current_pick_view()
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
HocReturnType hoc_return_type_code
double chkarg(int, double low, double high)
neuron::container::data_handle< double > hoc_val_handle(std::string_view s)
int hoc_is_str_arg(int narg)
double * hoc_val_pointer(const char *s)
void check_obj_type(Object *obj, const char *type_name)
IvocVect * vector_arg(int i)
Symbol * hoc_lookup(const char *)
hoc_Item * hoc_l_lappendsec(hoc_List *, struct Section *)
Object ** hoc_objgetarg(int)
double var(InputIterator begin, InputIterator end)
void move(Item *q1, Item *q2, Item *q3)
void update(NrnThread *_nt)
void hoc_execerror(const char *s1, const char *s2)
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
void section_ref(Section *)
double node_dist(Section *, Node *)
double topol_distance(Section *, Node *, Section *, Node *, Section **, Node **)
void section_unref(Section *)
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
static double save(void *v)
Node * nrn_parent_node(Node *)
static double s_right(void *v)
int hoc_execerror_messages
static double from_vector(void *v)
int nrn_multisplit_active_
static void s_destruct(void *v)
static double to_vector(void *v)
static double s_list(void *v)
static Member_func s_members[]
static double s_begin(void *v)
static double s_color(void *v)
static double s_end(void *v)
static double s_left(void *v)
static Object ** rvp_vector(void *v)
static double s_origin(void *v)
std::vector< SecPos > SecPosList
Object *(* nrnpy_rvp_rxd_to_callable)(Object *)=0
static void * s_cons(Object *)
static Member_ret_obj_func rvp_retobj_members[]
static double s_d2root(void *v)
static long to_vector_helper(RangeVarPlot *rvp, Vect *y)
NoIVGraphVector(const char *)
std::vector< neuron::container::data_handle< double > > py_
virtual ~NoIVGraphVector()
void add(float, neuron::container::data_handle< double >)
bool str_chooser(const char *, char *, Window *w=NULL, Coord x=400., Coord y=400.)