Skip to content

Commit

Permalink
version 0.5-7
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetzoldt authored and gaborcsardi committed Jun 25, 2008
1 parent 366e5c3 commit d3f703a
Show file tree
Hide file tree
Showing 35 changed files with 4,619 additions and 183 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,13 +1,13 @@
Package: simecol
Version: 0.5-5
Date: 2008-04-05
Version: 0.5-7
Date: 2008-06-25
Title: Simulation of ecological (and other) dynamic systems
Author: Thomas Petzoldt
Depends: R (>= 2.3.0), odesolve, methods
Depends: R (>= 2.3.0), deSolve, methods
Suggests: tcltk
LazyLoad: yes
Maintainer: Thomas Petzoldt <thomas.petzoldt@tu-dresden.de>
Description: Object oriented framework to simulate ecological (and other) dynamic systems
License: GPL (>= 2)
URL: http://www.simecol.de/
Packaged: Tue Apr 8 04:58:01 2008; theussl
Packaged: Tue Jul 1 04:49:08 2008; theussl
8 changes: 4 additions & 4 deletions NAMESPACE
Expand Up @@ -4,10 +4,10 @@ useDynLib(simecol, .registration = TRUE)

importFrom(graphics, plot)

import(odesolve)
import(deSolve)

exportClasses(simObj, odeModel, gridModel, rwalkModel)
exportClasses(numericOrlist,listOrNULL,functionOrNULL,listOrdata.frame)
exportClasses(numericOrlist,listOrNULL,functionOrNULL,listOrdata.frame,functionOrcharacter)

exportMethods(sim, parms, "parms<-", init, "init<-", times, "times<-")
exportMethods(inputs, "inputs<-", main, "main<-", equations, "equations<-")
Expand All @@ -27,8 +27,8 @@ export(simObj, odeModel, gridModel, rwalkModel)
export(addtoenv, fromtoby)
export(neighbours, neighbors, eightneighbours, eightneighbors, seedfill)
export(approxTime, approxTime1, sEdit, peaks)
export(euler, iteration)
#export(rk4, lsoda)
export(iteration)
#export(euler, rk4, lsoda) # from deSolve

## parameter fitting
export(ssqOdeModel, fitOdeModel)
Expand Down
3 changes: 2 additions & 1 deletion R/aaa_classes.R
Expand Up @@ -4,6 +4,7 @@

## helper classes
setClassUnion("functionOrNULL", c("NULL", "function"))
setClassUnion("functionOrcharacter", c("character", "function"))
setClassUnion("listOrNULL", c("NULL", "list"))
setClassUnion("numericOrlist", c("numeric", "list"))
setClassUnion("listOrdata.frame", c("list", "data.frame"))
Expand All @@ -17,7 +18,7 @@ setClass("simObj",
init = "ANY",
parms = "ANY",
inputs = "ANY",
solver = "character",
solver = "functionOrcharacter",
out = "ANY",
initfunc = "functionOrNULL"
)
Expand Down
10 changes: 10 additions & 0 deletions R/accessors.R
Expand Up @@ -37,6 +37,7 @@ setMethod("parms", "simObj",
setMethod("parms<-", "simObj",
function(obj, value) {
obj@parms <- value
obj@out <- NULL
invisible(obj)
}
)
Expand Down Expand Up @@ -65,6 +66,7 @@ setMethod("times<-", "simObj",
print("Warning: Ignored. Invalid (or incomplete) names in right hand side of assignment.")
}
}
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -78,13 +80,15 @@ setMethod("init", "simObj",
setMethod("init<-", "simObj",
function(obj, value) {
obj@init <- value
obj@out <- NULL
invisible(obj)
}
)

setMethod("init<-", c("gridModel", "matrix"),
function(obj, value) {
obj@init <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -103,6 +107,7 @@ setMethod("inputs", "simObj",
setMethod("inputs<-", "simObj",
function(obj, value) {
obj@inputs <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -114,6 +119,7 @@ setMethod("main", "simObj",
setMethod("main<-", "simObj",
function(obj, value) {
obj@main <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -125,6 +131,7 @@ setMethod("equations", "simObj",
setMethod("equations<-", "simObj",
function(obj, value) {
obj@equations <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -136,6 +143,7 @@ setMethod("initfunc", "simObj",
setMethod("initfunc<-", "simObj",
function(obj, value) {
obj@initfunc <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -147,6 +155,7 @@ setMethod("solver", "simObj",
setMethod("solver<-", "simObj",
function(obj, value) {
obj@solver <- value
obj@out <- NULL
invisible(obj)
}
)
Expand All @@ -162,6 +171,7 @@ setMethod("out", "simObj",
setMethod("out<-", "simObj",
function(obj, value) {
if(!is.null(value)) stop("``out'' can only be set to NULL")
obj@out <- NULL
obj@out <- value
invisible(obj)
}
Expand Down
63 changes: 0 additions & 63 deletions R/euler.R

This file was deleted.

5 changes: 0 additions & 5 deletions R/iteration.R
Expand Up @@ -18,7 +18,6 @@ setMethod("iteration", "numeric",
if (!is.numeric(y)) stop("`y' must be numeric")
if (!is.numeric(times)) stop("`times' must be numeric")
if (!is.function(func)) stop("`func' must be a function")
# if (!is.numeric(parms)) stop("`parms' must be numeric")

n <- length(y)
parms <- c(parms, DELTAT = 0)
Expand Down Expand Up @@ -51,8 +50,6 @@ setMethod("iteration", "simObj",
inputs <- y@inputs
equations <- y@equations
environment(func) <- environment()
#attach(equations)
#on.exit(detach(equations))
equations <- addtoenv(equations)
parms$DELTAT <- 0
out <- list(func(times[1], init, parms))
Expand Down Expand Up @@ -81,8 +78,6 @@ setMethod("iteration", "odeModel",
equations <- y@equations
environment(func) <- environment()
equations <- addtoenv(equations)
#attach(equations)
#on.exit(detach(equations))
n <- length(init)
parms <- c(parms, DELTAT = 0)
nm <- c("time", if (!is.null(attr(init, "names")))
Expand Down
18 changes: 0 additions & 18 deletions R/sim.R
Expand Up @@ -8,39 +8,21 @@ setMethod("sim", "simObj",
}
)

#setMethod("sim", "odeModel",
# function(obj, ...) {
# times <- fromtoby(obj@times)
# #if (obj@solver == "lsoda") {
# # out <- wraplsoda(obj, ...)
# #} else {
# out <- do.call(obj@solver, list(obj, ...))
# #}
# obj@out <- as.data.frame(out)
# invisible(obj)
# }
#)

setMethod("sim", "odeModel",
function(obj, ...) {
times <- fromtoby(obj@times)
func <- obj@main
inputs <- obj@inputs
equations <- obj@equations
#parms <- obj@parms
environment(func) <- environment()

equations <- addtoenv(equations)
out <- do.call(obj@solver, list(obj@init, times, func, obj@parms, ...))

#out <- do.call(obj@solver, list(obj, ...))
obj@out <- as.data.frame(out)
invisible(obj)
}
)



setMethod("sim", "gridModel",
function(obj, ...) {
times <- fromtoby(obj@times)
Expand Down
Binary file modified data/lv.rda
Binary file not shown.
Binary file modified data/lv3.rda
Binary file not shown.
12 changes: 12 additions & 0 deletions inst/NEWS
@@ -1,3 +1,14 @@
0.5-7

o the package uses now deSolve instead of odesolve
o euler is now imported from deSolve and removed from simecol
o allow solver slot to contain not only character but also function
o plain text version of JSS publication added as vignette

0.5-6

o small improvements and updates

0.5-5

o reworked ODE solvers, rk4 and lsoda generics removed,
Expand All @@ -7,6 +18,7 @@ o reworked ODE solvers, rk4 and lsoda generics removed,
ode solvers
o rehabilitation of addtoenv()
o documentation updates
o replacement functions now delete slot "out"

0.5-4

Expand Down
5 changes: 5 additions & 0 deletions inst/ToDo.txt
@@ -0,0 +1,5 @@
2008-05-21
- switch from odesolve to deSolve
- remove euler (is now in deSolve)
- r-initialize during sim if initfunc exists

Binary file added inst/doc/ca.pdf
Binary file not shown.
Binary file added inst/doc/classes.pdf
Binary file not shown.

0 comments on commit d3f703a

Please sign in to comment.