From 31e174350165cdd0457966b86e9f764b2657258f Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Tue, 28 Nov 2023 09:15:36 -0600 Subject: [PATCH 1/3] minor --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 89ae6440..32adb026 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ ConstructionBase = "1" FillArrays = "0.13, 1" HDF5 = "0.16, 0.17" Kronecker = "0.5" -NodesAndModes = "0.9" +NodesAndModes = "0.9, 1" PathIntersections = "0.1" RecipesBase = "1" RecursiveArrayTools = "2" From 8f34bca18f4d1c780e7dd76402563d5226427e5b Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Thu, 30 Nov 2023 08:04:55 -0600 Subject: [PATCH 2/3] minor cleanup --- src/named_array_partition.jl | 17 +---------------- test/named_array_partition_tests.jl | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/named_array_partition.jl b/src/named_array_partition.jl index 24c3547e..32e4d947 100644 --- a/src/named_array_partition.jl +++ b/src/named_array_partition.jl @@ -39,7 +39,7 @@ Base.propertynames(x::NamedArrayPartition) = propertynames(getfield(x, :names_to Base.getproperty(x::NamedArrayPartition, s::Symbol) = getindex(ArrayPartition(x).x, getproperty(getfield(x, :names_to_indices), s)) -# !!! this won't work if `v` isn't the same size as +# this enables x.s = some_array. @inline function Base.setproperty!(x::NamedArrayPartition, s::Symbol, v) index = getproperty(getfield(x, :names_to_indices), s) ArrayPartition(x).x[index] .= v @@ -62,21 +62,6 @@ Base.mapreduce(f, op, x::NamedArrayPartition) = mapreduce(f, op, ArrayPartition( Base.similar(x::NamedArrayPartition{T, S, NT}) where {T, S, NT} = NamedArrayPartition{T, S, NT}(similar(ArrayPartition(x)), getfield(x, :names_to_indices)) -# # return NamedArrayPartition when possible, otherwise next best thing of the correct size -# function Base.similar(x::ArrayPartition, dims::NTuple{N,Int}) where {N} -# if dims == size(x) -# return similar(x) -# else -# return similar(ArrayPartition(x).x[1], eltype(x), dims) -# end -# end - -# # similar array partition of common type -# @inline function Base.similar(A::ArrayPartition, ::Type{T}) where {T} -# N = npartitions(A) -# ArrayPartition(i->similar(A.x[i], T), N) -# end - # broadcasting Base.BroadcastStyle(::Type{<:NamedArrayPartition}) = Broadcast.ArrayStyle{NamedArrayPartition}() function Base.similar(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{NamedArrayPartition}}, diff --git a/test/named_array_partition_tests.jl b/test/named_array_partition_tests.jl index 57165f24..79f3fe85 100644 --- a/test/named_array_partition_tests.jl +++ b/test/named_array_partition_tests.jl @@ -19,7 +19,7 @@ @test (@capture_out Base.show(stdout, MIME"text/plain"(), x)) == "(a = [1.0], b = [2.0])" using StructArrays - using StartUpDG: SVector + using StaticArrays: SVector x = NamedArrayPartition(a = StructArray{SVector{2, Float64}}((ones(5), 2*ones(5))), b = StructArray{SVector{2, Float64}}((3 * ones(2,2), 4*ones(2,2)))) @test typeof(x.a) <: StructVector{<:SVector{2}} From 1c0cfe766d95ab94ded43e1cdef19689da6ac73f Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Thu, 30 Nov 2023 08:05:16 -0600 Subject: [PATCH 3/3] revert previous compat bump, keep NodesAndModes compat at .9 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 32adb026..89ae6440 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ ConstructionBase = "1" FillArrays = "0.13, 1" HDF5 = "0.16, 0.17" Kronecker = "0.5" -NodesAndModes = "0.9, 1" +NodesAndModes = "0.9" PathIntersections = "0.1" RecipesBase = "1" RecursiveArrayTools = "2"