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

Make Simulation mutable and loc(T=Float32) #149

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/WaterLily.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Constructor for a WaterLily.jl simulation:

See files in `examples` folder for examples.
"""
struct Simulation
mutable struct Simulation
U :: Number # velocity scale
L :: Number # length scale
ϵ :: Number # kernel width
Expand Down
2 changes: 1 addition & 1 deletion src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ using StaticArrays
Location in space of the cell at CartesianIndex `I` at face `i`.
Using `i=0` returns the cell center s.t. `loc = I`.
"""
@inline loc(i,I::CartesianIndex{N}) where N = SVector{N}(I.I .- 1.5 .- 0.5 .* δ(i,I).I)
@inline loc(i,I::CartesianIndex{N},T=Float32) where N = SVector{N,T}(I.I .- 1.5 .- 0.5 .* δ(i,I).I)
@inline loc(Ii::CartesianIndex) = loc(last(Ii),Base.front(Ii))
Base.last(I::CartesianIndex) = last(I.I)
Base.front(I::CartesianIndex) = CI(Base.front(I.I))
Expand Down
2 changes: 1 addition & 1 deletion test/maintests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ end
end
import WaterLily: ×
@testset "Metrics.jl" begin
J = CartesianIndex(2,3,4); x = loc(0,J); px = prod(x)
J = CartesianIndex(2,3,4); x = loc(0,J,Float64); px = prod(x)
for f ∈ arrays
u = zeros(3,4,5,3) |> f; apply!((i,x)->x[i]+prod(x),u)
p = zeros(3,4,5) |> f
Expand Down
Loading