diff --git a/Project.toml b/Project.toml index 8a20d5cd..55758812 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "WriteVTK" uuid = "64499a7a-5c06-52f2-abe2-ccb03c286192" authors = ["Juan Ignacio Polanco "] -version = "1.18.0" +version = "1.18.1" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/write_data.jl b/src/write_data.jl index 26a30e5f..a9dfc9fb 100644 --- a/src/write_data.jl +++ b/src/write_data.jl @@ -67,6 +67,7 @@ guess_data_location(data::Tuple, args...) = guess_data_location(first(data), args...) guess_data_location(data::Tuple{}, args...) = VTKPointData() +guess_data_location(data::AbstractString, args...) = VTKFieldData() # a single string is always field data # Return the VTK string representation of a numerical data type. function datatype_str(::Type{T}) where {T <: VTKDataType} diff --git a/test/checksums.sha1 b/test/checksums.sha1 index 8e85a9f6..c0862816 100644 --- a/test/checksums.sha1 +++ b/test/checksums.sha1 @@ -20,7 +20,7 @@ d6b447652cbfdbae70a389d5d0cdc825d9ef4ce6 multiblock_4_kmax.vtu e5e396469b59d25c970ec67172f70fed82fa810d rectilinear_2D.vtr 18e7e3793ec552d60e3f689d4631d48d2f98f9c0 rectilinear_3D.vtr 9e82744afa51ece188c8819349cd206183e9216d imagedata.vti -f9915492cb2a02daa807ed8e23c754349aae8eaf imagedata_2D.vti +380430ce33fd6e4f22cd28382ff359eb07b0ea54 imagedata_2D.vti 1e79d437255388e3bb38cf997c83960f90724296 imagedata_LinRange_2D.vti d117834ade2c49f0b789287f97c63d87aedff160 imagedata_StepRangeLen_2D.vti 8e3ce81c0e22074483e6c3fdc371031c779400df imagedata_LinRange.vti diff --git a/test/imagedata.jl b/test/imagedata.jl index 54a5db82..09757cfd 100644 --- a/test/imagedata.jl +++ b/test/imagedata.jl @@ -64,6 +64,12 @@ function main() vtk["p_values"] = p[:, :, 1] vtk["myVector"] = vec[:, :, :, 1] vtk["myCellData"] = cdata[:, :, 1] + # Pass string whose length is equal to the number of points. + # The idea is to make sure it's written as field data and not point data. + n = Ni * Nj + str = String(('0' + 1):('0' + n)) + @assert length(str) == n + vtk["string"] = str end append!(outfiles, outfiles_2D)