Legofit
infers population history from nucleotide site patterns.
Data Structures | Functions
simsched.c File Reference

Simulation schedule. More...

#include "simsched.h"
#include "misc.h"
#include <stdio.h>
#include <pthread.h>
#include <string.h>

Data Structures

struct  Stage
 A single stage in the optimization process. More...
 
struct  SimSched
 Holds a linked list of Stages and a mutex lock. More...
 

Functions

static StageStage_append (Stage *self, long nOptItr, long nSimReps)
 Append a new link to the end of the list. More...
 
static StageStage_free (Stage *self)
 Free the list and return NULL.
 
static StageStage_popHead (Stage *self)
 Delete head of the list and return a pointer to the new head.
 
static long Stage_getSimReps (Stage *self)
 Return the number of simulation replicates of current Stage.
 
static long Stage_getOptItr (Stage *self)
 Return the number of optimizer iterations of current Stage.
 
SimSchedSimSched_new (void)
 Allocate a new SimSched with no stages.
 
void SimSched_append (SimSched *self, long nOptItr, long nSimReps)
 Append a stage to a SimSched.
 
void SimSched_free (SimSched *self)
 Free a SimSched.
 
long SimSched_getSimReps (SimSched *self)
 Return number of simulation reps in current stage.
 
long SimSched_getOptItr (SimSched *self)
 Return number of optimizer iterations in current stage.
 
int SimSched_next (SimSched *self)
 
void SimSched_print (const SimSched *self, FILE *fp)
 Print SimSched.
 
int SimSched_nStages (const SimSched *self)
 Return number of stages.
 

Detailed Description

Simulation schedule.

Author
Alan R. Rogers

SimSched implements a linked list of stages. Each stage establishes a limit on the number of optimizer iterations and on the number of simulation replicates.

Function Documentation

◆ Stage_append()

static Stage * Stage_append ( Stage self,
long  nOptItr,
long  nSimReps 
)
static

Append a new link to the end of the list.

Return a pointer to the beginning of the list.