From 0ea1ddfda5d8227bf0aca85f94f7ce4849db577d Mon Sep 17 00:00:00 2001 From: aheinri5 <Anna@netzkritzler.de> Date: Fri, 11 Dec 2020 12:11:13 +0100 Subject: [PATCH] [base] Removed unneeded files, updated NAMESPACE --- .Rprofile | 3 - NAMESPACE | 1 - R/validate_gml.R | 167 ----------- ..._input_example.R => flow_free_expansion.R} | 265 ++++++++---------- .../generate_benchmark_script_example.R | 4 +- man/find_read_in_func_call.Rd | 19 -- man/get_grandchild_length_vector.Rd | 19 -- man/get_list_status.Rd | 21 -- man/input_add.r2ogs6_gml.Rd | 16 -- man/is_het_wrapper.Rd | 17 -- man/list_from_nodeset.Rd | 14 - man/obj_is_defined.Rd | 21 -- man/read_in_timesteps_node.Rd | 14 - man/validate_paths.Rd | 16 -- tests/testthat/test-validate_gml.R | 63 ----- 15 files changed, 113 insertions(+), 547 deletions(-) delete mode 100755 .Rprofile delete mode 100644 R/validate_gml.R rename inst/examples/{user_input_example.R => flow_free_expansion.R} (54%) delete mode 100644 man/find_read_in_func_call.Rd delete mode 100644 man/get_grandchild_length_vector.Rd delete mode 100644 man/get_list_status.Rd delete mode 100644 man/input_add.r2ogs6_gml.Rd delete mode 100644 man/is_het_wrapper.Rd delete mode 100644 man/list_from_nodeset.Rd delete mode 100644 man/obj_is_defined.Rd delete mode 100644 man/read_in_timesteps_node.Rd delete mode 100644 man/validate_paths.Rd delete mode 100644 tests/testthat/test-validate_gml.R diff --git a/.Rprofile b/.Rprofile deleted file mode 100755 index cae66ba..0000000 --- a/.Rprofile +++ /dev/null @@ -1,3 +0,0 @@ -#### -- Packrat Autoloader (version 0.5.0) -- #### -source("packrat/init.R") -#### -- End Packrat Autoloader -- #### diff --git a/NAMESPACE b/NAMESPACE index 4938f2c..d791f1d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,7 +3,6 @@ export(OGS6) export(generate_benchmark_script) export(generate_structured_mesh) -export(input_add.r2ogs6_gml) export(pick_vtu_file) export(r2ogs6_borehole_heat_exchanger) export(r2ogs6_boundary_condition) diff --git a/R/validate_gml.R b/R/validate_gml.R deleted file mode 100644 index 5d1b96b..0000000 --- a/R/validate_gml.R +++ /dev/null @@ -1,167 +0,0 @@ -#This script contains various functions to verify data for a .gml file (WIP) - -#'validate_r2ogs6_gml -#'@description Validator for class r2ogs6_gml. Checks if the defined polylines -#' and surfaces reference existing points. -#'@param r2ogs6_gml A r2ogs6_gml class object -validate_r2ogs6_gml <- function(r2ogs6_gml) { - - maximal_point_id <- length(r2ogs6_gml$points[[1]]) - 1 - - #Check if polylines reference existing points - for(i in seq_len(length(r2ogs6_gml$polylines))){ - for(j in seq_len(length(r2ogs6_gml$polylines[[i]][[2]]))){ - if(r2ogs6_gml$polylines[[i]][[2]][[j]] > maximal_point_id || - r2ogs6_gml$polylines[[i]][[2]][[j]] < 0){ - stop("Polyline references point ID which does not exist", call. = FALSE) - } - } - } - - #Check if surfaces reference existing points - for(i in seq_len(length(r2ogs6_gml$surfaces))){ - for(j in seq_len(length(r2ogs6_gml$surfaces[[i]][[2]]))){ - if(r2ogs6_gml$surfaces[[i]][[2]][[j]] > maximal_point_id || - r2ogs6_gml$surfaces[[i]][[2]][[j]] < 0 || - r2ogs6_gml$surfaces[[i]][[3]][[j]] > maximal_point_id || - r2ogs6_gml$surfaces[[i]][[3]][[j]] < 0){ - stop("Surface references point ID which does not exist", call. = FALSE) - } - } - } - - return(invisible(r2ogs6_gml)) -} - - -#'validate_points -#'@description Checks if the input is a tibble, if this tibble has the right number of elements, -#' if those elements are named correctly and if there are any overlapping points or duplicate point names -#'@param points A tibble with 3 vectors named 'x', 'y' and 'z' (and an optional 'name' vector) -validate_points <- function(points) { - - assertthat::assert_that(inherits(points, "tbl_df")) - - names <- names(points) - - if (!((length(points) == 4 && names[[1]] == "x" && names[[2]] == "y" && - names[[3]] == "z" && names[[4]] == "name") || - (length(points) == 3 && names[[1]] == "x" && names[[2]] == "y" && - names[[3]] == "z"))){ - stop(paste(points, " column names do not fit to 'x, y, z, (name)' "), call. = FALSE) - } - - assertthat::assert_that(is.numeric(points$x)) - assertthat::assert_that(is.numeric(points$y)) - assertthat::assert_that(is.numeric(points$z)) - - has_names <- (length(points) == 4) - - #Find overlapping points and duplicate names - for(i in 1:(length(points[[1]])-1)){ - for(j in (i+1):length(points[[1]])){ - if(points[[1]][[i]] == points[[1]][[j]] && - points[[2]][[i]] == points[[2]][[j]] && - points[[3]][[i]] == points[[3]][[j]]){ - stop("Overlapping .gml points (with the same coordinates) detected", call. = FALSE) - } - - if(has_names){ - if(points[[4]][[i]] == points[[4]][[j]] && - points[[4]][[i]] != ""){ - warning("Duplicate .gml point names detected", call. = FALSE) - } - } - } - } - - return(invisible(points)) -} - - -#'validate_polylines -#'@description Checks if the input is a list, if this list consists of other lists and -#' if those child lists have the correct structure (length of 2, first element is a string named -#' 'name', second element is a numeric vector) -#'@param polylines A list consisting of other lists -validate_polylines <- function(polylines) { - - assertthat::assert_that(is.list(polylines)) - - for(i in 1:length(polylines)){ - - assertthat::assert_that(is.list(polylines[[i]])) - assertthat::assert_that(length(polylines[[i]]) == 2) - assertthat::assert_that(names(polylines[[i]])[[1]] == "name") - assertthat::assert_that(assertthat::is.string(polylines[[i]][[1]])) - assertthat::assert_that(is.numeric(polylines[[i]][[2]])) - - #Check for duplicate points / polylines? - } - - return(invisible(polylines)) -} - - -#'validate_surfaces -#'@description Checks if the input is a list, if this list consists of other lists and -#' if those child lists have the correct structure (length of 3, first element is a string named -#' 'name', second and third element are numeric vectors) -#'@param surfaces A list consisting of other lists -validate_surfaces <- function(surfaces) { - - assertthat::assert_that(is.list(surfaces)) - - for(i in 1:length(surfaces)){ - - assertthat::assert_that(is.list(surfaces[[i]])) - assertthat::assert_that(length(surfaces[[i]]) == 3) - assertthat::assert_that(names(surfaces[[i]])[[1]] == "name") - - assertthat::assert_that(is.numeric(surfaces[[i]][[2]])) - assertthat::assert_that(length(surfaces[[i]][[2]]) == 3) - assertthat::assert_that(is.numeric(surfaces[[i]][[3]])) - assertthat::assert_that(length(surfaces[[i]][[3]]) == 3) - - validate_surface_elements(surfaces[[i]][[2]], surfaces[[i]][[3]]) - - #Check for duplicate points / surfaces? - } - - return(invisible(surfaces)) -} - - -#'validate_surface_elements -#'@description Helper function, checks if two numerical vectors of length 3 (two surface elements) -#' each consist of 3 different elements and also have exactly 2 matching elements between them -#' which means they describe a valid surface. You can think of the two vectors as two triangles, -#' and the two triangles together form a square which is our surface. -#'@param surface_element_1 A numerical vector of length 3 -#'@param surface_element_2 A numerical vector of length 3 -validate_surface_elements = function (surface_element_1, surface_element_2) { - - if(surface_element_1[[1]] == surface_element_1[[2]] || - surface_element_1[[1]] == surface_element_1[[3]] || - surface_element_1[[2]] == surface_element_1[[3]] || - surface_element_2[[1]] == surface_element_2[[2]] || - surface_element_2[[1]] == surface_element_2[[3]] || - surface_element_2[[2]] == surface_element_2[[3]]) { - stop("A surface element must consist of 3 different points", call. = FALSE) - } - - equal_count <- 0 - - for(i in 1:length(surface_element_1)) { - for(j in 1:length(surface_element_2)) { - if(surface_element_1[[i]] == surface_element_2[[j]]) { - equal_count <- equal_count + 1 - break - } - } - } - - if(equal_count != 2) { - stop("Invalid surface detected", call. = FALSE) - } -} \ No newline at end of file diff --git a/inst/examples/user_input_example.R b/inst/examples/flow_free_expansion.R similarity index 54% rename from inst/examples/user_input_example.R rename to inst/examples/flow_free_expansion.R index d596b91..94279bd 100644 --- a/inst/examples/user_input_example.R +++ b/inst/examples/flow_free_expansion.R @@ -1,10 +1,13 @@ +detach("package:r2ogs6", unload=TRUE) library(r2ogs6) ogs6_obj <- OGS6$new( - sim_name = flow_free_expansion, + sim_name = "flow_free_expansion", sim_id = 1, sim_path = "D:\\OGS_Sim\\", - ogs_bin_path = "D:\\Programme\\OpenGeoSys\\ogs-6.3.2-Windows-10.0.14393-x64-python-3.7.2-de-utils\\bin\\" + ogs_bin_path <- paste0("D:\\Programme\\OpenGeoSys\\", + "ogs-6.3.2-Windows-10.0.14393-x64-python-3.7.2-de-utils", + "\\bin\\") ) @@ -70,17 +73,12 @@ ogs6_obj$add_gml( ) + ogs6_obj$add_process( r2ogs6_process( name = "HM", type = "HYDRO_MECHANICS", integration_order = 3, - dimension = 3, - constitutive_relation = list( - type = "LinearElasticIsotropic", - youngs_modulus = "E", - poissons_ratio = "nu" - ), process_variables = list(displacement = "displacement", pressure = "pressure"), secondary_variables = list( @@ -95,137 +93,108 @@ ogs6_obj$add_process( secondary_variable = c(internal_name = "velocity", output_name = "velocity") ), specific_body_force = c(0, 0, 0), - coupling_scheme = NULL + constitutive_relation = list( + type = "LinearElasticIsotropic", + youngs_modulus = "E", + poissons_ratio = "nu" + ), + dimension = 3 ) ) ogs6_obj$add_medium(r2ogs6_medium( phases = list( - r2ogs6_medium_phase( + phase = r2ogs6_phase( type = "Gas", properties = list( - r2ogs6_medium_property( - name = "viscosity", - type = "Constant", - value = 1e-05, - ... = NULL - ), - r2ogs6_medium_property( - name = "density", - type = "IdealGasLaw", - value = NULL, - ... = NULL - ), - r2ogs6_medium_property( - name = "molar_mass", - type = "Constant", - value = 0.0289643977872068, - ... = NULL - ) + property = r2ogs6_ph_property(name = "viscosity", + type = "Constant", + value = 1e-05), + property = r2ogs6_ph_property(name = "density", + type = "IdealGasLaw"), + property = r2ogs6_ph_property(name = "molar_mass", + type = "Constant", + value = 0.0289643977872068) ) ), - r2ogs6_medium_phase( + phase = r2ogs6_phase( type = "Solid", properties = list( - r2ogs6_medium_property( - name = "porosity", - type = "Constant", - value = 0.3, - ... = NULL - ), - r2ogs6_medium_property( - name = "density", - type = "Constant", - value = 1430, - ... = NULL - ), - r2ogs6_medium_property( - name = "biot_coefficient", - type = "Constant", - value = 0.6, - ... = NULL - ) + property = r2ogs6_ph_property(name = "porosity", + type = "Constant", + value = 0.3), + property = r2ogs6_ph_property(name = "density", + type = "Constant", + value = 1430), + property = r2ogs6_ph_property(name = "biot_coefficient", + type = "Constant", + value = 0.6) ) ) ), properties = list( - r2ogs6_medium_property( - name = "reference_temperature", - type = "Constant", - value = 293.15, - ... = NULL - ), - r2ogs6_medium_property( - name = "permeability", - type = "Constant", - value = 1e-05, - ... = NULL - ) - ), - id = NULL + property = r2ogs6_pr_property(name = "reference_temperature", + type = "Constant", + value = 293.15), + property = r2ogs6_pr_property(name = "permeability", + type = "Constant", + value = 1e-05) + ) )) -ogs6_obj$add_time_loop( - r2ogs6_time_loop( - processes = list( - r2ogs6_tl_process( - ref = "HM", - nonlinear_solver = "basic_newton", - convergence_criterion = list( - type = "DeltaX", - norm_type = "NORM2", - reltol = "1e-8" - ), - time_discretization = list(type = "BackwardEuler"), - time_stepping = list( - type = "FixedTimeStepping", - t_initial = 0, - t_end = 10000, - timesteps = list(pair = c(`repeat` = 1000, delta_t = 10)) - ) - ) - ), - output = r2ogs6_tl_output( - type = "VTK", - prefix = "flow_free_expansion_pcs_{:process_id}", - suffix = "_ts_{:timestep}_t_{:time}", - timesteps = list(pair = c( - `repeat` = 1, each_steps = 1000 - )), - variables = list( - variable = "displacement", - variable = "pressure", - variable = "sigma_xx", - variable = "sigma_yy", - variable = "sigma_zz", - variable = "sigma_xy", - variable = "epsilon_xx", - variable = "epsilon_yy", - variable = "epsilon_zz", - variable = "epsilon_xy", - variable = "velocity" +ogs6_obj$add_time_loop(r2ogs6_time_loop( + processes = list( + process = r2ogs6_tl_process( + ref = "HM", + nonlinear_solver = "basic_newton", + convergence_criterion = r2ogs6_convergence_criterion( + type = "DeltaX", + norm_type = "NORM2", + reltol = "1e-8" ), - compress_output = NULL + time_discretization = list(type = "BackwardEuler"), + time_stepping = r2ogs6_time_stepping( + type = "FixedTimeStepping", + t_initial = 0, + t_end = 10000, + timesteps = list(pair = list(1000, + delta_t = 10)) + ) + ) + ), + output = r2ogs6_output( + type = "VTK", + prefix = "flow_free_expansion_pcs_{:process_id}", + variables = list( + variable = "displacement", + variable = "pressure", + variable = "sigma_xx", + variable = "sigma_yy", + variable = "sigma_zz", + variable = "sigma_xy", + variable = "epsilon_xx", + variable = "epsilon_yy", + variable = "epsilon_zz", + variable = "epsilon_xy", + variable = "velocity" ), - global_processes_coupling = NULL + suffix = "_ts_{:timestep}_t_{:time}", + timesteps = list(pair = list(1, + each_steps = 1000)) ) -) +)) -ogs6_obj$add_parameter(r2ogs6_parameter( - name = "E", - type = "Constant", - values = 1e+10 -)) +ogs6_obj$add_parameter(r2ogs6_parameter(name = "E", + type = "Constant", + value = 1e+10)) -ogs6_obj$add_parameter(r2ogs6_parameter( - name = "nu", - type = "Constant", - values = 0.3 -)) +ogs6_obj$add_parameter(r2ogs6_parameter(name = "nu", + type = "Constant", + value = 0.3)) ogs6_obj$add_parameter(r2ogs6_parameter( @@ -249,18 +218,14 @@ ogs6_obj$add_parameter(r2ogs6_parameter( )) -ogs6_obj$add_parameter(r2ogs6_parameter( - name = "zero", - type = "Constant", - values = 0 -)) +ogs6_obj$add_parameter(r2ogs6_parameter(name = "zero", + type = "Constant", + value = 0)) -ogs6_obj$add_parameter(r2ogs6_parameter( - name = "flux_in", - type = "Constant", - values = 1e-04 -)) +ogs6_obj$add_parameter(r2ogs6_parameter(name = "flux_in", + type = "Constant", + value = 1e-04)) ogs6_obj$add_process_variable( @@ -270,53 +235,47 @@ ogs6_obj$add_process_variable( order = 2, initial_condition = "displacement0", boundary_conditions = list( - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Dirichlet", parameter = "zero", - component = 1, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "front" + geometry = "front", + component = 1 ), - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Dirichlet", parameter = "zero", - component = 0, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "left" + geometry = "left", + component = 0 ), - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Dirichlet", parameter = "zero", - component = 2, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "bottom" + geometry = "bottom", + component = 2 ), - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Neumann", parameter = "pressure_load", - component = 1, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "back" + geometry = "back", + component = 1 ), - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Neumann", parameter = "pressure_load", - component = 0, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "right" + geometry = "right", + component = 0 ), - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Neumann", parameter = "pressure_load", - component = 2, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "top" + geometry = "top", + component = 2 ) ) ) @@ -330,13 +289,12 @@ ogs6_obj$add_process_variable( order = 1, initial_condition = "pressure0", boundary_conditions = list( - r2ogs6_boundary_condition( + boundary_condition = r2ogs6_boundary_condition( type = "Neumann", parameter = "flux_in", - component = 0, - mesh = NULL, geometrical_set = "cube_1x1x1_geometry", - geometry = "left" + geometry = "left", + component = 0 ) ) ) @@ -356,14 +314,13 @@ ogs6_obj$add_nonlinear_solver( ogs6_obj$add_linear_solver( r2ogs6_linear_solver( name = "general_linear_solver", - eigen = list( + eigen = r2ogs6_eigen( solver_type = "BiCGSTAB", precon_type = "ILUT", max_iteration_step = 10000, error_tolerance = 1e-16 ), - lis = "-i bicgstab -p ilu -tol 1e-16 -maxiter 10000", - petsc = NULL + lis = "-i bicgstab -p ilu -tol 1e-16 -maxiter 10000" ) ) diff --git a/inst/examples/generate_benchmark_script_example.R b/inst/examples/generate_benchmark_script_example.R index 6e651b7..f62848e 100644 --- a/inst/examples/generate_benchmark_script_example.R +++ b/inst/examples/generate_benchmark_script_example.R @@ -1,8 +1,8 @@ detach("package:r2ogs6", unload=TRUE) library(r2ogs6) -# As a user you will want to alter the paths since this will only work if the working directory -# is r2ogs6, which is ok for developers but not for you (sorry!) +# As a user you will want to alter the paths since this will only work if the +# working directory is r2ogs6 #Define .prj path prj_path <- paste0("inst/extdata/flow_free_expansion/flow_free_expansion.prj") diff --git a/man/find_read_in_func_call.Rd b/man/find_read_in_func_call.Rd deleted file mode 100644 index 4e903b4..0000000 --- a/man/find_read_in_func_call.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_in_utils.R -\name{find_read_in_func_call} -\alias{find_read_in_func_call} -\title{find_read_in_func_call} -\usage{ -find_read_in_func_call(node_name) -} -\arguments{ -\item{node_name}{The name of an XML node} -} -\value{ -A ready-to-call string if a corresponding function was found, an -empty string otherwise -} -\description{ -Checks if a custom read_in function was defined for nodes -with the given name -} diff --git a/man/get_grandchild_length_vector.Rd b/man/get_grandchild_length_vector.Rd deleted file mode 100644 index d36b7b8..0000000 --- a/man/get_grandchild_length_vector.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_in_utils.R -\name{get_grandchild_length_vector} -\alias{get_grandchild_length_vector} -\title{get_grandchild_length_vector} -\usage{ -get_grandchild_length_vector(xml_node) -} -\arguments{ -\item{xml_node}{An XML node} -} -\value{ -A numeric vector containing the number of children of each child of -xml_node -} -\description{ -Helper function to check the number of children of children of -an XML node (i.e. grandchildren) -} diff --git a/man/get_list_status.Rd b/man/get_list_status.Rd deleted file mode 100644 index 74f44f2..0000000 --- a/man/get_list_status.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{get_list_status} -\alias{get_list_status} -\title{get_list_status} -\usage{ -get_list_status(flag, obj_list, element_type = "list element", is_opt = FALSE) -} -\arguments{ -\item{flag}{Boolean flag to keep track of missing components} - -\item{obj_list}{The specified list} - -\item{element_type}{Optional: What kind of elements are in the list?} - -\item{is_opt}{flag: Does the list need at least one element?} -} -\description{ -Helper function for get_status() to check if a list has at least -one element. -} diff --git a/man/input_add.r2ogs6_gml.Rd b/man/input_add.r2ogs6_gml.Rd deleted file mode 100644 index 5099cff..0000000 --- a/man/input_add.r2ogs6_gml.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gml.R -\name{input_add.r2ogs6_gml} -\alias{input_add.r2ogs6_gml} -\title{input_add.r2ogs6_gml} -\usage{ -input_add.r2ogs6_gml(x, ogs6_obj) -} -\arguments{ -\item{x}{A r2ogs6_gml class object} - -\item{ogs6_obj}{A OGS6 class object} -} -\description{ -Implementation of generic function input_add for S3 class r2ogs6_gml -} diff --git a/man/is_het_wrapper.Rd b/man/is_het_wrapper.Rd deleted file mode 100644 index eca5e57..0000000 --- a/man/is_het_wrapper.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_in_utils.R -\name{is_het_wrapper} -\alias{is_het_wrapper} -\title{is_het_wrapper} -\usage{ -is_het_wrapper(xml_node, subclasses_names = character()) -} -\arguments{ -\item{xml_node}{An XML node (of class xml2::xml_node)} - -\item{subclasses_names}{Optional: A character vector containing the names of -r2ogs6 subclasses (r2ogs6 classes without a method for input_add)} -} -\description{ -Tests if a node is a heterogenous wrapper -} diff --git a/man/list_from_nodeset.Rd b/man/list_from_nodeset.Rd deleted file mode 100644 index 77175d5..0000000 --- a/man/list_from_nodeset.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_in_utils.R -\name{list_from_nodeset} -\alias{list_from_nodeset} -\title{list_from_nodeset} -\usage{ -list_from_nodeset(xml_nodeset) -} -\arguments{ -\item{xml_nodeset}{An XML nodeset (of class xml2::xml_nodeset)} -} -\description{ -Creates a named vector from a nodeset -} diff --git a/man/obj_is_defined.Rd b/man/obj_is_defined.Rd deleted file mode 100644 index 31e4fa1..0000000 --- a/man/obj_is_defined.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{obj_is_defined} -\alias{obj_is_defined} -\title{obj_is_defined} -\usage{ -obj_is_defined(flag, obj, obj_type = "", is_opt = FALSE) -} -\arguments{ -\item{flag}{Boolean flag to keep track of missing components} - -\item{obj}{The specified object} - -\item{obj_type}{Optional: What kind of object is this?} - -\item{is_opt}{flag: Is the element optional i.e. can it be NULL?} -} -\description{ -Helper function for get_status() to check if an object was -defined -} diff --git a/man/read_in_timesteps_node.Rd b/man/read_in_timesteps_node.Rd deleted file mode 100644 index 6aee261..0000000 --- a/man/read_in_timesteps_node.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_in_prj.R -\name{read_in_timesteps_node} -\alias{read_in_timesteps_node} -\title{read_in_timesteps_node} -\usage{ -read_in_timesteps_node(timesteps_node) -} -\arguments{ -\item{timesteps_node}{The timesteps node} -} -\description{ -Reads in a timesteps node -} diff --git a/man/validate_paths.Rd b/man/validate_paths.Rd deleted file mode 100644 index 1ad4c8f..0000000 --- a/man/validate_paths.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sim_utils.R -\name{validate_paths} -\alias{validate_paths} -\title{validate_paths} -\usage{ -validate_paths(sim_path, ogs_bin_path) -} -\arguments{ -\item{sim_path}{The path where all relevant files for the simulation will be saved} - -\item{ogs_bin_path}{Path to OpenGeoSys6 /bin directory} -} -\description{ -Helper function to pull path validation out of already large class OGS6 -} diff --git a/tests/testthat/test-validate_gml.R b/tests/testthat/test-validate_gml.R deleted file mode 100644 index 59465b0..0000000 --- a/tests/testthat/test-validate_gml.R +++ /dev/null @@ -1,63 +0,0 @@ -test_that("validate_points function checks if input is a tibble with the right contents", { - - point_list <- list(x = c(0, 0), y = c(1, 1), z = c(0, 1)) - - #Check class (should expect a tibble, not a list) - expect_error(validate_points(point_list)) - - point_tibble_inv_0 <- tibble::tibble(a = c(0, 0), b = c(1, 1), c = c(0, 1)) - point_tibble_inv_1 <- tibble::tibble(x = c(0, 0), y = c(1, 1), z = c(0)) - point_tibble_inv_2 <- tibble::tibble(x = c(0, 0), y = c(1, 1), z = c(0, 1), name = c("oh", "oh")) - - #Check column names - expect_error(validate_points(point_tibble_inv_0)) - - #Check if duplicate points and point names are detected - expect_error(validate_points(point_tibble_inv_1)) - expect_warning(validate_points(point_tibble_inv_2)) - - point_tibble_val <- tibble::tibble(x = c(0, 0), y = c(1, 1), z = c(0, 1), name = c("this", "works")) - point_tibble_val_2 <- tibble::tibble(x = c(0, 0), y = c(1, 1), z = c(0, 1)) - - expect_invisible(validate_points(point_tibble_val)) - expect_invisible(validate_points(point_tibble_val_2)) -}) - - -test_that("validate_polylines function checks if input is a list with the right contents", { - - polyline_tibble <- tibble::tibble(name = "tibble", polyline = c(c(1, 2))) - - #Check class (should expect a list, not a tibble) - expect_error(validate_polylines(polyline_tibble)) - - polyline_list_inv_0 <- list(name = "missing_polyline_list", c(1,2)) - polyline_list_inv_1 <- list(list(name = "wrong_length", c(0, 1, 2), c(1, 2))) - polyline_list_inv_2 <- list(list(name = 42, c(1, 2))) - polyline_list_inv_3 <- list(list(name = "wrong_points", c("this", "should", "fail"))) - - expect_error(validate_polylines(polyline_list_inv_0)) - expect_error(validate_polylines(polyline_list_inv_1)) - expect_error(validate_polylines(polyline_list_inv_2)) - expect_error(validate_polylines(polyline_list_inv_3)) - - polyline_list_val_0 <- list(list(name = "cool", c(1, 2))) - polyline_list_val_1 <- list(list(name = "also cool", c(1, 2, 4, 5, 1))) - - expect_invisible(validate_polylines(polyline_list_val_0)) - expect_invisible(validate_polylines(polyline_list_val_1)) - - #...(WIP) - -}) - - -test_that("validate_surfaces function checks if input is a list with the right contents", { - - surface_tibble <- tibble::tibble(name = "tibble", surface = c(c(0, 1, 2), c(1, 2, 3))) - - #Check class (should expect a list, not a tibble) - expect_error(validate_surfaces(surface_tibble)) - - #...(WIP) -}) \ No newline at end of file -- GitLab