Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rymanderson committed Nov 2, 2024
2 parents ebce836 + 0f0b7ef commit a88eb5e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
docs:
Expand All @@ -52,7 +52,7 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
Expand Down
22 changes: 11 additions & 11 deletions src/fmm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ function body_to_multipole_multithread!(branches, system, expansion_order::Val{P
leaf_assignments = fill(1:0, n_threads)

# total number of bodies
n_bodies = 0
for i_leaf in leaf_index
n_bodies += length(branches[i_leaf].bodies_index)
end
n_bodies = get_n_bodies(system)

# number of bodies per thread
n_per_thread, rem = divrem(n_bodies, n_threads)
Expand All @@ -288,7 +285,7 @@ function body_to_multipole_multithread!(branches, system, expansion_order::Val{P
i_thread = 1
n_bodies = 0
for (i_end,i_leaf) in enumerate(leaf_index)
n_bodies += length(branches[i_leaf].bodies_index)
n_bodies += get_n_bodies(branches[i_leaf])
if n_bodies >= n_per_thread
leaf_assignments[i_thread] = i_start:i_end
i_start = i_end+1
Expand Down Expand Up @@ -342,7 +339,6 @@ function translate_multipoles_multithread!(branches::Vector{<:Branch{TF}}, expan
child_branch = branches[i_branch]
parent_branch = branches[child_branch.i_parent]
Threads.lock(parent_branch.lock) do
# multipole_to_multipole!(parent_branch, child_branch, child_branch.harmonics, child_branch.ML, expansion_order)
multipole_to_multipole!(parent_branch, child_branch, weights_tmp_1[i_task], weights_tmp_2[i_task], Ts[i_task], eimϕs[i_task], ζs_mag, Hs_π2, expansion_order, lamb_helmholtz)
end
end
Expand Down Expand Up @@ -466,13 +462,16 @@ function translate_locals_multithread!(branches::Vector{<:Branch{TF}}, expansion
n_per_thread < MIN_NPT_L2L && (n_per_thread = MIN_NPT_L2L)

# loop over branches
Threads.@threads for i_start in 1:n_per_thread:length(level_index)
i_starts = 1:n_per_thread:length(level_index)
#Threads.@threads for (i_task,i_start) in enumerate(1:n_per_thread:length(level_index))
Threads.@threads for i_task in 1:length(i_starts)
i_start = i_starts[i_task]
i_stop = min(i_start+n_per_thread-1,length(level_index))

# loop over branches
for i_child in level_index[i_start]:level_index[i_stop]
child_branch = branches[i_child]
local_to_local!(child_branch, branches[child_branch.i_parent], weights_tmp_1, weights_tmp_2, Ts, eimϕs, ηs_mag, Hs_π2, expansion_order, lamb_helmholtz)
local_to_local!(child_branch, branches[child_branch.i_parent], weights_tmp_1[i_task], weights_tmp_2[i_task], Ts[i_task], eimϕs[i_task], ηs_mag, Hs_π2, expansion_order, lamb_helmholtz)
end
end
end
Expand Down Expand Up @@ -912,13 +911,14 @@ function fmm!(target_tree::Tree, target_systems, source_tree::Tree, source_syste
nearfield_user::Bool=false
) where PE

# repack in Val
lamb_helmholtz = Val(lamb_helmholtz)

# check if systems are empty
n_sources = get_n_bodies(source_systems)
n_targets = get_n_bodies(target_systems)

# wrap lamb_helmholtz in Val
lamb_helmholtz = Val(lamb_helmholtz)


if n_sources > 0 && n_targets > 0

# precompute y-axis rotation by π/2 matrices (if not already done)
Expand Down
9 changes: 6 additions & 3 deletions src/tree.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# const BRANCH_TYPE = Float64
# global SHRINKING_OFFSET = .000001

const WARNING_FLAG_LEAF_SIZE = Array{Bool,0}(undef)
WARNING_FLAG_LEAF_SIZE[] = true

Expand Down Expand Up @@ -961,6 +958,12 @@ function initialize_expansion(expansion_order, type=Float64)
return zeros(type, 2, 2, ((expansion_order+1) * (expansion_order+2)) >> 1)
end

function initialize_velocity_n_m(expansion_order, type=Float64)
p = expansion_order
n_harmonics = harmonic_index(p,p)
return zeros(type, 2, 3, n_harmonics)
end

function initialize_harmonics(expansion_order, type=Float64)
p = expansion_order
n_harmonics = harmonic_index(p,p)
Expand Down

0 comments on commit a88eb5e

Please sign in to comment.