Commit 60a1cd1a authored by aheinri5's avatar aheinri5
Browse files

[base] added ogs6_py_install function and prompt in OGS6_vtu class

parent 3f7ff9be
......@@ -14,6 +14,18 @@ OGS6_vtu <- R6::R6Class(
#' @param vtu_path string: Path to .vtu file
initialize = function(vtu_path) {
if(!reticulate::py_module_available("vtk")){
install <- askYesNo(paste("Python module `vtk` was not found.",
"Install `vtk`?"))
if(is.na(install) || !install){
stop(paste("Python module `vtk` is required for `OGS6_vtu`",
"initialization."), call. = FALSE)
}
ogs6_py_install()
}
vtk_xml_ugr <- vtk$vtkXMLUnstructuredGridReader()
vtk_xml_ugr$SetFileName(vtu_path)
vtk_xml_ugr$Update()
......@@ -326,6 +338,20 @@ validate_coordinates <- function(coordinates){
}
#===== ogs6_py_install =====
#' Install Python dependencies
#'
#' Wrapper for `reticulate::py_install`. Installs the `vtk` library.
#'
#' @inheritParams reticulate::py_install
#' @export
ogs6_py_install <- function(method = "auto", conda = "auto") {
reticulate::py_install("vtk", method = method, conda = conda)
}
#===== ogs6_generate_structured_mesh =====
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment