From 21eb5ba3fa6eabc84ecbaccd4d2cc6b365c3e5d6 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Mon, 1 Jun 2026 15:17:21 -0500 Subject: [PATCH 1/2] linetaylor api update --- pytential/qbx/__init__.py | 13 +++++++++---- pytential/symbolic/matrix.py | 27 +++++++++++++++++++++------ requirements.txt | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index e628027e8..c2bf24aea 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -44,7 +44,7 @@ DefaultExpansionFactory as DefaultExpansionFactoryBase, ExpansionFactoryBase, ) -from sumpy.expansion.local import LocalExpansionBase +from sumpy.expansion.local import LineTaylorLocalExpansion, LocalExpansionBase from pytential.qbx.refinement import QBXRefinementMode, QBXRefinementNeededError from pytential.qbx.target_assoc import QBXTargetAssociationFailedError @@ -798,7 +798,6 @@ def exec_compute_potential_insn_fmm(self, @memoize_method def get_expansion_for_qbx_direct_eval(self, base_kernel, target_kernels): - from sumpy.expansion.local import LineTaylorLocalExpansion from sumpy.kernel import TargetDerivativeRemover # line Taylor cannot support target derivatives @@ -957,14 +956,20 @@ def _flat_centers(dofdesc, qbx_forced_limit): for (target_name, qbx_forced_limit), outputs in self_outputs.items(): flat_target_nodes = _flat_nodes(target_name) + flat_centers = _flat_centers(target_name, qbx_forced_limit) + lpot_kwargs = flat_kernel_args.copy() + + if isinstance(lpot_applier.expansion, LineTaylorLocalExpansion): + lpot_kwargs["expansion_vec"] = ( + actx.thaw(flat_target_nodes) - actx.thaw(flat_centers)) output_for_each_kernel = lpot_applier(actx, targets=flat_target_nodes, sources=flat_source_nodes, - centers=_flat_centers(target_name, qbx_forced_limit), + centers=flat_centers, strengths=flat_strengths, expansion_radii=_flat_expansion_radii(target_name), - **flat_kernel_args) + **lpot_kwargs) for i, o in outputs: result = output_for_each_kernel[o.target_kernel_index] diff --git a/pytential/symbolic/matrix.py b/pytential/symbolic/matrix.py index 6a84ad667..a9c57ab28 100644 --- a/pytential/symbolic/matrix.py +++ b/pytential/symbolic/matrix.py @@ -62,6 +62,7 @@ EvaluationRewriter as EvaluationRewriterBase, ) from pytools import memoize_method +from sumpy.expansion.local import LineTaylorLocalExpansion if TYPE_CHECKING: @@ -497,12 +498,19 @@ def map_int_g(self, expr): kernel_args = _get_layer_potential_args( actx, self.places, expr, context=self.context) + target_nodes = flatten(target_discr.nodes(), actx, leaf_class=DOFArray) + center_nodes = flatten(centers, actx, leaf_class=DOFArray) + mat_kwargs = kernel_args.copy() + if isinstance(local_expn, LineTaylorLocalExpansion): + mat_kwargs["expansion_vec"] = ( + actx.thaw(target_nodes) - actx.thaw(center_nodes)) + mat, = mat_gen(actx, - targets=flatten(target_discr.nodes(), actx, leaf_class=DOFArray), + targets=target_nodes, sources=flatten(source_discr.nodes(), actx, leaf_class=DOFArray), - centers=flatten(centers, actx, leaf_class=DOFArray), + centers=center_nodes, expansion_radii=flatten(radii, actx), - **kernel_args) + **mat_kwargs) mat = actx.to_numpy(mat) if self.weighted: @@ -710,14 +718,21 @@ def map_int_g(self, expr): kernel_args = _get_layer_potential_args( actx, self.places, expr, context=self.context) + target_nodes = flatten(target_discr.nodes(), actx, leaf_class=DOFArray) + center_nodes = flatten(centers, actx, leaf_class=DOFArray) + mat_kwargs = kernel_args.copy() + if isinstance(local_expn, LineTaylorLocalExpansion): + mat_kwargs["expansion_vec"] = ( + actx.thaw(target_nodes) - actx.thaw(center_nodes)) + mat, = mat_gen(actx, - targets=flatten(target_discr.nodes(), actx, leaf_class=DOFArray), + targets=target_nodes, sources=flatten(source_discr.nodes(), actx, leaf_class=DOFArray), - centers=flatten(centers, actx, leaf_class=DOFArray), + centers=center_nodes, expansion_radii=flatten(radii, actx), tgtindices=tgtindices, srcindices=srcindices, - **kernel_args) + **mat_kwargs) if self.weighted: waa = flatten( diff --git a/requirements.txt b/requirements.txt index e205325f5..daea9c5d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,5 +12,5 @@ git+https://github.com/inducer/boxtree.git#egg=boxtree git+https://github.com/inducer/arraycontext.git#egg=arraycontext git+https://github.com/inducer/gmsh_interop/#egg=gmsh_interop git+https://github.com/inducer/meshmode.git#egg=meshmode -git+https://github.com/inducer/sumpy.git#egg=sumpy +git+https://github.com/inducer/sumpy.git@refs/pull/233/head#egg=sumpy git+https://github.com/inducer/pyfmmlib.git#egg=pyfmmlib From e60b086e1025895db1fe6d7ce395da36e438f342 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Tue, 2 Jun 2026 12:30:07 -0500 Subject: [PATCH 2/2] basedpyright --- .basedpyright/baseline.json | 130 ++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 37 deletions(-) diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index fa6e5b40f..8267bd29f 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -5747,6 +5747,30 @@ "lineCount": 1 } }, + { + "code": "reportAny", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 34, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 65, + "endColumn": 77, + "lineCount": 1 + } + }, { "code": "reportAny", "range": { @@ -5767,7 +5791,7 @@ "code": "reportAny", "range": { "startColumn": 28, - "endColumn": 72, + "endColumn": 40, "lineCount": 1 } }, @@ -34461,11 +34485,43 @@ "lineCount": 1 } }, + { + "code": "reportAny", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 34, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 60, + "endColumn": 72, + "lineCount": 1 + } + }, { "code": "reportAny", "range": { "startColumn": 28, - "endColumn": 84, + "endColumn": 40, "lineCount": 1 } }, @@ -34481,7 +34537,7 @@ "code": "reportAny", "range": { "startColumn": 28, - "endColumn": 71, + "endColumn": 40, "lineCount": 1 } }, @@ -35229,11 +35285,43 @@ "lineCount": 1 } }, + { + "code": "reportAny", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 34, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportAny", + "range": { + "startColumn": 60, + "endColumn": 72, + "lineCount": 1 + } + }, { "code": "reportAny", "range": { "startColumn": 28, - "endColumn": 84, + "endColumn": 40, "lineCount": 1 } }, @@ -35249,7 +35337,7 @@ "code": "reportAny", "range": { "startColumn": 28, - "endColumn": 71, + "endColumn": 40, "lineCount": 1 } }, @@ -44517,38 +44605,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 12, - "endColumn": 18, - "lineCount": 1 - } - }, - { - "code": "reportOptionalSubscript", - "range": { - "startColumn": 21, - "endColumn": 48, - "lineCount": 1 - } - }, - { - "code": "reportUnknownMemberType", - "range": { - "startColumn": 49, - "endColumn": 70, - "lineCount": 1 - } - }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 49, - "endColumn": 55, - "lineCount": 1 - } - }, { "code": "reportUnknownMemberType", "range": {