Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AbstractOperations with MakieExtension #3823

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion ext/OceananigansMakieExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module OceananigansMakieExt

using Oceananigans
using Oceananigans.AbstractOperations: AbstractOperation
using Oceananigans.Architectures: on_architecture
using Oceananigans.ImmersedBoundaries: mask_immersed_field!

Expand All @@ -27,9 +28,33 @@ function _create_plot(F::Function, attributes::Dict, f::Field)
return _create_plot(F, attributes, converted_args...)
end

function _create_plot(F::Function, attributes::Dict, op::AbstractOperation)
f = Field(op)
compute!(f)
return _create_plot(F::Function, attributes::Dict, f)
end

convert_arguments(pl::Type{<:AbstractPlot}, f::Field) =
convert_arguments(pl, convert_field_argument(f)...)

function convert_arguments(pl::Type{<:AbstractPlot}, fop::AbstractOperation)
f = Field(op)
compute!(f)
return convert_arguments(pl, f)
end

function convert_arguments(pl::Type{<:AbstractPlot}, ξ1::AbstractArray, op::AbstractOperation)
f = Field(op)
compute!(f)
return convert_arguments(pl, ξ1, f)
end

function convert_arguments(pl::Type{<:AbstractPlot}, ξ1::AbstractArray, ξ2::AbstractArray, op::AbstractOperation)
f = Field(op)
compute!(f)
return convert_arguments(pl, ξ1, ξ2, f)
end

"""
make_plottable_array(f)

Expand All @@ -41,7 +66,7 @@ grids) with NaNs;
- transferring data from GPU to CPU if necessary.
"""
function make_plottable_array(f)

compute!(f)
navidcy marked this conversation as resolved.
Show resolved Hide resolved
mask_immersed_field!(f, NaN)

Nx, Ny, Nz = size(f)
Expand Down