Skip to content
Snippets Groups Projects
Commit d582639f authored by Johannes Boog's avatar Johannes Boog
Browse files

[base] add prj_surface class

parent 26d3bead
No related branches found
No related tags found
1 merge request!55[base] update package to OGS6.4.2
......@@ -66,16 +66,9 @@ new_prj_chemical_system <- function(chemical_solver,
database)
assertthat::assert_that(class(solution) == "prj_solution")
assertthat::assert_that(is.null(exchangers) |
class(exchangers) == "prj_exchangers")
are_null_or_strings(mesh)
if(!is.null(equilibrium_reactants)){
is_wrapper_list(equilibrium_reactants,
"prj_phase_component")
}
knobs <- is_null_or_coerce_names(
knobs,
c("max_iter",
......@@ -95,6 +88,17 @@ new_prj_chemical_system <- function(chemical_solver,
"prj_rate")
}
if(!is.null(equilibrium_reactants)){
is_wrapper_list(equilibrium_reactants,
"prj_phase_component")
}
assertthat::assert_that(is.null(surface) |
class(surface) == "prj_surface")
assertthat::assert_that(is.null(exchangers) |
class(exchangers) == "prj_exchangers")
structure(list(chemical_solver = chemical_solver,
database = database,
solution = solution,
......@@ -108,7 +112,7 @@ new_prj_chemical_system <- function(chemical_solver,
linear_solver = linear_solver,
exchangers = exchangers,
xpath = "chemical_system",
attr_names = c("chemical_solver"),
attr_names = c("chemical_solver", "site_unit"),
flatten_on_exp = character()
),
class = "prj_chemical_system"
......@@ -284,7 +288,6 @@ new_prj_kinetic_reactant <- function(name,
#===== prj_rate =====
#' prj_rate
#' @description S3 class describing .prj rate
#' @param kinetic_reactant string: References a kinetic_reactant object
......@@ -319,6 +322,9 @@ new_prj_rate <- function(kinetic_reactant,
)
}
#=== prj_exchangers ====
#'prj_exchangers
#'@description tag: exchangers
#'@param exchange_site list
......@@ -342,3 +348,41 @@ new_prj_exchangers <- function(exchange_site) {
class = "prj_exchangers"
)
}
#=== prj_surface ====
#'prj_surface
#'@description tag: surface
#'@param site_unit Optional: string
#'@param ... site
#'@export
prj_surface <- function(site_unit = NULL,
...) {
ellipsis_list <- list(...)
site <- ellipsis_list[names(ellipsis_list) == "site"]
new_prj_surface(site_unit,
site)
}
new_prj_surface <- function(site_unit,
site) {
are_null_or_strings(site_unit)
assertthat::assert_that(is.list(site))
for (each in site){
assertthat::assert_that(is.list(each))
}
structure(list(site_unit = site_unit,
site = site,
xpath = "chemical_system/surface",
attr_names = c("site_unit"),
unwrap_on_exp = c("site"),
flatten_on_exp = character()
),
class = "prj_surface"
)
}
\ No newline at end of file
No preview for this file type
......@@ -433,7 +433,7 @@ test_that("read_in works for chemical_system objects", {
expect_equal(ogs6_obj$chemical_system$chemical_solver, "Phreeqc")
expect_equal(ogs6_obj$chemical_system$database, dat_path)
expect_equal(class(ogs6_obj$chemical_system$solution), "prj_solution")
expect_equal(length(ogs6_obj$chemical_system$solution), 8)
expect_equal(length(ogs6_obj$chemical_system$solution), 9)
expect_equal(ogs6_obj$chemical_system$solution$temperature, 25)
expect_equal(length(ogs6_obj$chemical_system$knobs), 5)
})
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment