Skip to content

Commit

Permalink
C++ compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
olupton committed Dec 15, 2022
1 parent 4214639 commit 632a07e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Na12 Analysis/mechanisms/ProbAMPANMDA_EMS.mod
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#ifndef NRN_VERSION_GTEQ_8_2_0
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
#define RANDCAST
#else
#define RANDCAST (Rand*)
#endif

ENDVERBATIM

Expand Down Expand Up @@ -308,7 +313,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.negexp(1)
*/
value = nrn_random_pick(_p_rng);
value = nrn_random_pick(RANDCAST _p_rng);
//printf("random stream for this simulation = %lf\n",value);
return value;
}else{
Expand All @@ -317,7 +322,7 @@ ENDVERBATIM
: independent of nhost or which host this instance is on
: is desired, since each instance on this cpu draws from
: the same stream
value = scop_random(1)
value = scop_random()
VERBATIM
}
ENDVERBATIM
Expand Down
9 changes: 7 additions & 2 deletions Na12 Analysis/mechanisms/ProbGABAAB_EMS.mod
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#ifndef NRN_VERSION_GTEQ_8_2_0
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
#define RANDCAST
#else
#define RANDCAST (Rand*)
#endif

ENDVERBATIM

Expand Down Expand Up @@ -307,7 +312,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.uniform(1)
*/
value = nrn_random_pick(_p_rng);
value = nrn_random_pick(RANDCAST _p_rng);
//printf("random stream for this simulation = %lf\n",value);
return value;
}else{
Expand All @@ -316,7 +321,7 @@ ENDVERBATIM
: independent of nhost or which host this instance is on
: is desired, since each instance on this cpu draws from
: the same stream
urand = scop_random(1)
urand = scop_random()
VERBATIM
}
ENDVERBATIM
Expand Down
6 changes: 4 additions & 2 deletions Na12 Analysis/mechanisms/branching.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ ENDCOMMENT
NEURON { SUFFIX nothing }

VERBATIM

#ifndef _NrnThread
#define _NrnThread NrnThread
#endif
ENDVERBATIM
PROCEDURE init_files(){
VERBATIM {
Expand Down Expand Up @@ -235,4 +237,4 @@ fprintf(fm,"%d %1.15f %1.15f %1.15f %1.15f\n", ii, NODEB(nd), NODEA(nd), NODED(n
fclose (fm);
}
ENDVERBATIM
}
}

0 comments on commit 632a07e

Please sign in to comment.