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
39bd9611
Commit
39bd9611
authored
4 years ago
by
Ruben Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
[base] docs and NAMESPACE cleanup
parent
c3e744a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
Merge branch 7 fixed functionality into master
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/testthat/test-export_gml.R
+1
-1
1 addition, 1 deletion
tests/testthat/test-export_gml.R
tests/testthat/test-vtu.R
+30
-34
30 additions, 34 deletions
tests/testthat/test-vtu.R
with
31 additions
and
35 deletions
tests/testthat/test-export_gml.R
+
1
−
1
View file @
39bd9611
...
@@ -8,7 +8,7 @@ test_that("export_gml works", {
...
@@ -8,7 +8,7 @@ test_that("export_gml works", {
dir.create
(
test_path
)
dir.create
(
test_path
)
# Define gml object
# Define gml object
test_gml
<-
r2ogs
6_gml
(
test_gml
<-
OGS
6_gml
$
new
(
name
=
"test_geometry"
,
name
=
"test_geometry"
,
points
=
tibble
::
tibble
(
points
=
tibble
::
tibble
(
x
=
c
(
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
),
x
=
c
(
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
),
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-vtu.R
+
30
−
34
View file @
39bd9611
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
skip_if_python_modules_missing
<-
function
()
{
skip_if_python_modules_missing
<-
function
()
{
used_modules
<-
c
(
"vtk"
,
used_modules
<-
c
(
"vtk"
,
"vtk.numpy_interface.dataset_adapter"
,
"vtk.numpy_interface.dataset_adapter"
)
"zlib"
)
lapply
(
used_modules
,
function
(
x
){
lapply
(
used_modules
,
function
(
x
){
if
(
!
reticulate
::
py_module_available
(
x
)){
if
(
!
reticulate
::
py_module_available
(
x
)){
...
@@ -45,7 +44,7 @@ test_that("OGS6_pvd$get_timestep_by_vtu_path works", {
...
@@ -45,7 +44,7 @@ test_that("OGS6_pvd$get_timestep_by_vtu_path works", {
timestep
<-
ogs6_pvd
$
get_timestep_by_vtu_path
(
vtu_path
=
vtu_path
)
timestep
<-
ogs6_pvd
$
get_timestep_by_vtu_path
(
vtu_path
=
vtu_path
)
expect_equal
(
timestep
,
"
99.9999999999986
"
)
expect_equal
(
timestep
,
99.9999999999986
)
})
})
...
@@ -63,36 +62,55 @@ test_that("OGS6_pvd$get_PointData_time_tibble works", {
...
@@ -63,36 +62,55 @@ test_that("OGS6_pvd$get_PointData_time_tibble works", {
"velocity"
)
"velocity"
)
time_tibble
<-
ogs6_pvd
$
get_PointData_time_tibble
(
Names
=
Names
)
time_tibble
<-
ogs6_pvd
$
get_PointData_time_tibble
(
Names
=
Names
)
expect_equal
(
length
(
time_tibble
),
341
)
})
test_that
(
"OGS6_pvd$get_PointData_at_timestep works"
,
{
skip_if_python_modules_missing
()
pvd_path
<-
system.file
(
"extdata/benchmarks/flow_no_strain"
,
"flow_no_strain.pvd"
,
package
=
"r2ogs6"
)
ogs6_pvd
<-
OGS6_pvd
$
new
(
pvd_path
)
expect_equal
(
length
(
time_tibble
),
2
)
point_data
<-
ogs6_pvd
$
get_PointData_at_timestep
(
point_ids
=
0
,
Names
=
"HydraulicFlow"
,
timestep
=
0
)
expect_equal
(
length
(
point_data
),
1
)
expect_equal
(
names
(
point_data
),
"p0"
)
})
})
#===== OGS6_vtu =====
#===== OGS6_vtu =====
test_that
(
"
read_in_vtu
works"
,
{
test_that
(
"
OGS6_vtu initialization
works"
,
{
vtu_path
<-
system.file
(
"extdata/benchmarks/flow_free_expansion"
,
vtu_path
<-
system.file
(
"extdata/benchmarks/flow_free_expansion"
,
"cube_1x1x1.vtu"
,
"cube_1x1x1.vtu"
,
package
=
"r2ogs6"
)
package
=
"r2ogs6"
)
ogs6_vtu
<-
read_in_vtu
(
vtu_path
=
vtu_path
)
vtu_obj
<-
OGS6_vtu
$
new
(
vtu_path
=
vtu_path
)
expect_equal
(
"vtkmodules.vtkCommonDataModel.vtkUnstructuredGrid"
%in%
expect_equal
(
"vtkmodules.vtkCommonDataModel.vtkUnstructuredGrid"
%in%
class
(
ogs6_vtu
$
vtkUnstructuredGrid
),
TRUE
)
class
(
vtu_obj
$
vtkUnstructuredGrid
),
TRUE
)
})
})
#===== generate_structured_mesh =====
#===== generate_structured_mesh =====
#Add test...
#Add test...
#=====
read_in
_PointData
_DataArray
=====
#=====
get
_PointData =====
test_that
(
"
read_in
_PointData
_DataArray
works"
,
{
test_that
(
"
get
_PointData works"
,
{
skip_if_python_modules_missing
()
skip_if_python_modules_missing
()
...
@@ -100,31 +118,9 @@ test_that("read_in_PointData_DataArray works", {
...
@@ -100,31 +118,9 @@ test_that("read_in_PointData_DataArray works", {
"flow_free_expansion_ts_1000_t_10000.000000.vtu"
,
"flow_free_expansion_ts_1000_t_10000.000000.vtu"
,
package
=
"r2ogs6"
)
package
=
"r2ogs6"
)
vtu_obj
<-
read_in_vtu
(
vtu_path
)
vtu_obj
<-
OGS6_vtu
$
new
(
vtu_path
=
vtu_path
)
pd_data_array
<-
vtu_obj
$
get_PointData_DataArray
(
Name
=
"HydraulicFlow"
)
expect_equal
(
class
(
pd_data_array
),
"array"
)
})
#===== General .vtk library tests =====
pd_data_array
<-
vtu_obj
$
get_PointData
(
Name
=
"HydraulicFlow"
)
expect_equal
(
class
(
pd_data_array
),
"array"
)
test_that
(
"zlib decompressing works as expected"
,
{
skip_if_python_modules_missing
()
py_env
<-
reticulate
::
py_run_string
(
paste
(
"import zlib"
,
"test_data = bytearray('123', 'utf-8')"
,
"compr_data = zlib.compress(test_data)"
,
"decompr_data = zlib.decompress(compr_data)"
,
"check = test_data.decode('utf-8') == decompr_data.decode('utf-8')"
,
sep
=
"\n"
),
convert
=
TRUE
)
expect_equal
(
py_env
$
check
,
TRUE
)
})
})
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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