NEURON
cachevec.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 
3 // some functions needed by CACHEVEC. mostly to steer to the various update_ptrs
4 // methods.
5 
6 #if HAVE_IV
7 #include <shapeplt.h>
8 #include <graph.h>
9 #include <ivoc.h>
10 #include <xmenu.h>
11 #endif
12 
13 #include <ocnotify.h>
14 #include <mymath.h>
15 #include <nrnoc2iv.h>
16 #include <parse.hpp>
17 #include <cvodeobj.h>
18 #include <netcvode.h>
19 #include <hoclist.h>
20 #include <ocpointer.h>
21 #include <ocptrvector.h>
22 
23 void nrniv_recalc_ptrs();
24 extern "C" double* nrn_recalc_ptr(double*);
26 
27 extern void nrn_linmod_update_ptrs(void*);
28 
29 static Symbol* grsym_;
30 static Symbol* ptrsym_;
31 static Symbol* lmsym_;
32 static Symbol* pshpsym_;
34 
36  // PlayRecord and PreSyn pointers
38  hoc_List* hl;
39  hoc_Item* q;
40 #if HAVE_IV
41  // update pointers used by Graph
42  if (!grsym_) {
43  grsym_ = hoc_lookup("Graph");
44  assert(grsym_->type == TEMPLATE);
45  }
46  hl = grsym_->u.ctemplate->olist;
47  ITERATE(q, hl) {
48  Object* obj = OBJ(q);
49  Graph* g = (Graph*) obj->u.this_pointer;
50  if (g) {
51  g->update_ptrs();
52  }
53  }
54  // update pointers used by PlotShape
55  if (!pshpsym_) {
56  pshpsym_ = hoc_lookup("PlotShape");
57  assert(pshpsym_->type == TEMPLATE);
58  }
59  hl = pshpsym_->u.ctemplate->olist;
60  ITERATE(q, hl) {
61  Object* obj = OBJ(q);
62  ShapePlot* ps = (ShapePlot*) obj->u.this_pointer;
63  if (ps) {
64  ps->update_ptrs();
65  }
66  }
67  // update pointers used by xpanel
68  HocPanel::update_ptrs();
69 #endif
70  // update pointers used by Pointer
71  if (!ptrsym_) {
72  ptrsym_ = hoc_lookup("Pointer");
73  assert(ptrsym_->type == TEMPLATE);
74  }
75  hl = ptrsym_->u.ctemplate->olist;
76  ITERATE(q, hl) {
77  Object* obj = OBJ(q);
78  OcPointer* op = (OcPointer*) obj->u.this_pointer;
79  if (op && op->p_) {
80  double* pd = nrn_recalc_ptr(op->p_);
81  if (op->p_ != pd) {
83  op->p_ = pd;
84  op->valid_ = true;
86  }
87  }
88  }
89  // update what LinearMechanisms are observing
90  if (!lmsym_) {
91  lmsym_ = hoc_lookup("LinearMechanism");
92  assert(lmsym_->type == TEMPLATE);
93  }
94  hl = lmsym_->u.ctemplate->olist;
95  ITERATE(q, hl) {
96  Object* obj = OBJ(q);
97  void* pt = (void*) obj->u.this_pointer;
98  if (pt) {
100  }
101  }
102 }
103 
105  // update pointers used by PtrVector
106  hoc_List* hl;
107  hoc_Item* q;
108  if (!ptrvecsym_) {
109  ptrvecsym_ = hoc_lookup("PtrVector");
110  assert(ptrvecsym_->type == TEMPLATE);
111  }
112  hl = ptrvecsym_->u.ctemplate->olist;
113  ITERATE(q, hl) {
114  Object* obj = OBJ(q);
115  OcPtrVector* op = (OcPtrVector*) obj->u.this_pointer;
116  op->ptr_update();
117  }
118 }
void nrniv_recalc_ptrs()
Definition: cachevec.cpp:35
static Symbol * ptrsym_
Definition: cachevec.cpp:30
static Symbol * lmsym_
Definition: cachevec.cpp:31
double * nrn_recalc_ptr(double *)
Definition: treeset.cpp:2179
static Symbol * grsym_
Definition: cachevec.cpp:29
static Symbol * pshpsym_
Definition: cachevec.cpp:32
static Symbol * ptrvecsym_
Definition: cachevec.cpp:33
NetCvode * net_cvode_instance
Definition: cvodestb.cpp:27
void nrn_linmod_update_ptrs(void *)
Definition: linmod1.cpp:49
void nrn_recalc_ptrvector()
Definition: cachevec.cpp:104
Definition: graph.h:57
void recalc_ptrs()
Definition: netcvode.cpp:6854
bool valid_
Definition: ocpointer.h:18
double * p_
Definition: ocpointer.h:15
void ptr_update()
Definition: ocptrvector.cpp:69
Symbol * hoc_lookup(const char *)
#define assert(ex)
Definition: hocassrt.h:32
#define OBJ(q)
Definition: hoclist.h:67
void nrn_notify_when_double_freed(double *p, Observer *ob)
Definition: ivoc.cpp:61
void nrn_notify_pointer_disconnect(Observer *ob)
Definition: ivoc.cpp:70
#define ITERATE(itm, lst)
Definition: model.h:25
size_t q
if(status)
#define g
Definition: passive0.cpp:21
Definition: hocdec.h:227
void * this_pointer
Definition: hocdec.h:232
union Object::@39 u
Definition: model.h:57
short type
Definition: model.h:58
union Symbol::@18 u
HocStruct cTemplate * ctemplate
Definition: hocdec.h:152
hoc_List * olist
Definition: hocdec.h:204