Skip to content

Commit 1fb408f

Browse files
committed
propogate name_tree
1 parent 290f0fb commit 1fb408f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/MatrixFields/field_name_dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ function get_scalar_keys(dict::FieldMatrix)
438438
)
439439
end
440440
end
441-
return FieldMatrixKeys(keys_tuple)
441+
return FieldMatrixKeys(keys_tuple, dict.keys.name_tree)
442442
end
443443

444444
"""

test/MatrixFields/scalar_fieldmatrix.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ end
105105

106106
@testset "fieldmatrix to scalar fieldmatrix unit tests" begin
107107
FT = Float64
108-
for (A, _) in (
108+
for (A, b) in (
109109
dycore_prognostic_EDMF_FieldMatrix(FT),
110110
scaling_only_dycore_prognostic_EDMF_FieldMatrix(FT),
111111
)
@@ -130,6 +130,11 @@ end
130130
scalar_fieldmatrix_wrapper(A)
131131
@test (@allocated scalar_fieldmatrix_wrapper(A)) == 0
132132
@test_opt MatrixFields.scalar_fieldmatrix(A)
133+
134+
A_with_tree =
135+
MatrixFields.replace_name_tree(A, MatrixFields.FieldNameTree(b))
136+
@test MatrixFields.scalar_fieldmatrix(A_with_tree).keys.name_tree ==
137+
A_with_tree.keys.name_tree
133138
end
134139
end
135140

0 commit comments

Comments
 (0)