Skip to content

Commit

Permalink
remove calls to pomp set/unset userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
kingaa committed Aug 8, 2023
1 parent f73aa0e commit 0b85f4f
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ License: GPL-3
Encoding: UTF-8
LazyData: true
BugReports: https://github.com/kidusasfaw/spatPomp/issues/
Depends: pomp (>= 4.5.2), R(>= 4.1), methods
Depends: pomp (>= 5.4), R(>= 4.1), methods
LinkingTo: pomp
Suggests: testthat, doParallel (>= 1.0.11), parallel, doRNG
Imports: foreach, dplyr, tidyr, stringr, abind, rlang, magrittr, ggplot2
Expand Down
2 changes: 0 additions & 2 deletions inst/include/spatPomp_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ extern pomp_fun_handler_t *pfh;
extern get_covariate_names_t *gcn;
extern table_lookup_t *tl;
extern make_covariate_table_t *mct;
extern set_pomp_userdata_t *spu;
extern unset_pomp_userdata_t *upu;
extern pomp_onestep_sim *pos;
extern SEXP(*randwalk_perturbation_pomp)(SEXP,SEXP);
extern SEXP (*lookup_in_table_pomp)(SEXP,SEXP);
Expand Down
4 changes: 0 additions & 4 deletions src/dunit_measure.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ SEXP do_dunit_measure (SEXP object, SEXP y, SEXP x, SEXP times, SEXP units, SEXP
// address of native routine
*((void **) (&ff)) = R_ExternalPtrAddr(fn);

(*spu)(args);

for (k = 0; k < ntimes; k++, time++, yp += nobs) { // loop over times

R_CheckUserInterrupt(); // check for user interrupt
Expand All @@ -124,8 +122,6 @@ SEXP do_dunit_measure (SEXP object, SEXP y, SEXP x, SEXP times, SEXP units, SEXP
}
}

(*upu)();

}

break;
Expand Down
2 changes: 0 additions & 2 deletions src/eunit_measure.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ SEXP do_eunit_measure (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE
// address of native routine
*((void **) (&ffthetatoe)) = R_ExternalPtrAddr(fnthetatoe);

(*spu)(args);
for (k = 0; k < ntimes; k++, time++) { // loop over times
// interpolate the covar functions for the covariates
(*tl)(&covariate_table,*time,cov);
Expand All @@ -113,7 +112,6 @@ SEXP do_eunit_measure (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE
}
}
}
(*upu)();
}

break;
Expand Down
3 changes: 0 additions & 3 deletions src/fcstsampvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ SEXP do_fcst_samp_var (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE
// address of native routine
*((void **) (&ff)) = R_ExternalPtrAddr(fn);

(*spu)(args);
for (k = 0; k < ntimes; k++, time++) { // loop over times
// interpolate the covar functions for the covariates
(*tl)(&covariate_table,*time,cov);
Expand All @@ -117,8 +116,6 @@ SEXP do_fcst_samp_var (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE

}

(*upu)();

}

break;
Expand Down
4 changes: 0 additions & 4 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ SEXP (*lsd)(SEXP);
SEXP (*lsi)(SEXP);
make_covariate_table_t * mct;
SEXP (*pfh)(SEXP, SEXP, pompfunmode *, SEXP, SEXP, SEXP, SEXP);
void (*spu)(SEXP);
void (*upu)(void);
void (*tl)(lookup_table_t *, double, double *);


Expand All @@ -49,6 +47,4 @@ void R_init_spatPomp (DllInfo *info) {
gcn = (get_covariate_names_t *) R_GetCCallable("pomp", "get_covariate_names");
tl = (table_lookup_t *) R_GetCCallable("pomp", "table_lookup");
mct = (make_covariate_table_t *) R_GetCCallable("pomp", "make_covariate_table");
spu = (set_pomp_userdata_t *) R_GetCCallable("pomp", "set_pomp_userdata");
upu = (unset_pomp_userdata_t *) R_GetCCallable("pomp", "unset_pomp_userdata");
}
3 changes: 0 additions & 3 deletions src/munit_measure.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ SEXP do_munit_measure(SEXP object, SEXP X, SEXP vc, SEXP Np, SEXP times, SEXP pa
// address of native routine
*((void **) (&ff)) = R_ExternalPtrAddr(fn);

(*spu)(args);
for (k = 0; k < ntimes; k++, time++) { // loop over times
// interpolate the covar functions for the covariates
(*tl)(&covariate_table,*time,cov);
Expand All @@ -142,8 +141,6 @@ SEXP do_munit_measure(SEXP object, SEXP X, SEXP vc, SEXP Np, SEXP times, SEXP pa

}

(*upu)();

}

break;
Expand Down
2 changes: 0 additions & 2 deletions src/runit_measure.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ SEXP do_runit_measure (SEXP object, SEXP x, SEXP times, SEXP units, SEXP params,
PROTECT(Y = ret_array(nobs,nreps,ntimes,Onames)); nprotect++;
yt = REAL(Y);

(*spu)(args);
GetRNGstate();

for (k = 0; k < ntimes; k++, time++) { // loop over times
Expand All @@ -128,7 +127,6 @@ SEXP do_runit_measure (SEXP object, SEXP x, SEXP times, SEXP units, SEXP params,
}

PutRNGstate();
(*upu)();

}

Expand Down
2 changes: 0 additions & 2 deletions src/spatPomp_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ extern pomp_fun_handler_t *pfh;
extern get_covariate_names_t *gcn;
extern table_lookup_t *tl;
extern make_covariate_table_t *mct;
extern set_pomp_userdata_t *spu;
extern unset_pomp_userdata_t *upu;
extern pomp_onestep_sim *pos;
extern SEXP(*randwalk_perturbation_pomp)(SEXP,SEXP);
extern SEXP (*lookup_in_table_pomp)(SEXP,SEXP);
Expand Down
2 changes: 0 additions & 2 deletions src/vunit_measure.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ SEXP do_vunit_measure (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE

// address of native routine
*((void **) (&ffthetatov)) = R_ExternalPtrAddr(fnthetatov);
(*spu)(args);
for (k = 0; k < ntimes; k++, time++) { // loop over times
// interpolate the covar functions for the covariates
(*tl)(&covariate_table,*time,cov);
Expand All @@ -106,7 +105,6 @@ SEXP do_vunit_measure (SEXP object, SEXP X, SEXP Np, SEXP times, SEXP params, SE
}
}
}
(*upu)();
}

break;
Expand Down

0 comments on commit 0b85f4f

Please sign in to comment.