Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 3, 2023
1 parent 9d10dea commit 3216565
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pymech/meshtools.py
Expand Up @@ -100,7 +100,7 @@ def extrude(mesh: HexaData, z, bc1="P", bc2="P", internal_bcs=True):
# fix the internal boundary conditions
# the end boundary conditions will be overwritten later with the proper ones
if internal_bcs:
for (iel, el) in enumerate(mesh3d.elem):
for iel, el in enumerate(mesh3d.elem):
for ibc in range(nbc):
el.bcs[ibc, 4][0] = "E"
el.bcs[ibc, 4][1] = iel + 1
Expand Down Expand Up @@ -1091,7 +1091,7 @@ def generate_internal_bcs(mesh, tol=1e-3):

# First generate a length scale for each element, equal to the smallest edge of that element.
scales = np.zeros((mesh.nel,))
for (iel, el) in enumerate(mesh.elem):
for iel, el in enumerate(mesh.elem):
scales[iel] = el.smallest_edge()

# check if there is a zero length edge; in this case the mesh is invalid and there is no point continuing.
Expand Down
10 changes: 5 additions & 5 deletions pymech/neksuite/mesh.py
Expand Up @@ -664,7 +664,7 @@ def readre2(fname):
# This is the reason for the +1 here, then the first number is ignored.
buf = infile.read((ndim * npel + 1) * wdsz * nel)
# elem_shape = [ndim, ndim-1, 2, 2] # nvar, lz, ly, lx
for (iel, el) in enumerate(data.elem):
for iel, el in enumerate(data.elem):
fi = np.frombuffer(
buf,
dtype=emode + realtype,
Expand Down Expand Up @@ -869,7 +869,7 @@ def write_data_to_file(a):
# write curve sides data
# locate curved edges
curved_edges = []
for (iel, el) in enumerate(data.elem):
for iel, el in enumerate(data.elem):
for iedge in range(12):
if el.ccurv[iedge] != "":
curved_edges.append((iel, iedge))
Expand All @@ -883,7 +883,7 @@ def write_data_to_file(a):
write_data_to_file(ncurvf)
# format curve data
cdata = np.zeros((ncurv,), dtype="f8, f8, f8, f8, f8, f8, f8, S8")
for (cdat, (iel, iedge)) in zip(cdata, curved_edges):
for cdat, (iel, iedge) in zip(cdata, curved_edges):
el = data.elem[iel]
cdat[0] = iel + 1
cdat[1] = iedge + 1
Expand All @@ -899,7 +899,7 @@ def write_data_to_file(a):
for ifield in range(data.nbc):
# locate faces with boundary conditions
bc_faces = []
for (iel, el) in enumerate(data.elem):
for iel, el in enumerate(data.elem):
for iface in range(2 * ndim):
bctype = el.bcs[ifield, iface][0]
# internal boundary conditions are not written to .re2 files by reatore2
Expand All @@ -911,7 +911,7 @@ def write_data_to_file(a):
write_data_to_file(nbcsf)
# initialize and format data
bcdata = np.zeros((nbcs,), dtype="f8, f8, f8, f8, f8, f8, f8, S8")
for (bc, (iel, iface)) in zip(bcdata, bc_faces):
for bc, (iel, iface) in zip(bcdata, bc_faces):
el = data.elem[iel]
bc[0] = iel + 1
bc[1] = iface + 1
Expand Down
14 changes: 7 additions & 7 deletions tests/test_all.py
Expand Up @@ -294,7 +294,7 @@ def test_merge(test_data_dir):
# check if the element/faces indices in the boundary conditions are right too, even if it may not matter
assert mesh1.nbc > 0
for ibc in range(mesh1.nbc):
for (iel, el) in enumerate(mesh1.elem):
for iel, el in enumerate(mesh1.elem):
for iface in range(6):
assert el.bcs[ibc, iface][1] == iel + 1
assert el.bcs[ibc, iface][2] == iface + 1
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_readre2(test_data_dir):
assert meshre2.var == meshrea.var
assert meshre2.lr1 == meshrea.lr1
assert meshre2.wdsz == 8
for (el, elw) in zip(meshrea.elem, meshre2.elem):
for el, elw in zip(meshrea.elem, meshre2.elem):
npt.assert_allclose(elw.pos, el.pos)
npt.assert_array_equal(elw.bcs, el.bcs)
npt.assert_allclose(elw.curv, el.curv)
Expand Down Expand Up @@ -358,7 +358,7 @@ def test_readre2_3d(test_data_dir):
assert meshre2.var == meshrea.var
assert meshre2.lr1 == meshrea.lr1
assert meshre2.wdsz == 8
for (el, elw) in zip(meshrea.elem, meshre2.elem):
for el, elw in zip(meshrea.elem, meshre2.elem):
npt.assert_allclose(elw.pos, el.pos)
npt.assert_array_equal(elw.bcs, el.bcs)
npt.assert_allclose(elw.curv, el.curv)
Expand All @@ -384,7 +384,7 @@ def test_writere2(test_data_dir, tmpdir):
assert meshw.var == mesh.var
assert meshw.lr1 == mesh.lr1
assert meshw.wdsz == 8
for (el, elw) in zip(mesh.elem, meshw.elem):
for el, elw in zip(mesh.elem, meshw.elem):
npt.assert_array_equal(elw.pos, el.pos)
npt.assert_array_equal(elw.bcs, el.bcs)
npt.assert_array_equal(elw.curv, el.curv)
Expand All @@ -410,7 +410,7 @@ def test_writere2_3d(test_data_dir, tmpdir):
assert meshw.var == mesh.var
assert meshw.lr1 == mesh.lr1
assert meshw.wdsz == 8
for (el, elw) in zip(mesh.elem, meshw.elem):
for el, elw in zip(mesh.elem, meshw.elem):
npt.assert_array_equal(elw.pos, el.pos)
npt.assert_array_equal(elw.bcs, el.bcs)
npt.assert_array_equal(elw.curv, el.curv)
Expand All @@ -429,7 +429,7 @@ def test_generate_internal_bcs(test_data_dir):
meshre2 = ns.readre2(fre2)
nconnect = mt.generate_internal_bcs(meshre2)
assert nconnect == 54 # This is a 3x3x3 box
for (ela, el2) in zip(meshrea.elem, meshre2.elem):
for ela, el2 in zip(meshrea.elem, meshre2.elem):
npt.assert_array_equal(el2.bcs, ela.bcs)
assert meshre2.check_connectivity()

Expand All @@ -447,7 +447,7 @@ def test_delete_internal_bcs(test_data_dir):
assert (
ndelete == 108
) # This is a 3x3x3 box, and each connection is deleted twice, one for each connected element
for (ela, el2) in zip(meshrea.elem, meshre2.elem):
for ela, el2 in zip(meshrea.elem, meshre2.elem):
npt.assert_array_equal(el2.bcs, ela.bcs)
assert meshrea.check_connectivity()

Expand Down

0 comments on commit 3216565

Please sign in to comment.