R/zzz.R

Defines functions onLoad

#' Executes code while loading the package.
#'
#' @param libname The library name
#' @param pkgname The package name
#' @noRd
.onLoad <- function(libname, pkgname) {

  setPackageEnvir(variable.name = "RpolyhedraEnv", new.env())

  #package version db
  .package.db <- list()
  #It is not necesary to put trivial compatibility
  .package.db[["0.2.5"]] <- "0.2.5"

  setPackageEnvir(variable.name = ".package.db", .package.db)


  #setup Available sources
  .available.sources <- list()
  .available.sources[["netlib"]] <-
    PolyhedronScraperConfigurationNetlib.class$new()
  .available.sources[["dmccooey"]] <-
    PolyhedronScraperConfigurationDmccoey.class$new()

  setPackageEnvir(variable.name = ".available.sources", .available.sources)


  .available.scrapping.conf <- list()
  .available.scrapping.conf[["dev-tetrahedron"]] <-
    list(max.quant.config.schedule = 0,
       max.quant.scrape = 1,
       time2scrape.source = 2,
       #2 seconds of building/scraping polyhedra database for
       #reasonable dev timing
       retry.scrape = FALSE)

  .available.scrapping.conf[["dev-minimal"]] <-
    list(max.quant.config.schedule = 0,
       max.quant.scrape = 10,
       time2scrape.source = 20,
       #20 seconds of building/scraping polyhedra database for
       #reasonable dev timing
       retry.scrape = FALSE)
  .available.scrapping.conf[["pkg-minimal"]] <-
    list(max.quant.config.schedule = 0,
       max.quant.scrape = 0,
       time2scrape.source = 80,
       retry.scrape = FALSE)
  .available.scrapping.conf[["fulldb"]] <-
    list(max.quant.config.schedule = 0,
       max.quant.scrape = 0,
       time2scrape.source = 0,
       retry.scrape = FALSE)

  setPackageEnvir(variable.name = ".available.scrapping.conf",
                  .available.scrapping.conf)

  initDataDirEnvironment()

  if (!file.exists(getPreloadedDataFilename())){
    downloadRPolyhedraSupportingFiles()
  }

  updatePolyhedraDatabase()

}

Try the Rpolyhedra package in your browser

Any scripts or data that you put into this service are public.

Rpolyhedra documentation built on Feb. 21, 2019, 4:33 p.m.