Skip to content

Commit

Permalink
first_wall() allocates if none
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Dec 30, 2023
1 parent 337921e commit 52986ef
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/physics/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,16 @@ end
"""
first_wall(wall::IMAS.wall)
return outline of first wall or an empty outline if not present
returns outline of first wall
"""
function first_wall(wall::IMAS.wall{T})::wall__description_2d___limiter__unit___outline{T} where {T<:Real}
if (!ismissing(wall.description_2d, ["1", "limiter", "unit", "1", "outline", "r"])) && (length(wall.description_2d[1].limiter.unit[1].outline.r) > 4)
return wall.description_2d[1].limiter.unit[1].outline
else
fw = IMAS.wall__description_2d___limiter__unit___outline{T}()
fw.r = Float64[]
fw.z = Float64[]
return fw
if ismissing(wall.description_2d, ["1", "limiter", "unit", "1", "outline", "r"])
resize!(wall.description_2d, 1)
resize!(wall.description_2d[1].limiter.unit, 1)
wall.description_2d[1].limiter.unit[1].outline.r = Float64[]
wall.description_2d[1].limiter.unit[1].outline.z = Float64[]
end
return wall.description_2d[1].limiter.unit[1].outline
end

"""
Expand Down

0 comments on commit 52986ef

Please sign in to comment.