Skip to content

Commit

Permalink
Merge pull request #212 from metrumresearchgroup/dev
Browse files Browse the repository at this point in the history
Release to CRAN
  • Loading branch information
kylebaron authored Mar 11, 2017
2 parents 8b1b49c + 0e5afaf commit 314d2a1
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 100 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cran-comments.md
Rchecks
.github
inst/doc
Doxyfile
Expand Down
6 changes: 2 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mrgsolve
Type: Package
Version: 0.7.10.9007
Version: 0.8.2
Title: Simulate from ODE-Based Population PK/PD and Systems Pharmacology
Models
Authors@R: c(
Expand All @@ -23,9 +23,7 @@ Description: Facilitates simulation from hierarchical, ordinary
passed in and simulated data are returned as R objects. A dosing event engine
allows interventions (bolus and infusion) to be managed separately from the
model code. Differential equations are solved with the 'DLSODA' routine
in 'ODEPACK' [A. C. Hindmarsh, 'ODEPACK, A Systematized Collection of ODE
Solvers' in Scientific Computing, R. S. Stepleman et al. (eds.),
North-Holland, Amsterdam, 1983, pp.55-64.].
in 'ODEPACK' (<https://computation.llnl.gov/casc/odepack/>).
License: GPL (>=2)
Depends:
R (>= 3.1.2),
Expand Down
10 changes: 3 additions & 7 deletions R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,12 @@ models <- function() {
file.path(path.package("mrgsolve"), "models")
}


.onLoad <- function(libname, pkgname) {
GLOBALS[["version"]] <- utils::packageVersion("mrgsolve")
}


.onAttach <- function(libname,pkgname) {
base::packageStartupMessage("mrgsolve: Community Edition")
base::packageStartupMessage("www.github.com/metrumresearchgroup/mrgsolve")

}
# .onAttach <- function(libname,pkgname) {
# base::packageStartupMessage("mrgsolve: Community Edition")
# }


8 changes: 4 additions & 4 deletions inst/include/odeproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ typedef void main_deriv_func(int* neq, double* t,
#define MRGSOLVE_GET_PRED_K21 (pred[3]/pred[4]) ///< rate constants for <code>$PKMODEL</code>


deriv_func* as_deriv_func( SEXP derivs);
init_func* as_init_func( SEXP inits);
table_func* as_table_func( SEXP table);
config_func* as_config_func(SEXP config);
// deriv_func* as_deriv_func( SEXP derivs);
// init_func* as_init_func( SEXP inits);
// table_func* as_table_func( SEXP table);
// config_func* as_config_func(SEXP config);

extern "C"{DL_FUNC tofunptr(SEXP a);}

Expand Down
30 changes: 0 additions & 30 deletions inst/include/tofunptr.h

This file was deleted.

Binary file modified inst/project/housemodel.RDS
Binary file not shown.
45 changes: 22 additions & 23 deletions src/odeproblem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ odeproblem::odeproblem(Rcpp::NumericVector param,

for(int i=0; i < npar_; ++i) Param[i] = double(param[i]);
for(int i=0; i < neq_; ++i) Init_value[i] = double(init[i]);
Inits = as_init_func(funs["main"]);
Table = as_table_func(funs["table"]);
Derivs = as_deriv_func(funs["ode"]);
Config = as_config_func(funs["config"]);

*reinterpret_cast<void**>(&Inits) = R_ExternalPtrAddr(funs["main"]);
*reinterpret_cast<void**>(&Table) = R_ExternalPtrAddr(funs["table"]);
*reinterpret_cast<void**>(&Derivs) = R_ExternalPtrAddr(funs["ode"]);
*reinterpret_cast<void**>(&Config) = R_ExternalPtrAddr(funs["config"]);

Capture.assign(n_capture_,0.0);

simeta = resim(&dosimeta,reinterpret_cast<void*>(this));
Expand Down Expand Up @@ -635,39 +635,39 @@ double PolyExp(const double& x,
* @param inits address for <code>$MAIN</code> function
*
*/
init_func* as_init_func(SEXP inits) {
return(reinterpret_cast<init_func *>(tofunptr(inits)));
}
// init_func* as_init_func(SEXP inits) {
// //return(reinterpret_cast<init_func *>(tofunptr(inits)));
// }

/**
* Get pointer for <code>$ODE</code> function.
*
* @param derivs address for <code>$ODE</code> function
*
*/
deriv_func* as_deriv_func(SEXP derivs) {
return(reinterpret_cast<deriv_func *>(tofunptr(derivs)));
}
// deriv_func* as_deriv_func(SEXP derivs) {
// //return(reinterpret_cast<deriv_func *>(tofunptr(derivs)));
// }

/**
* Get pointer for <code>$TABLE</code> function.
*
* @param table address for <code>$TABLE</code> function
*
*/
table_func* as_table_func(SEXP table) {
return(reinterpret_cast<table_func*>(tofunptr(table)));
}
// table_func* as_table_func(SEXP table) {
// //return(reinterpret_cast<table_func*>(tofunptr(table)));
// }

/**
* Get pointer for <code>$PREAMBLE</code> function.
*
* @param config address for <code>$PREAMBLE</code> function
*
*/
config_func* as_config_func(SEXP config) {
return(reinterpret_cast<config_func*>(tofunptr(config)));
}
// config_func* as_config_func(SEXP config) {
// //return(reinterpret_cast<config_func*>(tofunptr(config)));
// }

void odeproblem::copy_parin(const Rcpp::List& parin) {
this->tol(Rcpp::as<double>(parin["atol"]),Rcpp::as<double>(parin["rtol"]));
Expand All @@ -679,11 +679,10 @@ void odeproblem::copy_parin(const Rcpp::List& parin) {
}

void odeproblem::copy_funs(const Rcpp::List& funs) {
Inits = as_init_func(funs["main"]);
Table = as_table_func(funs["table"]);
Derivs = as_deriv_func(funs["ode"]);
Config = as_config_func(funs["config"]);

*reinterpret_cast<void**>(&Inits) = R_ExternalPtrAddr(funs["main"]);
*reinterpret_cast<void**>(&Table) = R_ExternalPtrAddr(funs["table"]);
*reinterpret_cast<void**>(&Derivs) = R_ExternalPtrAddr(funs["ode"]);
*reinterpret_cast<void**>(&Config) = R_ExternalPtrAddr(funs["config"]);
}

void odeproblem::advan(int x) {
Expand Down
32 changes: 0 additions & 32 deletions src/tofunptr.c

This file was deleted.

0 comments on commit 314d2a1

Please sign in to comment.