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
f56adb1c
Commit
f56adb1c
authored
4 years ago
by
Ruben Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
[base] Added missing quotes
parent
93abf558
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/generate_benchmark_script.R
+19
-2
19 additions, 2 deletions
R/generate_benchmark_script.R
with
19 additions
and
2 deletions
R/generate_benchmark_script.R
+
19
−
2
View file @
f56adb1c
...
@@ -65,7 +65,8 @@ generate_benchmark_script <- function(prj_path,
...
@@ -65,7 +65,8 @@ generate_benchmark_script <- function(prj_path,
sim_name
<-
tools
::
file_path_sans_ext
(
basename
(
prj_path
))
sim_name
<-
tools
::
file_path_sans_ext
(
basename
(
prj_path
))
script_str
<-
paste0
(
"library(r2ogs6)\n\n"
,
script_str
<-
paste0
(
"library(r2ogs6)\n\n"
,
"ogs6_obj <- OGS6$new(sim_name = "
,
sim_name
,
",\n"
,
"ogs6_obj <- OGS6$new(sim_name = \""
,
sim_name
,
"\",\n"
,
"sim_id = 1,\n"
,
"sim_id = 1,\n"
,
"sim_path = \"your_sim_path\",\n"
,
"sim_path = \"your_sim_path\",\n"
,
"ogs_bin_path = \"your_bin_path\")\n\n\n"
)
"ogs_bin_path = \"your_bin_path\")\n\n\n"
)
...
@@ -158,6 +159,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
...
@@ -158,6 +159,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
if
(
nested_call
){
if
(
nested_call
){
ret_str
<-
paste0
(
class_name
,
"("
,
content_str
,
")"
)
ret_str
<-
paste0
(
class_name
,
"("
,
content_str
,
")"
)
ret_str
<-
delete_nulls_from_str
(
ret_str
)
ret_str
<-
delete_nulls_from_str
(
ret_str
)
ret_str
<-
delete_keywords_from_str
(
ret_str
)
return
(
invisible
(
ret_str
))
return
(
invisible
(
ret_str
))
}
}
...
@@ -165,6 +167,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
...
@@ -165,6 +167,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
tag_name
,
tag_name
,
"("
,
class_name
,
"("
,
content_str
,
"))\n"
)
"("
,
class_name
,
"("
,
content_str
,
"))\n"
)
ret_str
<-
delete_nulls_from_str
(
ret_str
)
ret_str
<-
delete_nulls_from_str
(
ret_str
)
ret_str
<-
delete_keywords_from_str
(
ret_str
)
return
(
invisible
(
ret_str
))
return
(
invisible
(
ret_str
))
}
}
...
@@ -204,7 +207,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
...
@@ -204,7 +207,7 @@ construct_add_call <- function(object, nested_call = FALSE) {
#'@description Utility function to delete "param_name = NULL" from a string,
#'@description Utility function to delete "param_name = NULL" from a string,
#' this isn't necessary for functionality of generate_benchmark_script but will
#' this isn't necessary for functionality of generate_benchmark_script but will
#' make generated scripts way more readable.
#' make generated scripts way more readable.
#'@param string
A
string
#'@param string string
delete_nulls_from_str
<-
function
(
string
){
delete_nulls_from_str
<-
function
(
string
){
#For single line calls
#For single line calls
...
@@ -224,3 +227,17 @@ delete_nulls_from_str <- function(string){
...
@@ -224,3 +227,17 @@ delete_nulls_from_str <- function(string){
return
(
invisible
(
string
))
return
(
invisible
(
string
))
}
}
#'delete_keywords_from_str
#'@description Utility function to delete keywords from a string,
#' this important because there is a <repeat> tag in <time_loop> and
#' "repeat" is a reserved word in R (extend this function if you find more
#' reserved words)
#'@param string string
delete_keywords_from_str
<-
function
(
string
){
string
<-
stringr
::
str_remove_all
(
string
,
"repeat = "
)
return
(
invisible
(
string
))
}
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