Commit 1feb1e2e authored by William F Godoy's avatar William F Godoy

Finding output directories using Glob module

parent bb4ec64c
......@@ -3,6 +3,9 @@ name = "Exio"
uuid = "0525473d-17b7-4fd3-beb1-bf17216ddbac"
version = "0.0.1"
[deps]
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
[compat]
julia = "1"
JuliaFormatter = "0.6.2"
......
......@@ -6,5 +6,6 @@
using Pkg
Pkg.add("JuliaFormatter")
Pkg.add("Glob")
exit()
......@@ -75,13 +75,14 @@ function get_independent_variables(extractor::AbstractAmrex, parameters)::Dict
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
independentVariables["amr.nplot_files"] = floor(Int32, maxStep / plotFrequency)
else
throw(NoSuchFieldException("jexio Amrex: Can't find amr.plot_int"))
end
......@@ -89,7 +90,7 @@ function get_independent_variables(extractor::AbstractAmrex, parameters)::Dict
checkIntStr = get(parameters, "amr.check_int", "")
if checkIntStr != ""
checkpointFrequency = parse(Int64, checkIntStr)
independentVariables["ncheckpoints"] = maxStep / checkpointFrequency
independentVariables["amr.ncheck_files"] = floor(Int32, maxStep / checkpointFrequency)
else
throw(NoSuchFieldException("jexio Amrex: Can't find amr.check_int"))
end
......@@ -103,8 +104,14 @@ function get_independent_variables(extractor::AbstractAmrex, parameters)::Dict
# 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
ncells = prod(parse.(Int64, split(get(parameters, "amr.n_cell", ["0"]))))
independentVariables["amr.ncells"] = ncells
maxLevel = get(parameters, "amr.max_level", "")
independentVariables["amr.max_level"] = maxLevel == "" ? 1 : parse(Int32, maxLevel)
regrid = get(parameters, "amr.regrid_int", "")
independentVariables["amr.regrid_int"] = regrid == "" ? 1 : parse(Int32, regrid)
return independentVariables
......
import Glob
mutable struct AmrexCastro <: AbstractAmrex
app::String
degreesOfFreedom::Any
......@@ -26,3 +28,24 @@ function init!(extractor::AmrexCastro, outputPrefix::String)
]
extractor.outputPrefix = outputPrefix
end
function get_dependent_variable_datasize(extractor::AmrexCastro)
findDelimiter = findlast("/",extractor.outputPrefix)
println(extractor.outputPrefix)
println(findDelimiter)
searchDirectory = extractor.outputPrefix[ 1: findDelimiter[1]-1 ]
prefix = extractor.outputPrefix[ findDelimiter[1]+1:end]
println("Search directory: ", searchDirectory, " prefix: ", prefix)
outputDirs = Glob.glob( string(prefix,"*"), searchDirectory )
println(outputDirs)
end
......@@ -16,7 +16,7 @@ function test_value(
end
function test_AmrexCastro()
exio = Exio.exio_init("AmrexCastro", ".")
exio = Exio.exio_init("AmrexCastro", "/home/wgodoy/workspace/Castro/Exec/hydro_tests/Sedov/case")
@test typeof(exio) == Exio.ExioH
......@@ -63,9 +63,10 @@ function test_AmrexCastro()
@test counter == 27
independent_variables = Exio.get_independent_variables(exio.extractor, parameters)
println(independent_variables)
Exio.get_dependent_variable_datasize(exio.extractor)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment