56     r->
trigs.
lst = (
double *)calloc(num_stim, 
sizeof(
double));
 
   59       fprintf(stderr, 
"Couldn't allocate memory\n");
 
   62     r->
trigs.
pmat = (
bool *)calloc(num_stim, 
sizeof(
bool));
 
   65     r->
saveState.
lst  = (
double *)calloc(num_decs, 
sizeof(
double));
 
   78     for (
int i = 0; i < num_decs; i++) {
 
   96     r->
trigs.
lst  = (
double *)calloc(num_stim, 
sizeof(
double));
 
   97     r->
trigs.
pmat = (
bool *)calloc(num_stim, 
sizeof(
bool)  );
 
  100     r->
saveState.
lst  = (
double *)calloc(num_decs, 
sizeof(
double));
 
  104     double trgTime = 1.0;
 
  113     for (
int i = 0; i < num_decs; i++) {
 
  127     *t_dop = 
static_cast<double *
>(malloc(num_decs*
sizeof(
double)));
 
  129     for (
int i = 0; i < num_decs; i++, trgIdx += 2)
 
  130       (*t_dop)[i] = r->
trigs.
lst[trgIdx] - 1;
 
  135     r->
trigs.
lst  = (
double *)calloc(num_stim, 
sizeof(
double));
 
  136     r->
trigs.
pmat = (
bool *)calloc(num_stim, 
sizeof(
bool));
 
  139     r->
saveState.
lst  = (
double *)calloc(num_decs, 
sizeof(
double));
 
  143     double trgTime = 1.0;
 
  152     for (
int i = 0; i < num_decs; i++) {
 
  155         if ((i > 0) && (j == 0))
 
  171   if (strcmp(r_file, 
"")) {
 
  173       log_msg(NULL, 0, 0, 
"\n\nError reading protocol definition from %s",r_file);
 
  181       log_msg(NULL, 3, 0, 
"Restitution protocol definition file does not match.\n");
 
  182       log_msg(NULL, 3, 0, 
"Using default protocol definitions.\n");
 
  226   FILE *pdef = fopen(r_file, 
"rt");
 
  228   if (!pdef) 
return -1;
 
  233   } 
while ((*buf == 
'\n') || (*buf == 
'#'));
 
  236   sscanf(buf, 
"%d", &useS1S2);
 
  242       log_msg(NULL, 2, 0, 
"#prepacing beats %d < #calibration beats %d.",
 
  244       log_msg(NULL, 2, 0, 
"This may bias the calibration of AP statistics parameters.");
 
  276   char save_name[1024];
 
  279   snprintf(save_name, 
sizeof save_name, 
"test_%d.sv", cnt++);
 
int read_restitution_protocol_def(char *r_file, restitution *r)
 
void get_protocol_definition(char *r_file, restitution *r, bool useS1S2)
 
void restitution_trigger_list(char *r_file, restitution *r, char *protocol, int *n_dop, double **t_dop)
 
void save_sv(MULTI_IF *, int, const char *)
 
void restitution_save_sv(MULTI_IF *miif, int R1, restitution *r, action_potential *AP)
 
void log_msg(FILE_SPEC out, int level, unsigned char flag, const char *fmt,...)
 
int n
number of pulses required for protocol
 
double * lst
store instants of pulse delivery
 
bool * pmat
store flag to indicate prematurity
 
float S2_start
bcl of first premature beat
 
float bcl
basic cycle length
 
float S2_end
bcl of last premature beat
 
float S2_dec
decrement for S2 beats
 
int beats_per_S2
number of beats before S2
 
int beats_per_bcl
number of beats for a particular bcl
 
float bcl_start
initial basic cycle length
 
float bcl_dec
decrement in bcl
 
float bcl_end
final basic cycle length
 
union limpet::restitution::@0 rtype
 
TrgList saveState
instants at wich we save state vectors
 
double dur
total duration of protocol
 
TrgList trigs
trigger list for defining stim sequence
 
r_prtcl prtcl
protocol type
 
int numppBeats
number of prepaced beats before protocol