Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Godoy, William
jexio
Commits
bb4ec64c
Commit
bb4ec64c
authored
Jun 11, 2020
by
William F Godoy
Browse files
Working on independent variables
parent
2a138c08
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
bb4ec64c
# jexio
Run tests:
Julia Extractor for Input Output.
Set of scripts to generate I/O patterns understanding for particular applications.
Supported:
`> julia --project=. test/runtests.jl`
-
[
AMReX-Astro Castro
](
https://amrex-astro.github.io/Castro/
)
For simple usage see tests:
1.
Install requirements (run once):
`$ julia scripts/requirements.jl`
2.
Run tests:
`$ julia --project=. test/runtests.jl`
Formatting the code:
`$ julia scripts/formatter.jl`
src/extractor/Amrex.jl
View file @
bb4ec64c
...
...
@@ -57,3 +57,55 @@ function input_parser(extractor::AbstractAmrex, inputFile::String)::Dict{String,
return
parameters
end
"""
Get actual independent variables for I/O characterization:
number of cells or ncells, output frequency or nplots, ncheckpoints, etc.
from input parameters
# Arguments
- `extractor::AbstractAmrex` : input type extending AbstractAmrex
- `parameters::Dict{String,String}` : input file to be parsed, absolute path is preferred
"""
function
get_independent_variables
(
extractor
::
AbstractAmrex
,
parameters
)
::
Dict
independentVariables
=
Dict
()
# Number of output events,
# get is the safe way. 3rd argument is a default fallback if key not found
maxStepStr
=
get
(
parameters
,
"max_step"
,
""
)
if
maxStepStr
!=
""
# safe string conversion to a type
maxStep
=
parse
(
Int64
,
maxStepStr
)
plotIntStr
=
get
(
parameters
,
"amr.plot_int"
,
""
)
if
plotIntStr
!=
""
plotFrequency
=
parse
(
Int64
,
plotIntStr
)
independentVariables
[
"nplots"
]
=
maxStep
/
plotFrequency
else
throw
(
NoSuchFieldException
(
"jexio Amrex: Can't find amr.plot_int"
))
end
checkIntStr
=
get
(
parameters
,
"amr.check_int"
,
""
)
if
checkIntStr
!=
""
checkpointFrequency
=
parse
(
Int64
,
checkIntStr
)
independentVariables
[
"ncheckpoints"
]
=
maxStep
/
checkpointFrequency
else
throw
(
NoSuchFieldException
(
"jexio Amrex: Can't find amr.check_int"
))
end
end
# Using the dot "." operator to apply it on an element-by-element basis (like a dot product)
# input is a dictionary with key="amr.ncell" and value = {"nx" "ny" "nz"},
# output is nx*ny*nz
# Example:
# input Dict[ "amr.n_cell" => ["16" "16"] ], if key not found return 0
# >ncells
# 256
ncells
=
prod
(
parse
.
(
Int64
,
split
(
get
(
parameters
,
"amr.n_cell"
,
[
"0"
]
)
)))
independentVariables
[
"ncells"
]
=
ncells
return
independentVariables
end
test/test_AmrexCastro.jl
View file @
bb4ec64c
...
...
@@ -61,6 +61,11 @@ function test_AmrexCastro()
test_value
(
counter
,
parameters
,
"amr.probin_file"
,
"probin.2d.cyl_in_cartcoords"
)
@test
counter
==
27
independent_variables
=
Exio
.
get_independent_variables
(
exio
.
extractor
,
parameters
)
println
(
independent_variables
)
end
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment