NEURON
passive0.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /* /local/src/master/nrn/src/nrnoc/passive0.cpp,v 1.2 1997/03/13 14:18:02 hines Exp */
3 
4 #include "section.h"
5 #include "membdef.h"
6 #include "nrniv_mf.h"
7 
8 #define nparm 2
9 static const char* mechanism[] = {"0", "fastpas", "g_fastpas", "e_fastpas", 0, 0, 0};
10 static void pas_alloc(Prop* p);
11 static void pas_cur(NrnThread* nt, Memb_list* ml, int type);
12 static void pas_jacob(NrnThread* nt, Memb_list* ml, int type);
13 
14 extern "C" void passive0_reg_(void) {
15  int mechtype;
17  mechtype = nrn_get_mechtype(mechanism[1]);
18  hoc_register_prop_size(mechtype, nparm, 0);
19 }
20 
21 #define g vdata[i][0]
22 #define e vdata[i][1]
23 #define v NODEV(vnode[i])
24 
25 static void pas_cur(NrnThread* nt, Memb_list* ml, int type) {
26  int count = ml->nodecount;
27  Node** vnode = ml->nodelist;
28  double** vdata = ml->data;
29  Datum** vpdata = ml->pdata;
30  int i;
31 #if _CRAY
32 #pragma _CRI ivdep
33 #endif
34  for (i = 0; i < count; ++i) {
35  NODERHS(vnode[i]) -= g * (v - e);
36  }
37 }
38 
39 static void pas_jacob(NrnThread* nt, Memb_list* ml, int type) {
40  int count = ml->nodecount;
41  Node** vnode = ml->nodelist;
42  double** vdata = ml->data;
43  Datum** vpdata = ml->pdata;
44  int i;
45 #if _CRAY
46 #pragma _CRI ivdep
47 #endif
48  for (i = 0; i < count; ++i) {
49  NODED(vnode[i]) += g;
50  }
51 }
52 
53 /* the rest can be constructed automatically from the above info*/
54 
55 static void pas_alloc(Prop* p) {
56  double* pd;
57  pd = nrn_prop_data_alloc(p->type, nparm, p);
58  p->param_size = nparm;
59 #if defined(__MWERKS__)
60  pd[0] = 5.e-4; /*DEF_g;*/
61 #else
62  pd[0] = DEF_g;
63 #endif
64  pd[1] = DEF_e;
65  p->param = pd;
66 }
int nrn_get_mechtype(const char *mechname)
Definition: cabcode.cpp:2000
short type
Definition: cabvars.h:9
double * nrn_prop_data_alloc(int type, int count, Prop *p)
Definition: cxprop.cpp:277
void register_mech(const char **, Pvmp, Pvmi, Pvmi, Pvmi, Pvmi, int, int)
Definition: init.cpp:674
void hoc_register_prop_size(int, int, int)
Definition: init.cpp:704
#define i
Definition: md1redef.h:12
#define DEF_e
Definition: membdef.h:31
#define DEF_g
Definition: membdef.h:32
void(* Pvmi)(struct NrnThread *, Memb_list *, int)
Definition: membfunc.h:18
size_t p
#define g
Definition: passive0.cpp:21
#define e
Definition: passive0.cpp:22
void passive0_reg_(void)
Definition: passive0.cpp:14
#define v
Definition: passive0.cpp:23
static void pas_alloc(Prop *p)
Definition: passive0.cpp:55
static void pas_cur(NrnThread *nt, Memb_list *ml, int type)
Definition: passive0.cpp:25
static void pas_jacob(NrnThread *nt, Memb_list *ml, int type)
Definition: passive0.cpp:39
#define nparm
Definition: passive0.cpp:8
static const char * mechanism[]
Definition: passive0.cpp:9
#define NODERHS(n)
Definition: section.h:105
#define NODED(n)
Definition: section.h:104
int nodecount
Definition: nrnoc_ml.h:18
Node ** nodelist
Definition: nrnoc_ml.h:5
double ** data
Definition: nrnoc_ml.h:14
Datum ** pdata
Definition: nrnoc_ml.h:15
Definition: section.h:133
Represent main neuron object computed by single thread.
Definition: multicore.h:58
Definition: section.h:214
Definition: hocdec.h:177