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
e6f3d9a9
Commit
e6f3d9a9
authored
4 years ago
by
Ruben Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
[base] Added .pvd parameter slot to OGS6 class
parent
5b17d1b3
No related branches found
No related tags found
1 merge request
!6
Merge branch 7 fixed functionality into master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/ogs6.R
+65
-33
65 additions, 33 deletions
R/ogs6.R
with
65 additions
and
33 deletions
R/ogs6.R
+
65
−
33
View file @
e6f3d9a9
...
...
@@ -59,13 +59,15 @@ OGS6 <- R6::R6Class("OGS6",
#' not of a proprietary `r2ogs6` class, `component_name` must be
#' supplied. E.g. If you're adding a `python_script` which is a string, you
#' would call `your_ogs6_obj$add("some_script.py", "python_script")`
#'@param component_name string: Optional: The name of the component to be
#' added
add
=
function
(
x
,
component_name
=
""
){
assertthat
::
assert_that
(
assertthat
::
is.string
(
component_name
))
# Assert that class name is in implemented classes for OGS6
ogs6_components
<-
get_implemented_classe
s
()
ogs6_components
<-
addable_prj_component
s
()
x_class_name
<-
""
x_of_r2ogs6_class
<-
FALSE
...
...
@@ -118,17 +120,17 @@ OGS6 <- R6::R6Class("OGS6",
add_gml
=
function
(
gml
){
if
(
assertthat
::
is.string
(
gml
)){
check_file_extension
(
gml
,
"
gml
"
)
assertthat
::
assert_that
(
grepl
(
"\\.
gml
$"
,
gml
)
)
private
$
.geometry
<-
gml
}
else
{
assertthat
::
assert_that
(
class
(
gml
)
==
"r2ogs
6_gml"
)
assertthat
::
assert_that
(
inherits
(
gml
,
"OGS
6_gml"
)
)
private
$
.gml
<-
gml
if
(
!
is.null
(
private
$
.geometry
)){
warning
(
paste
(
"OGS6 parameter 'geometry' now refers"
,
"to a different .gml object"
),
call.
=
FALSE
)
}
private
$
.geometry
<-
paste0
(
gml
$
name
,
".gml"
)
private
$
.geometry
<-
paste0
(
self
$
sim_
name
,
".gml"
)
}
},
...
...
@@ -140,15 +142,13 @@ OGS6 <- R6::R6Class("OGS6",
add_vtu
=
function
(
path
,
read_in_vtu
=
FALSE
){
assertthat
::
assert_that
(
assertthat
::
is.string
(
path
))
assertthat
::
assert_that
(
grepl
(
"\\.vtu$"
,
path
)
||
grepl
(
"\\.vtk$"
,
path
)
||
grepl
(
"\\.msh$"
,
path
))
assertthat
::
assert_that
(
grepl
(
"\\.vtu$"
,
path
))
assertthat
::
assert_that
(
assertthat
::
is.flag
(
read_in_vtu
))
self
$
meshes
<-
c
(
self
$
meshes
,
mesh
=
path
)
if
(
read_in_vtu
){
private
$
.vtus
<-
c
(
private
$
.vtus
,
list
(
read_in_vtu
(
path
)))
private
$
.vtus
<-
c
(
private
$
.vtus
,
list
(
OGS6_vtu
$
new
(
path
)))
}
},
...
...
@@ -276,7 +276,7 @@ OGS6 <- R6::R6Class("OGS6",
assertthat
::
assert_that
(
assertthat
::
is.flag
(
print_status
))
flag
<-
TRUE
impl_classes
<-
get_implemented_classe
s
()
impl_classes
<-
addable_prj_component
s
()
status_strs
<-
character
()
...
...
@@ -320,12 +320,12 @@ OGS6 <- R6::R6Class("OGS6",
#'Clears components from the OGS6 object
#'@param which character: The names of the components (all by default).
#' If you want to delete only some components, run
#' names(
get_implemented_classe
s()) for the available options.
clear
=
function
(
which
=
names
(
get_implemented_classe
s
())){
#' names(
addable_prj_component
s()) for the available options.
clear
=
function
(
which
=
names
(
addable_prj_component
s
())){
assertthat
::
assert_that
(
is.character
(
which
))
valid_input
=
names
(
get_implemented_classe
s
())
valid_input
=
names
(
addable_prj_component
s
())
null_it
<-
c
(
"geometry"
,
"time_loop"
)
...
...
@@ -439,7 +439,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.vtus
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"vtus"
]])
addable_prj_component
s
()[[
"vtus"
]])
private
$
.vtus
<-
value
}
},
...
...
@@ -462,7 +462,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.search_length_algorithm
}
else
{
assertthat
::
assert_that
(
get_implemented_classe
s
()[[
"search_length_algorithm"
]]
%in%
addable_prj_component
s
()[[
"search_length_algorithm"
]]
%in%
class
(
value
))
private
$
.search_length_algorithm
<-
value
}
...
...
@@ -474,8 +474,26 @@ OGS6 <- R6::R6Class("OGS6",
if
(
missing
(
value
))
{
private
$
.processes
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classes
()[[
"processes"
]])
# If there already is a process element
if
(
length
(
private
$
.processes
)
>
0
){
if
(
addable_prj_components
()[[
"processes"
]]
%in%
class
(
private
$
.processes
[[
1
]])){
validate_wrapper_list
(
value
,
addable_prj_components
()[[
"processes"
]])
}
else
{
assertthat
::
assert_that
(
assertthat
::
is.string
(
value
))
value
<-
list
(
include
=
c
(
file
=
value
))
}
}
else
{
if
(
assertthat
::
is.string
(
value
)){
value
<-
list
(
include
=
c
(
file
=
value
))
}
else
{
validate_wrapper_list
(
value
,
addable_prj_components
()[[
"processes"
]])
}
}
private
$
.processes
<-
value
}
},
...
...
@@ -487,7 +505,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.time_loop
}
else
{
assertthat
::
assert_that
(
get_implemented_classe
s
()[[
"time_loop"
]]
%in%
addable_prj_component
s
()[[
"time_loop"
]]
%in%
class
(
value
))
private
$
.time_loop
<-
value
}
...
...
@@ -500,7 +518,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.local_coordinate_system
}
else
{
assertthat
::
assert_that
(
get_implemented_classe
s
()[[
"local_coordinate_system"
]]
%in%
addable_prj_component
s
()[[
"local_coordinate_system"
]]
%in%
class
(
value
))
private
$
.local_coordinate_system
<-
value
}
...
...
@@ -513,7 +531,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.media
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"media"
]])
addable_prj_component
s
()[[
"media"
]])
private
$
.media
<-
value
}
},
...
...
@@ -525,7 +543,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.parameters
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"parameters"
]])
addable_prj_component
s
()[[
"parameters"
]])
private
$
.parameters
<-
value
}
},
...
...
@@ -537,7 +555,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.curves
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"curves"
]])
addable_prj_component
s
()[[
"curves"
]])
private
$
.curves
<-
value
}
},
...
...
@@ -550,7 +568,7 @@ OGS6 <- R6::R6Class("OGS6",
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"process_variables"
]])
addable_prj_component
s
()[[
"process_variables"
]])
private
$
.process_variables
<-
value
}
},
...
...
@@ -563,7 +581,7 @@ OGS6 <- R6::R6Class("OGS6",
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"nonlinear_solvers"
]])
addable_prj_component
s
()[[
"nonlinear_solvers"
]])
private
$
.nonlinear_solvers
<-
value
}
},
...
...
@@ -575,7 +593,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.linear_solvers
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"linear_solvers"
]])
addable_prj_component
s
()[[
"linear_solvers"
]])
private
$
.linear_solvers
<-
value
}
},
...
...
@@ -587,7 +605,7 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.test_definition
}
else
{
validate_wrapper_list
(
value
,
get_implemented_classe
s
()[[
"test_definition"
]])
addable_prj_component
s
()[[
"test_definition"
]])
private
$
.test_definition
<-
value
}
},
...
...
@@ -599,15 +617,26 @@ OGS6 <- R6::R6Class("OGS6",
private
$
.insitu
}
else
{
assertthat
::
assert_that
(
get_implemented_classe
s
()[[
"insitu"
]]
%in%
addable_prj_component
s
()[[
"insitu"
]]
%in%
class
(
value
))
private
$
.insitu
<-
value
}
},
#'@field pvd
#'Access to private parameter '.pvd'
pvd
=
function
(
value
)
{
if
(
missing
(
value
))
{
private
$
.pvd
}
else
{
assertthat
::
assert_that
(
inherits
(
value
,
"OGS6_pvd"
))
private
$
.pvd
<-
value
}
}
),
private
=
list
(
#general parameters
#
general parameters
.sim_name
=
NULL
,
.sim_id
=
NULL
,
.sim_path
=
NULL
,
...
...
@@ -615,18 +644,18 @@ OGS6 <- R6::R6Class("OGS6",
.logfile
=
NULL
,
#.gml
parameters
#
.gml
object
.gml
=
NULL
,
#.vtu
parameter
s
#
.vtu
object
s
.vtus
=
NULL
,
#.prj parameters
#
.prj parameters
#.gml reference
#
.gml reference
.geometry
=
NULL
,
#.vtu reference(s)
#
.vtu reference(s)
.meshes
=
list
(),
.python_script
=
NULL
,
...
...
@@ -641,6 +670,9 @@ OGS6 <- R6::R6Class("OGS6",
.nonlinear_solvers
=
list
(),
.linear_solvers
=
list
(),
.test_definition
=
list
(),
.insitu
=
NULL
.insitu
=
NULL
,
# .pvd object (output)
.pvd
=
NULL
)
)
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