Skip to content

Commit

Permalink
ci: add typos and fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Sep 5, 2024
1 parent a449133 commit 75c8fa8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 18 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ on:
- cron: '17 3 * * 0'

jobs:
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master

ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
- name: "Main Script"
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Features:

Meshmode emerged as the shared discretization layer for `pytential
<https://github.com/inducer/pytential/>`__ (layer potentials) and `grudge
<https://github.com/inducer/grudge>`__ (discontinous Galerkin).
<https://github.com/inducer/grudge>`__ (discontinuous Galerkin).

Places on the web related to meshmode:

Expand Down
4 changes: 2 additions & 2 deletions examples/to_firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def main():
discr = Discretization(actx, mesh, group_factory)

# Get our solution: we will use
# Real(e^z) = Real(e^{x+iy})
# = e^x Real(e^{iy})
# Real(e^z) = Real(e^{x+i y})
# = e^x Real(e^{i y})
# = e^x cos(y)
nodes = discr.nodes()
for i in range(len(nodes)):
Expand Down
6 changes: 3 additions & 3 deletions meshmode/discretization/connection/chained.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def find_batch(nodes, gtb):
return (-1, -1)

nfrom_groups = len(from_conn.groups)
nto_groups = len(to_conn.groups)
n_to_groups = len(to_conn.groups)

# construct a table from (old groups) -> (new groups)
# NOTE: we try to reduce the number of new groups and batches by matching
# the `result_unit_nodes` and only adding a new batch if necessary
grp_to_grp = {}
batch_info = [[] for i in range(nfrom_groups * nto_groups)]
batch_info = [[] for i in range(nfrom_groups * n_to_groups)]
for (igrp, ibatch), (_, fbatch) in _iterbatches(from_conn.groups):
for (jgrp, jbatch), (_, tbatch) in _iterbatches(to_conn.groups):
# compute result_unit_nodes
Expand All @@ -132,7 +132,7 @@ def find_batch(nodes, gtb):
# find new (group, batch)
(igrp_new, ibatch_new) = find_batch(result_unit_nodes, batch_info)
if igrp_new < 0:
igrp_new = nto_groups * igrp + jgrp
igrp_new = n_to_groups * igrp + jgrp
ibatch_new = len(batch_info[igrp_new])

batch_info[igrp_new].append(_ConnectionBatchData(
Expand Down
14 changes: 7 additions & 7 deletions meshmode/discretization/connection/opposite_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ def get_map_jacobian(unit_nodes):

if dim == 1:
# A is df.T
ata = np.einsum("iket,jket->ijet", df, df)
atb = np.einsum("iket,ket->iet", df, resid)
ata = np.einsum("ikes,jkes->ijes", df, df)
atb = np.einsum("ikes,kes->ies", df, resid)

df_inv_resid = atb / ata[0, 0]

elif dim == 2:
# A is df.T
ata = np.einsum("iket,jket->ijet", df, df)
atb = np.einsum("iket,ket->iet", df, resid)
ata = np.einsum("ikes,jkes->ijes", df, df)
atb = np.einsum("ikes,kes->ies", df, resid)

det = ata[0, 0]*ata[1, 1] - ata[0, 1]*ata[1, 0]

Expand Down Expand Up @@ -481,9 +481,9 @@ def make_opposite_face_connection(actx, volume_to_bdry_conn):
# {{{ visualization (for debugging)

if 0:
print("TVE", adj.elements[adj_tgt_flags])
print("TBE", tgt_bdry_element_indices)
print("FVE", src_vol_element_indices)
print("target volume elements:", adj.elements[adj_tgt_flags])
print("target boundary elements:", tgt_bdry_element_indices)
print("neighbor volume elements:", src_vol_element_indices)
import matplotlib.pyplot as pt

from meshmode.mesh.visualization import draw_2d_mesh
Expand Down
13 changes: 10 additions & 3 deletions meshmode/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

class MPIMeshDistributor:
"""
.. automethod:: is_mananger_rank
.. automethod:: is_manager_rank
.. automethod:: send_mesh_parts
.. automethod:: receive_mesh_part
"""
Expand All @@ -84,6 +84,13 @@ def __init__(self, mpi_comm, manager_rank=0):
DeprecationWarning, stacklevel=2)

def is_mananger_rank(self):
warn(f"'{type(self).__name__}.is_mananger_rank' is deprecated and will "
"be removed in 2025 (obvious typo). Use 'is_manager_rank' instead.",
DeprecationWarning, stacklevel=2)

return self.is_manager_rank()

def is_manager_rank(self):
return self.mpi_comm.Get_rank() == self.manager_rank

def send_mesh_parts(self, mesh, part_per_element, num_parts):
Expand All @@ -101,7 +108,7 @@ def send_mesh_parts(self, mesh, part_per_element, num_parts):
rank = mpi_comm.Get_rank()
assert num_parts <= mpi_comm.Get_size()

assert self.is_mananger_rank()
assert self.is_manager_rank()

part_num_to_elements = membership_list_to_map(part_per_element)

Expand Down Expand Up @@ -130,7 +137,7 @@ def receive_mesh_part(self):
mpi_comm = self.mpi_comm
rank = mpi_comm.Get_rank()

assert not self.is_mananger_rank(), "Manager rank cannot receive mesh"
assert not self.is_manager_rank(), "Manager rank cannot receive mesh"

from mpi4py import MPI
status = MPI.Status()
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,15 @@ module = [
"scipy.*",
]
ignore_missing_imports = true


[tool.typos.default]
extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$"
]

[tool.typos.default.extend-words]
"PN" = "PN"
"nd" = "nd"
# TODO: needed by deprecated MPIMeshDistributor.is_mananger_rank
"mananger" = "mananger"

0 comments on commit 75c8fa8

Please sign in to comment.