From 8c48bfe043f10159a17ae697870b9066cc586cc9 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Thu, 19 Sep 2024 17:33:41 -0400 Subject: [PATCH 1/4] add show method for gridmask --- src/Types.jl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Types.jl b/src/Types.jl index 9919f50..5e239b3 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -252,5 +252,17 @@ Base.@kwdef struct gridmask tmp3d::MeshArray end - +function Base.show(io::IO, z::gridmask) + printstyled(io, " gridmask \n",color=:normal) + printstyled(io, " map = ",color=:normal) + printstyled(io, "$(typeof(z.map))\n",color=:blue) + printstyled(io, " depths = ",color=:normal) + printstyled(io, "$(typeof(z.depths))\n",color=:blue) + printstyled(io, " names = ",color=:normal) + printstyled(io, "$(z.names[1] )\n",color=:cyan) + for iFace=2:length(z.names) + printstyled(io, " $(z.names[iFace])\n",color=:cyan) + end +return +end From cc78d03e088580345eae0850a8e5f5dd5c54141f Mon Sep 17 00:00:00 2001 From: gaelforget Date: Thu, 19 Sep 2024 18:08:05 -0400 Subject: [PATCH 2/4] add show,display methods --- src/Types.jl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Types.jl b/src/Types.jl index 5e239b3..f7685d7 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -52,6 +52,21 @@ copy_if_isarray(x) = isa(x,Array) ? copy(x) : x Base.similar(g::gcmgrid)=gcmgrid(g.path, g.class, g.nFaces, copy(g.fSize), copy_if_isarray(g.ioSize), g.ioPrec, g.read, g.write) +function Base.show(io::IO, z::gcmgrid) + printstyled(io, " gcmgrid \n",color=:normal) + printstyled(io, " class = ",color=:normal) + printstyled(io, "$(z.class)\n",color=:magenta) + printstyled(io, " path = ",color=:normal) + printstyled(io, "$(z.path)\n",color=:magenta) + printstyled(io, " fSize = ",color=:normal) + printstyled(io, "$(z.fSize)\n",color=:magenta) + printstyled(io, " ioSize = ",color=:normal) + printstyled(io, "$(z.ioSize)\n",color=:magenta) + printstyled(io, " ioPrec = ",color=:normal) + printstyled(io, "$(z.ioPrec)\n",color=:magenta) + return +end + """ varmeta @@ -263,6 +278,6 @@ function Base.show(io::IO, z::gridmask) for iFace=2:length(z.names) printstyled(io, " $(z.names[iFace])\n",color=:cyan) end -return + return end From 8e8f55dc6b7ad944c0a6925df83f685d08420845 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Thu, 19 Sep 2024 18:08:24 -0400 Subject: [PATCH 3/4] add show,display methods --- src/Type_gcmarray.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Type_gcmarray.jl b/src/Type_gcmarray.jl index 857fcb0..8eca75a 100644 --- a/src/Type_gcmarray.jl +++ b/src/Type_gcmarray.jl @@ -239,6 +239,8 @@ function Base.show(io::IO, z::gcmarray{T, N, Array{T,2}}) where {T,N} return end +import Base: display; display(X::gcmarray)=show(X) + function Base.similar(A::gcmarray;m::varmeta=defaultmeta) if ndims(A)==1 B=gcmarray(similar(A.grid),eltype(A),copy(A.fSize),copy(A.fIndex); meta=m) From cfdd8ca24a8d2b166b296f3d2ef7aa8e8e749f7a Mon Sep 17 00:00:00 2001 From: gaelforget Date: Thu, 19 Sep 2024 18:09:55 -0400 Subject: [PATCH 4/4] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 926a140..6cd266e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MeshArrays" uuid = "cb8c808f-1acf-59a3-9d2b-6e38d009f683" authors = ["gaelforget "] -version = "0.3.13" +version = "0.3.14" [deps] CatViews = "81a5f4ea-a946-549a-aa7e-2a7f63a27d31"