Conversation
| from arraycontext import Array, ArrayContext, PyOpenCLArrayContext | ||
| from pyopencl.tools import ScalarArg, VectorArg as _VectorArg, dtype_to_c_struct | ||
| from pyopencl.tools import ( | ||
| ScalarArg as ScalarArg, # noqa: PLC0414 |
There was a problem hiding this comment.
Added this so that pyright doesn't complain that ScalarArg isn't exported from here.
| # separated bigger boxes ("List 4") | ||
| from_sep_bigger_starts: Array | ||
| from_sep_bigger_lists: Array | ||
| from_sep_close_bigger_starts: Array | ||
| from_sep_close_bigger_lists: Array | ||
| from_sep_close_bigger_starts: Array | None | ||
| from_sep_close_bigger_lists: Array | None |
There was a problem hiding this comment.
I don't think any of these other arrays can be None, but probably needs a closer look.
| # FIXME: not clear this is the right default? | ||
| if particle_id_dtype is None: | ||
| particle_id_dtype = np.dtype(np.int32) |
There was a problem hiding this comment.
This seems to be used below unconditionally in some VectorArg. That can't be None, so this sets it to some value.
My understanding is that this can only be None for a bare TreeOfBoxes (which doesn't have the particle_id_dtype), so not sure if this is a reasonable default? Does this even work in that case?
|
Hm.. The |
| if isinstance(field_type, GenericAlias | _BaseGenericAlias | _SpecialForm): | ||
| # NOTE: anything except a Union is not an array |
There was a problem hiding this comment.
The issue was mainly here, because ObjectArray1D[Array] is actually a _BaseGenericAlias, so this would incorrectly return False.
It now just checks for special forms, but we can't use too much of the arraycontext implementation because some of the boxtree classes have tuple[Array, ...] and Literal, which aren't supported by all_type_leaves_satisfy_predicate.
d97d417 to
e474a34
Compare
This fixes some actual errors (e.g.
from_sep_smaller_by_levelis anObjectArray1D) and adds some more types.