Skip to content

Commit 11818b2

Browse files
committed
Revert "first_wall() allocates if none"
This reverts commit 52986ef.
1 parent 52986ef commit 11818b2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/physics/build.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,17 @@ end
294294
"""
295295
first_wall(wall::IMAS.wall)
296296
297-
returns outline of first wall
297+
return outline of first wall or an empty outline if not present
298298
"""
299299
function first_wall(wall::IMAS.wall{T})::wall__description_2d___limiter__unit___outline{T} where {T<:Real}
300-
if ismissing(wall.description_2d, ["1", "limiter", "unit", "1", "outline", "r"])
301-
resize!(wall.description_2d, 1)
302-
resize!(wall.description_2d[1].limiter.unit, 1)
303-
wall.description_2d[1].limiter.unit[1].outline.r = Float64[]
304-
wall.description_2d[1].limiter.unit[1].outline.z = Float64[]
300+
if (!ismissing(wall.description_2d, ["1", "limiter", "unit", "1", "outline", "r"])) && (length(wall.description_2d[1].limiter.unit[1].outline.r) > 4)
301+
return wall.description_2d[1].limiter.unit[1].outline
302+
else
303+
fw = IMAS.wall__description_2d___limiter__unit___outline{T}()
304+
fw.r = Float64[]
305+
fw.z = Float64[]
306+
return fw
305307
end
306-
return wall.description_2d[1].limiter.unit[1].outline
307308
end
308309

309310
"""

0 commit comments

Comments
 (0)