1 #include <../../nrnconf.h>
30 static const char**
make_m(
bool,
int&,
Symlist*,
char*,
char*);
56 *px = hoc_look_inside_stack<double>(
i);
59 Object* o = hoc_look_inside_stack<Object*>(
i);
62 (*nrnpy_o2loc_p_)(o, psec, px);
101 if (!pp || !pp->
prop) {
109 if (strcmp(
name,
"loc") == 0) {
122 }
else if (strcmp(
name,
"has_loc") == 0) {
126 }
else if (strcmp(
name,
"get_loc") == 0) {
184 for (
i = 0;
i <
cnt; ++
i) {
192 for (
i = 0;
i <
cnt; ++
i) {
202 void(hm_alloc)(
Prop*),
219 register_mech(m, hm_alloc, cur, jacob, stat, initialize, -1, 0);
239 char* parnames =
NULL;
241 parnames =
new char[strlen(
gargstr(3)) + 1];
246 if (!classsym || classsym->
type != TEMPLATE) {
251 const char** m =
make_m(
true,
cnt, slist, mname, parnames);
256 std::vector<std::pair<std::string, int>> params{};
257 std::vector<std::pair<std::string, std::string>> dparams{};
260 for (sp = slist->
first; sp; sp = sp->
next) {
267 for (
i = 0;
i <
cnt; ++
i) {
282 char* parnames =
NULL;
284 parnames =
new char[strlen(
gargstr(2)) + 1];
289 if (!classsym || classsym->
type != TEMPLATE) {
298 fprintf(stderr,
"%d object(s) of type %s already exist.\n", tp->
count, classsym->
name);
299 hoc_execerror(
"Can't make a template into a PointProcess when instances already exist", 0);
302 const char** m =
make_m(
false,
cnt, slist, classsym->
name, parnames);
320 std::vector<std::pair<std::string, int>> params{};
321 std::vector<std::pair<std::string, std::string>> dparams{};
322 dparams.emplace_back(
"",
"area");
323 dparams.emplace_back(
"",
"pntproc");
353 for (
i = 0;
i <
cnt; ++
i) {
371 for (sp = slist->
first; sp; sp = sp->
next) {
372 if (sp->
type == VAR) {
379 const char** m =
new const char*[
cnt];
380 for (
i = 0;
i <
cnt; ++
i) {
389 cc =
new char[strlen(mname) + 1];
409 char *cp, *csp =
NULL;
411 for (cp = parnames; cp && *cp; cp = csp) {
412 csp = strchr(cp,
' ');
416 if (!isalpha(*csp)) {
429 auto cc_size = strlen(cp) + strlen(m[1]) + 20;
430 cc =
new char[cc_size];
434 std::snprintf(cc, cc_size,
"%s[%d]",
buf, imax);
436 std::snprintf(cc, cc_size,
"%s",
buf);
445 for (sp = slist->
first; sp; sp = sp->
next) {
454 for (
j = 1;
j < jmax; ++
j) {
455 if (strstr(m[
j],
buf)) {
463 auto cc_size = strlen(
buf) + 20;
464 cc =
new char[cc_size];
468 std::snprintf(cc, cc_size,
"%s[%d]",
buf, imax);
470 std::snprintf(cc, cc_size,
"%s",
buf);
void nrn_pushsec(Section *sec)
double nrn_arc_position(Section *sec, Node *node)
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
std::vector< double > parm_default
Symbol * hoc_table_lookup(const char *, Symlist *)
Datum * nrn_prop_datum_alloc(int type, int count, Prop *p)
void hoc_construct_point(Object *, int)
size_t hoc_total_array_data(const Symbol *s, Objectdata *obd)
int hoc_inside_stacktype(int i)
Symbol * hoc_install(const char *, int, double, Symlist **)
double hoc_call_objfunc(Symbol *s, int narg, Object *ob)
void hoc_retpushx(double x)
char * hoc_object_name(Object *ob)
Symbol * hoc_lookup(const char *)
static void after_step(neuron::model_sorted_token const &, NrnThread *nt, Memb_list *ml, int type)
void hoc_unlink_symbol(Symbol *, Symlist *)
static void check_list(const char *s, Symlist *sl)
Point_process * ob2pntproc(Object *ob)
void print_symlist(const char *, Symlist *)
cTemplate ** nrn_pnt_template_
Object * hoc_new_opoint(int)
Point_process * ob2pntproc_0(Object *ob)
static void alloc_pnt(Prop *p)
int special_pnt_call(Object *ob, Symbol *sym, int narg)
Object * hoc_newobj1(Symbol *, int)
static Object * last_created_pp_ob_
static void seg_or_x_arg_inside_stack(int i, Section **psec, double *px)
static void check(const char *s)
void nrn_loc_point_process(int, Point_process *, Section *, Node *)
int point_reg_helper(Symbol *)
static const char ** make_m(bool, int &, Symlist *, char *, char *)
static HocMech * common_register(const char **m, Symbol *classsym, Symlist *slist, void(hm_alloc)(Prop *), int &type)
static void initial(neuron::model_sorted_token const &, NrnThread *nt, Memb_list *ml, int type)
static void alloc_mech(Prop *p)
static void call(Symbol *s, Node *nd, Prop *p)
void hoc_link_symbol(Symbol *, Symlist *)
void(*)(neuron::model_sorted_token const &, NrnThread *, Memb_list *, int) nrn_cur_t
void hoc_execerror(const char *s1, const char *s2)
int nrn_get_mechtype(const char *name)
Get mechanism type by the mechanism name.
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, mod_f_t private_constructor, mod_f_t private_destructor, int nrnpointerindex, int vectorized)
void register_data_fields(int mechtype, std::vector< std::pair< std::string, int >> const ¶m_info, std::vector< std::pair< std::string, std::string >> const &dparam_info)
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
static Node * node(Object *)
void * create_point_process(int, Object *)
double get_loc_point_process(void *)
std::vector< Memb_func > memb_func
void hoc_register_cvode(int i, nrn_ode_count_t cnt, nrn_ode_map_t map, nrn_ode_spec_t spec, nrn_ode_matsol_t matsol)
void hoc_register_parm_default(int mechtype, const std::vector< double > *pd)
void(* nrnpy_o2loc_p_)(Object *, Section **, double *)
A view into a set of mechanism instances.
Represent main neuron object computed by single thread.
A point process is computed just like regular mechanisms.
struct Symbol::@45::@46 rng