diff --git a/src/general/buffer.jl b/src/general/buffer.jl index b12cf05f3..aae5ccb5c 100644 --- a/src/general/buffer.jl +++ b/src/general/buffer.jl @@ -1,10 +1,11 @@ struct SystemBuffer{V} - active_particle :: BitVector + active_particle :: Vector{Bool} eachparticle :: V # Vector{Int} buffer_size :: Int function SystemBuffer(active_size, buffer_size::Integer) - active_particle = vcat(trues(active_size), falses(buffer_size)) + # We cannot use a `BitVector` here, as writing to a `BitVector` is not thread-safe + active_particle = vcat(fill(true, active_size), fill(false, buffer_size)) eachparticle = collect(1:active_size) return new{typeof(eachparticle)}(active_particle, eachparticle, buffer_size) diff --git a/src/preprocessing/geometries/triangle_mesh.jl b/src/preprocessing/geometries/triangle_mesh.jl index e8cc993af..60d850e81 100644 --- a/src/preprocessing/geometries/triangle_mesh.jl +++ b/src/preprocessing/geometries/triangle_mesh.jl @@ -194,7 +194,8 @@ function unique_sorted(vertices) # Sort by the first entry of the vectors compare_first_element = (x, y) -> x[1] < y[1] vertices_sorted = sort!(vertices, lt=compare_first_element) - keep = trues(length(vertices_sorted)) + # We cannot use a `BitVector` here, as writing to a `BitVector` is not thread-safe + keep = fill(true, length(vertices_sorted)) PointNeighbors.@threaded vertices_sorted for i in eachindex(vertices_sorted) # We only sorted by the first entry, so we have to check all previous vertices diff --git a/src/schemes/boundary/open_boundary/boundary_zones.jl b/src/schemes/boundary/open_boundary/boundary_zones.jl index 586d565b1..d8ec0a051 100644 --- a/src/schemes/boundary/open_boundary/boundary_zones.jl +++ b/src/schemes/boundary/open_boundary/boundary_zones.jl @@ -326,7 +326,7 @@ end function remove_outside_particles(initial_condition, spanning_set, zone_origin) (; coordinates, density, particle_spacing) = initial_condition - in_zone = trues(nparticles(initial_condition)) + in_zone = fill(true, nparticles(initial_condition)) for particle in eachparticle(initial_condition) current_position = current_coords(coordinates, initial_condition, particle)