Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
r2ogs6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
OpenGeoSys Tools
r2ogs6
Commits
d582639f
Commit
d582639f
authored
2 years ago
by
Johannes Boog
Browse files
Options
Downloads
Patches
Plain Diff
[base] add prj_surface class
parent
26d3bead
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!55
[base] update package to OGS6.4.2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/prj_chemical_system.R
+53
-9
53 additions, 9 deletions
R/prj_chemical_system.R
data/xpaths_for_classes.rda
+0
-0
0 additions, 0 deletions
data/xpaths_for_classes.rda
tests/testthat/test-read_in_prj.R
+1
-1
1 addition, 1 deletion
tests/testthat/test-read_in_prj.R
with
54 additions
and
10 deletions
R/prj_chemical_system.R
+
53
−
9
View file @
d582639f
...
...
@@ -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
This diff is collapsed.
Click to expand it.
data/xpaths_for_classes.rda
+
0
−
0
View file @
d582639f
No preview for this file type
This diff is collapsed.
Click to expand it.
tests/testthat/test-read_in_prj.R
+
1
−
1
View file @
d582639f
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment