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

Check dipoles are available before using it #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions boxtree/pyfmmlib_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,17 @@ def fmm_level_to_order(tree, level): # pylint:disable=function-redefined
# It's not super bad because the dipole vectors are typically geometry
# normals and thus change about at the same time as the tree... but there's
# still no reason for them to be here.
self.use_dipoles = dipole_vec is not None
if self.use_dipoles:
assert dipole_vec.shape == (self.dim, self.tree.nsources)
if not hasattr(self, "use_dipoles"):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment on how we could possibly get here with use_dipoles already set.

self.use_dipoles = dipole_vec is not None
if self.use_dipoles:
assert dipole_vec.shape == (self.dim, self.tree.nsources)

if not dipoles_already_reordered:
dipole_vec = self.reorder_sources(dipole_vec)
if not dipoles_already_reordered:
dipole_vec = self.reorder_sources(dipole_vec)

self.dipole_vec = dipole_vec.copy(order="F")
else:
self.dipole_vec = None
self.dipole_vec = dipole_vec.copy(order="F")
else:
self.dipole_vec = None

# }}}

Expand Down