19 template <
class STATE,
class PARAMETERS,
size_t NEVENT,
size_t NDEME = 1>
27 static const size_t ndeme = NDEME;
46 return 2*
sizeof(
slate_t) +
sizeof(
size_t)
52 memcpy(o,A,
sizeof(A)); o +=
sizeof(A);
53 memcpy(o,&X.
event,
sizeof(
size_t)); o +=
sizeof(size_t);
62 memcpy(A,o,
sizeof(A)); o +=
sizeof(A);
64 memcpy(&X.
event,o,
sizeof(
size_t)); o +=
sizeof(size_t);
133 std::string
yaml (std::string tab)
const;
141 if (total_rate > 0) {
146 double u = runif(0,total_rate);
150 err(
"in '%s' (%s line %d): invalid negative rate[%zd]=%lg",
151 __func__,__FILE__,__LINE__,
event,rate[
event]);
163 err(
"cannot simulate backward! (current t=%lg, requested t=%lg)",
current,tfin);
164 while (
next < tfin) {
169 R_CheckUserInterrupt();
177 #define PARAM_SET(X) if (!ISNA(p[m])) params.X = p[m]; \
179 #define RATE_CALC(X) total += rate[m++] = (X);
180 #define YAML_PARAM(X) (t + #X + ": " + std::to_string(params.X) + "\n")
181 #define YAML_STATE(X) (t + #X + ": " + std::to_string(state.X) + "\n")
Population process class.
virtual void valid(void) const
popul_proc_t(const popul_proc_t &X)
copy constructor
void update_IVPs(double *, int)
set initial-value parameters
static const size_t nevent
void update_params(double *, int)
set parameters
popul_proc_t(double t0=0)
popul_proc_t(raw_t *o)
constructor from serialized binary form
void update_clocks(void)
updates clock and next event
slate_t time(void) const
get current time.
virtual void jump(int e)=0
makes a jump
std::string yaml(std::string tab) const
machine/human readable info
static const size_t ndeme
double event_rates(double *rate, int n) const
compute event rates
~popul_proc_t(void)
destructor
popul_proc_t(popul_proc_t &&)=delete
move constructor
virtual void rinit(void)=0
initialize the state
size_t bytesize(void) const
size of serialized binary form
friend raw_t * operator>>(const popul_proc_t &X, raw_t *o)
binary serialization
popul_proc_t & operator=(const popul_proc_t &X)
copy assignment operator