-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from dd-harp/dev
Major Update: blood feeding, egg laying, and resource dynamics
- Loading branch information
Showing
146 changed files
with
2,490 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
#' @title Update the availability of blood hosts | ||
#' @description This method dispatches on the type of `pars$BFpar`. | ||
#' @param t current simulation time | ||
#' @param y vector of state variables | ||
#' @param pars an [list] | ||
#' @return a [list] | ||
#' @export | ||
AvailableBlood <- function(t, y, pars) { | ||
UseMethod("AvailableBlood", pars$BFpar) | ||
} | ||
|
||
#' @title Compute availability of local humans for blood feeding | ||
#' @description Compute the availability for the pathogen's hosts for blood feeding | ||
#' @param t current simulation time | ||
#' @param y state vector | ||
#' @param pars a [list] | ||
#' @return a [numeric] vector of length `nPatches` | ||
#' @export | ||
AvailableBlood.static <- function(t, y, pars){ | ||
return(pars) | ||
} | ||
|
||
#' @title Compute availability of local humans for blood feeding | ||
#' @description Compute the availability for the pathogen's hosts for blood feeding | ||
#' @param t current simulation time | ||
#' @param y state vector | ||
#' @param pars a [list] | ||
#' @return a [numeric] vector of length `nPatches` | ||
#' @export | ||
AvailableBlood.setup <- function(t, y, pars){ | ||
for(s in 1:pars$nVectors) | ||
pars = compute_AvailableHosts(t, y, pars, s) | ||
|
||
return(pars) | ||
} | ||
|
||
#' @title Compute availability of local humans for blood feeding | ||
#' @description Compute the availability for the pathogen's hosts for blood feeding | ||
#' @param t current simulation time | ||
#' @param y state vector | ||
#' @param pars a [list] | ||
#' @return a [numeric] vector of length `nPatches` | ||
#' @export | ||
AvailableBlood.forced <- function(t, y, pars){ | ||
for(s in 1:pars$nVectors) | ||
pars = compute_AvailableHosts(t, y, pars, s) | ||
|
||
return(pars) | ||
} | ||
|
||
#' @title Compute availability blood hosts of the i^th species | ||
#' @description Compute the availability for the pathogen's hosts for blood feeding | ||
#' @param t current simulation time | ||
#' @param y state vector | ||
#' @param pars a [list] | ||
#' @param s the vector species index | ||
#' @return a [numeric] vector of length `nPatches` | ||
#' @export | ||
compute_AvailableHosts <- function(t, y, pars, s){ | ||
|
||
H = F_H(t, y, pars, 1) | ||
|
||
pars$vars$Wi[[1]][[s]] = as.vector(with(pars$BFpar, TaR[[1]][[s]] %*% (searchWts[[1]][[s]]*H))) | ||
pars$vars$W[[s]] = pars$vars$Wi[[1]][[s]] | ||
if(pars$nHosts > 1){ | ||
for(i in 2:pars$nHosts){ | ||
H = F_H(t, y, pars, i) | ||
pars$vars$Wi[[i]][[s]] = as.vector(with(pars$BFpar, TaR[[i]][[s]] %*% (searchWts[[i]][[s]]*H))) | ||
pars$vars$W[[s]] = pars$vars$W[[s]] + pars$vars$Wi[[i]][[s]] | ||
} | ||
} | ||
pars$vars$W[[s]] = as.vector(pars$vars$W[[s]]) | ||
pars$vars$B[[s]] = as.vector(with(pars$vars, W[[s]] + Visitors[[s]] + Other[[s]])) | ||
|
||
return(pars) | ||
} |
Oops, something went wrong.