This repository was archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathmembfunc.hpp
More file actions
202 lines (174 loc) · 7.29 KB
/
membfunc.hpp
File metadata and controls
202 lines (174 loc) · 7.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*
Copyright (c) 2016, Blue Brain Project
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <vector>
#include "coreneuron/mechanism/mechanism.hpp"
namespace coreneuron {
using Pfrpdat = Datum* (*)(void);
struct NrnThread;
using mod_alloc_t = void (*)(double*, Datum*, int);
using mod_f_t = void (*)(NrnThread*, Memb_list*, int);
using pnt_receive_t = void (*)(Point_process*, int, double);
/*
* Memb_func structure contains all related informations of a mechanism
*/
struct Memb_func {
mod_alloc_t alloc;
mod_f_t current;
mod_f_t jacob;
mod_f_t state;
mod_f_t initialize;
Pfri destructor; /* only for point processes */
Symbol* sym;
int vectorized;
int thread_size_; /* how many Datum needed in Memb_list if vectorized */
void (*thread_mem_init_)(ThreadDatum*); /* after Memb_list._thread is allocated */
void (*thread_cleanup_)(ThreadDatum*); /* before Memb_list._thread is freed */
void (*thread_table_check_)(int, int, double*, Datum*, ThreadDatum*, NrnThread*, int);
int is_point;
void (*setdata_)(double*, Datum*);
int* dparam_semantics; /* for nrncore writing. */
};
#define VINDEX -1
#define CABLESECTION 1
#define MORPHOLOGY 2
#define CAP 3
#define EXTRACELL 5
#define nrnocCONST 1
#define DEP 2
#define STATE 3 /*See init.c and cabvars.h for order of nrnocCONST, DEP, and STATE */
#define BEFORE_INITIAL 0
#define AFTER_INITIAL 1
#define BEFORE_BREAKPOINT 2
#define AFTER_SOLVE 3
#define BEFORE_STEP 4
#define BEFORE_AFTER_SIZE 5 /* 1 more than the previous */
struct BAMech {
mod_f_t f;
int type;
struct BAMech* next;
};
extern int nrn_ion_global_map_size;
extern double** nrn_ion_global_map;
extern const int ion_global_map_member_size;
#define NRNPOINTER \
4 /* added on to list of mechanism variables.These are \
pointers which connect variables from other mechanisms via the _ppval array. \
*/
#define _AMBIGUOUS 5
extern int nrn_get_mechtype(const char*);
extern const char* nrn_get_mechname(int); // slow. use memb_func[i].sym if posible
extern int register_mech(const char** m,
mod_alloc_t alloc,
mod_f_t cur,
mod_f_t jacob,
mod_f_t stat,
mod_f_t initialize,
int nrnpointerindex,
int vectorized);
extern int point_register_mech(const char**,
mod_alloc_t alloc,
mod_f_t cur,
mod_f_t jacob,
mod_f_t stat,
mod_f_t initialize,
int nrnpointerindex,
void* (*constructor)(),
void (*destructor)(),
int vectorized);
using NetBufReceive_t = void (*)(NrnThread*);
extern void hoc_register_net_receive_buffering(NetBufReceive_t, int);
extern void hoc_register_net_send_buffering(int);
using nrn_watch_check_t = void (*)(NrnThread*, Memb_list*);
extern void hoc_register_watch_check(nrn_watch_check_t, int);
extern void nrn_jacob_capacitance(NrnThread*, Memb_list*, int);
extern void nrn_writes_conc(int, int);
#pragma acc routine seq
extern void nrn_wrote_conc(int, double*, int, int, double**, double, int);
#pragma acc routine seq
double nrn_nernst(double ci, double co, double z, double celsius);
extern void hoc_register_prop_size(int, int, int);
extern void hoc_register_dparam_semantics(int type, int, const char* name);
struct DoubScal {
const char* name;
double* pdoub;
};
struct DoubVec {
const char* name;
double* pdoub;
int index1;
};
struct VoidFunc {
const char* name;
void (*func)(void);
};
extern void hoc_register_var(DoubScal*, DoubVec*, VoidFunc*);
extern void _nrn_layout_reg(int, int);
extern void _nrn_thread_reg0(int i, void (*f)(ThreadDatum*));
extern void _nrn_thread_reg1(int i, void (*f)(ThreadDatum*));
using bbcore_read_t = void (*)(double*,
int*,
int*,
int*,
int,
int,
double*,
Datum*,
ThreadDatum*,
NrnThread*,
double);
using bbcore_write_t = void (*)(double*,
int*,
int*,
int*,
int,
int,
double*,
Datum*,
ThreadDatum*,
NrnThread*,
double);
extern int nrn_mech_depend(int type, int* dependencies);
extern int nrn_fornetcon_cnt_;
extern int* nrn_fornetcon_type_;
extern int* nrn_fornetcon_index_;
extern void add_nrn_fornetcons(int, int);
extern void add_nrn_has_net_event(int);
extern void net_event(Point_process*, double);
extern void net_send(void**, int, Point_process*, double, double);
extern void net_move(void**, Point_process*, double);
extern void artcell_net_send(void**, int, Point_process*, double, double);
extern void artcell_net_move(void**, Point_process*, double);
extern void nrn2ncs_outputevent(int netcon_output_index, double firetime);
extern bool nrn_use_localgid_;
extern void net_sem_from_gpu(int sendtype, int i_vdata, int, int ith, int ipnt, double, double);
#pragma acc routine seq
extern int at_time(NrnThread*, double);
// _OPENACC and/or NET_RECEIVE_BUFFERING
extern void net_sem_from_gpu(int, int, int, int, int, double, double);
extern void hoc_malchk(void); /* just a stub */
extern void* hoc_Emalloc(size_t);
} // namespace coreneuron