Skip to content

Commit 74e48e1

Browse files
Add temporary assertion messages
1 parent 5696a7a commit 74e48e1

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/DataLayouts/DataLayouts.jl

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function IJFH{S, Nij, Nh}(array::AbstractArray{T, 4}) where {S, Nij, Nh, T}
321321
@assert size(array, 1) == Nij
322322
@assert size(array, 2) == Nij
323323
@assert size(array, 3) == typesize(T, S)
324-
@assert size(array, 4) == Nh
324+
@assert size(array, 4) == Nh "Nh is $Nh and array size is $(size(array))"
325325
IJFH{S, Nij, Nh, typeof(array)}(array)
326326
end
327327

@@ -340,10 +340,6 @@ function IJFH{S, Nij, Nh}(::Type{ArrayType}) where {S, Nij, Nh, ArrayType}
340340
IJFH{S, Nij, Nh}(ArrayType(undef, Nij, Nij, typesize(T, S), Nh))
341341
end
342342

343-
# # TODO: deprecate
344-
# IJFH{S, Nij}(::Type{ArrayType}, Nh) where {S, Nij, ArrayType} =
345-
# IJFH{S, Nij, Nh}(ArrayType)
346-
347343
function replace_basetype(
348344
data::IJFH{S, Nij, Nh},
349345
::Type{T},
@@ -439,10 +435,11 @@ end
439435

440436
function gather(
441437
ctx::ClimaComms.AbstractCommsContext,
442-
data::IJFH{S, Nij, Nh},
443-
) where {S, Nij, Nh}
438+
data::IJFH{S, Nij},
439+
) where {S, Nij}
444440
gatherdata = ClimaComms.gather(ctx, parent(data))
445441
if ClimaComms.iamroot(ctx)
442+
Nh = size(gatherdata, 4)
446443
IJFH{S, Nij, Nh}(gatherdata)
447444
else
448445
nothing
@@ -456,8 +453,8 @@ end
456453
Base.length(data::Data1D) = size(parent(data), 3)
457454

458455
"""
459-
IFH{S, Ni, A} <: Data1D{S, Ni}
460-
IFH{S,Ni}(ArrayType, nelements)
456+
IFH{S,Ni,Nh,A} <: Data1D{S, Ni}
457+
IFH{S,Ni,Nh}(ArrayType)
461458
462459
Backing `DataLayout` for 1D spectral element slabs.
463460
@@ -468,7 +465,7 @@ datatype `S` struct field (F), for each 1D mesh element (H).
468465
The `ArrayType`-constructor makes a IFH 1D Spectral
469466
DataLayout given the backing `ArrayType`, quadrature
470467
degrees of freedom `Ni`, and the number of mesh elements
471-
`nelements`.
468+
`Nh`.
472469
"""
473470
struct IFH{S, Ni, Nh, A} <: Data1D{S, Ni}
474471
array::A
@@ -495,10 +492,6 @@ function IFH{S, Ni, Nh}(::Type{ArrayType}) where {S, Ni, Nh, ArrayType}
495492
IFH{S, Ni, Nh}(ArrayType(undef, Ni, typesize(T, S), Nh))
496493
end
497494

498-
# # TODO: deprecate
499-
# IFH{S, Ni}(::Type{ArrayType}, Nh) where {S, Ni, ArrayType} =
500-
# IFH{S, Ni, Nh}(ArrayType)
501-
502495
rebuild(data::IFH{S, Ni, Nh}, array::AbstractArray{T, 3}) where {S, Ni, Nh, T} =
503496
IFH{S, Ni, Nh}(array)
504497

@@ -1076,7 +1069,7 @@ function VIJFH{S, Nv, Nij, Nh}(
10761069
check_basetype(T, S)
10771070
@assert size(array, 2) == size(array, 3) == Nij
10781071
@assert size(array, 4) == typesize(T, S)
1079-
@assert size(array, 5) == Nh
1072+
@assert size(array, 5) == Nh "Nh is $Nh and array size is $(size(array))"
10801073
VIJFH{S, Nv, Nij, Nh, typeof(array)}(array)
10811074
end
10821075

@@ -1198,10 +1191,11 @@ end
11981191

11991192
function gather(
12001193
ctx::ClimaComms.AbstractCommsContext,
1201-
data::VIJFH{S, Nv, Nij, Nh},
1202-
) where {S, Nv, Nij, Nh}
1194+
data::VIJFH{S, Nv, Nij},
1195+
) where {S, Nv, Nij}
12031196
gatherdata = ClimaComms.gather(ctx, parent(data))
12041197
if ClimaComms.iamroot(ctx)
1198+
Nh = size(gatherdata, 5)
12051199
VIJFH{S, Nv, Nij, Nh}(gatherdata)
12061200
else
12071201
nothing

0 commit comments

Comments
 (0)