Skip to content

Commit 998d17b

Browse files
committed
Format with black
1 parent 7713f2d commit 998d17b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

growing-mesh/solver-python/solver.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import argparse
1010

11+
1112
def split(num):
1213
for a in range(math.isqrt(num), 0, -1):
1314
if num % a == 0:
@@ -53,14 +54,17 @@ def main():
5354
py = rank // xr
5455
print(f"Rank {rank}/{size} has partition ({px}, {py})/({xr}, {yr})")
5556
if rank == 0:
56-
print(f"Each of {size} partitions has node size {pnx}x{pny} = {pnx*pny} for a total of {nx*ny} nodes on the base")
57-
57+
print(
58+
f"Each of {size} partitions has node size {pnx}x{pny} = {pnx*pny} for a total of {nx*ny} nodes on the base"
59+
)
5860

5961
def getMesh(nz):
60-
basex = np.linspace(0, 1, nx)[px*pnx:(px+1)*pnx]
61-
basey = np.linspace(0, 1, ny)[py*pny:(py+1)*pny]
62+
basex = np.linspace(0, 1, nx)[px * pnx : (px + 1) * pnx]
63+
basey = np.linspace(0, 1, ny)[py * pny : (py + 1) * pny]
6264
z = np.array(range(nz)) * dz
63-
return np.stack(np.meshgrid(basex, basey, z, indexing="ij"), axis=-1).reshape(-1, 3)
65+
return np.stack(np.meshgrid(basex, basey, z, indexing="ij"), axis=-1).reshape(
66+
-1, 3
67+
)
6468

6569
def requiresEvent(tw):
6670
return tw % eventFrequency == 0
@@ -110,20 +114,24 @@ def dataAtTimeWindow(tw):
110114
coords = getMeshAtTimeWindow(tw)
111115
if rank == 0:
112116
print(
113-
f"{participant_name}: Event grows local mesh from {oldCount} to {
117+
f"{participant_name}: Event grows local mesh from {oldCount} to {
114118
len(coords)} and global mesh from {
115119
oldCount *
116120
size} to {
117121
len(coords) *
118-
size}")
122+
size}"
123+
)
119124
participant.reset_mesh(mesh_name)
120125
vertex_ids = participant.set_mesh_vertices(mesh_name, coords)
121126

122-
participant.write_data(mesh_name, write_data_name, vertex_ids, dataAtTimeWindow(tw))
127+
participant.write_data(
128+
mesh_name, write_data_name, vertex_ids, dataAtTimeWindow(tw)
129+
)
123130

124131
participant.advance(dt)
125132
tw += 1
126133

134+
127135
if __name__ == "__main__":
128136
try:
129137
main()

0 commit comments

Comments
 (0)