Skip to content

Commit

Permalink
Try using allow_mismatched_diagonalized_spaces to make swap_spaces no…
Browse files Browse the repository at this point in the history
…t allocating
  • Loading branch information
valeriabarra committed Feb 6, 2023
1 parent dc397fc commit 8cc5767
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ modules in the coupler.
"""
module Utilities

using ClimaCore: Fields, Spaces
using ClimaCore: Spaces
import ClimaCore.Fields

export CoupledSimulation, float_type, swap_space!

Expand Down Expand Up @@ -70,8 +71,10 @@ Remap the values of a field onto a new space.
- `new_space`: [Spaces.Space] to remap `field` to.
"""
function swap_space!(field::Fields.Field, new_space)
Fields.allow_mismatched_diagonalized_spaces() = true
field_out = zeros(new_space)
parent(field_out) .= parent(field)
field_out .= field
Fields.allow_mismatched_diagonalized_spaces() = false
return field_out
end

Expand Down

0 comments on commit 8cc5767

Please sign in to comment.