From 18f72114c23ae4a0d35ee79519b848d9e642baa0 Mon Sep 17 00:00:00 2001 From: Hongyang Zhou Date: Wed, 29 Nov 2023 16:15:58 -0500 Subject: [PATCH] Add a heuristic value for plotinterval --- Project.toml | 2 +- src/plot/utility.jl | 5 ++++- test/runtests.jl | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 05e7991..6c7004a 100644 --- a/Project.toml +++ b/Project.toml @@ -32,4 +32,4 @@ RecipesBase = "1.1" Requires = "1.1" Unitful = "1.7" WriteVTK = "1.9" -julia = "1.6" \ No newline at end of file +julia = "1.6" diff --git a/src/plot/utility.jl b/src/plot/utility.jl index b1a79c0..fdfbce5 100644 --- a/src/plot/utility.jl +++ b/src/plot/utility.jl @@ -27,7 +27,10 @@ function getdata2d(bd::BATLData, var::AbstractString, if plotrange[4] == Inf plotrange[4] = maximum(Y) end end - # Create grid values first. + if isinf(plotinterval) + # set a heuristic value + plotinterval = (plotrange[2] - plotrange[1]) / size(X,1) + end xi = range(plotrange[1], stop=plotrange[2], step=plotinterval) yi = range(plotrange[3], stop=plotrange[4], step=plotinterval) # Perform linear interpolation of the data (x,y) on grid(xi,yi) diff --git a/test/runtests.jl b/test/runtests.jl index 438cd11..abc5faf 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -54,6 +54,7 @@ end @testset "Reading 2D unstructured binary" begin #file = "z=0_raw_1_t25.60000_n00000258.out" #bd = load(file) + #TODO test getdata2d on gencoord end @testset "Reading 3D structured binary" begin