Skip to content
Merged
Show file tree
Hide file tree
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
124 changes: 66 additions & 58 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1886,32 +1886,40 @@
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 12,
"startColumn": 4,
"endColumn": 22,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownVariableType",
"range": {
"startColumn": 8,
"endColumn": 33,
"startColumn": 4,
"endColumn": 22,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 61,
"endColumn": 65,
"startColumn": 35,
"endColumn": 39,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 67,
"endColumn": 71,
"startColumn": 41,
"endColumn": 45,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 51,
"endColumn": 55,
"lineCount": 1
}
},
Expand Down Expand Up @@ -8037,43 +8045,35 @@
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 16,
"endColumn": 19,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 32,
"endColumn": 43,
"startColumn": 20,
"endColumn": 23,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 16,
"endColumn": 28,
"startColumn": 20,
"endColumn": 23,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"code": "reportUnknownVariableType",
"range": {
"startColumn": 33,
"endColumn": 36,
"startColumn": 20,
"endColumn": 23,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 51,
"endColumn": 56,
"startColumn": 36,
"endColumn": 47,
"lineCount": 1
}
},
Expand Down Expand Up @@ -8560,56 +8560,48 @@
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 20,
"endColumn": 28,
"startColumn": 16,
"endColumn": 27,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 32,
"endColumn": 46,
"startColumn": 31,
"endColumn": 72,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 32,
"endColumn": 58,
"startColumn": 40,
"endColumn": 63,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownVariableType",
"range": {
"startColumn": 20,
"endColumn": 38,
"startColumn": 24,
"endColumn": 32,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 39,
"endColumn": 80,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 39,
"endColumn": 82,
"startColumn": 36,
"endColumn": 50,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 48,
"endColumn": 71,
"startColumn": 36,
"endColumn": 62,
"lineCount": 1
}
},
Expand Down Expand Up @@ -10301,6 +10293,14 @@
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 27,
"endColumn": 31,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
Expand Down Expand Up @@ -11680,8 +11680,8 @@
{
"code": "reportMissingTypeStubs",
"range": {
"startColumn": 15,
"endColumn": 41,
"startColumn": 13,
"endColumn": 33,
"lineCount": 1
}
},
Expand Down Expand Up @@ -17967,6 +17967,14 @@
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
"startColumn": 33,
"endColumn": 41,
"lineCount": 1
}
},
{
"code": "reportUnknownVariableType",
"range": {
Expand Down Expand Up @@ -25680,24 +25688,24 @@
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 30,
"endColumn": 43,
"startColumn": 12,
"endColumn": 27,
"lineCount": 1
}
},
{
"code": "reportUnknownArgumentType",
"code": "reportUnknownMemberType",
"range": {
"startColumn": 30,
"endColumn": 46,
"startColumn": 34,
"endColumn": 47,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"code": "reportUnknownArgumentType",
"range": {
"startColumn": 16,
"endColumn": 31,
"startColumn": 34,
"endColumn": 50,
"lineCount": 1
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/from_firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main(visualize=True):
ax2.set_title("cos(x+y) in\nFiredrakeConnection 'on_boundary'")
bdy_vis.show_scalar_in_matplotlib_3d(bdy_field, do_show=False)

import matplotlib.cm as cm
from matplotlib import cm
fig.colorbar(cm.ScalarMappable(), ax=ax2)
plt.show()

Expand Down
3 changes: 1 addition & 2 deletions examples/moving-geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
import numpy as np

import pyopencl as cl
import pytools.obj_array as obj_array
from arraycontext import Array, ArrayContext
from pytools import keyed_memoize_in
from pytools import keyed_memoize_in, obj_array

from meshmode.array_context import PyOpenCLArrayContext
from meshmode.discretization import (
Expand Down
2 changes: 1 addition & 1 deletion examples/parallel-vtkhdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from meshmode.mesh import Mesh


logger = logging.getLogger(__file__)
logger = logging.getLogger(__name__)


def make_example_mesh(ambient_dim: int, nelements: int, order: int) -> Mesh:
Expand Down
7 changes: 2 additions & 5 deletions examples/simple-dg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@

import pyopencl as cl
import pyopencl.array as cla # noqa
import pytools.obj_array as obj_array
from arraycontext import (
ArrayContainer,
ArrayContext,
dataclass_array_container,
map_array_container,
with_container_arithmetic,
)
from pytools import log_process, memoize_method
from pytools import log_process, memoize_method, obj_array
from pytools.obj_array import ObjectArray1D, ObjectArray2D

from meshmode.array_context import PyOpenCLArrayContext, PytatoPyOpenCLArrayContext
Expand Down Expand Up @@ -156,9 +155,7 @@ def get_connection(self, src, tgt):
return self.all_faces_connection()
elif src_tgt == ("vol", BTAG_ALL):
return self.boundary_connection(tgt)
elif src_tgt == ("int_faces", "all_faces"):
return self.get_to_all_face_embedding(src)
elif src_tgt == (BTAG_ALL, "all_faces"):
elif src_tgt in (("int_faces", "all_faces"), (BTAG_ALL, "all_faces")):
return self.get_to_all_face_embedding(src)
else:
raise ValueError(f"locations '{src}'->'{tgt}' not understood")
Expand Down
4 changes: 1 addition & 3 deletions meshmode/array_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,10 @@ def untag_loopy_call_results(
else:
return expr

dag = pt.transform.map_and_copy(dag, untag_loopy_call_results)
return pt.transform.map_and_copy(dag, untag_loopy_call_results)

# }}}

return dag

@override
def transform_loopy_program(self, t_unit: TranslationUnit):
# FIXME: Do not parallelize for now.
Expand Down
3 changes: 1 addition & 2 deletions meshmode/discretization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@

import loopy as lp
import modepy as mp
import pytools.obj_array as obj_array
from arraycontext import Array, ArrayContext, make_loopy_program, tag_axes
from pytools import keyed_memoize_in, memoize_in, memoize_method
from pytools import keyed_memoize_in, memoize_in, memoize_method, obj_array

# underscored because it shouldn't be imported from here.
from meshmode.dof_array import DOFArray as _DOFArray
Expand Down
5 changes: 2 additions & 3 deletions meshmode/discretization/connection/chained.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ def flatten_chained_connection(actx, connection):

# recursively build direct connections
connections = connection.connections
direct_connections = []
for conn in connections:
direct_connections.append(flatten_chained_connection(actx, conn))
direct_connections = [
flatten_chained_connection(actx, conn) for conn in connections]

direct_connections = [conn for conn in direct_connections
if not isinstance(conn, IdentityDiscretizationConnection)]
Expand Down
11 changes: 5 additions & 6 deletions meshmode/discretization/connection/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def __new__(cls, connections, is_surjective=False):

return cls(connections.connections, is_surjective=is_surjective)
else:
conns = []
for cnx in reversed(connections):
conns.append(cls(cnx, is_surjective=is_surjective))
conns = [
cls(cnx, is_surjective=is_surjective)
for cnx in reversed(connections)]

return ChainedDiscretizationConnection(conns)

Expand Down Expand Up @@ -217,9 +217,8 @@ def kproj():
sgrp = self.from_discr.groups[batch.from_group_index]

# Generate the basis tabulation matrix
tabulations = []
for basis_fn in sgrp.basis_obj().functions:
tabulations.append(basis_fn(batch.result_unit_nodes).flatten())
tabulations = [basis_fn(batch.result_unit_nodes).flatten()
for basis_fn in sgrp.basis_obj().functions]
tabulations = actx.from_numpy(np.asarray(tabulations))

# NOTE: batch.*_element_indices are reversed here because
Expand Down
Loading
Loading