Skip to content

Commit

Permalink
samples and oif: unused loop variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSzuttor committed Aug 3, 2020
1 parent dd6ff6e commit 56e77ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
8 changes: 4 additions & 4 deletions samples/billiard.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ def main():
p.pos = ball_start_pos
p.v = [0, 0, 0]
elif p.id == 5:
for p in system.part:
p.pos = spawnpos[p.id]
p.v = [0, 0, 0]
p.fix = [False, True, False]
for p2 in system.part:
p2.pos = spawnpos[p2.id]
p2.v = [0, 0, 0]
p2.fix = [False, True, False]
ball.fix = [True, True, True]
pool.update_cueball_force()
pool.stopped = True
Expand Down
2 changes: 1 addition & 1 deletion samples/minimal-diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

# because stretched polymers are not too impressive...
print("simulating a slow compression...")
for d in np.arange(1, 15):
for _ in np.arange(1, 15):
system.change_volume_and_rescale_particles(
d_new=system.box_l[0] - 1, dir='xyz')
print("box now at ", system.box_l)
Expand Down
18 changes: 5 additions & 13 deletions src/python/object_in_fluid/oif_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,9 +1149,7 @@ def elastic_forces(
if (el_forces[0] == 1) or (el_forces[5] == 1) or (
f_metric[0] == 1) or (f_metric[5] == 1):
# initialize list
stretching_forces_list = []
for p in self.mesh.points:
stretching_forces_list.append([0.0, 0.0, 0.0])
stretching_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses edges, but results are stored for nodes
for e in self.mesh.edges:
a_current_pos = e.A.get_pos()
Expand All @@ -1175,9 +1173,7 @@ def elastic_forces(
if (el_forces[1] == 1) or (el_forces[5] == 1) or (
f_metric[1] == 1) or (f_metric[5] == 1):
# initialize list
bending_forces_list = []
for p in self.mesh.points:
bending_forces_list.append([0.0, 0.0, 0.0])
bending_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses bending incidences, but results are stored for
# nodes
for angle in self.mesh.angles:
Expand Down Expand Up @@ -1215,9 +1211,7 @@ def elastic_forces(
if (el_forces[2] == 1) or (el_forces[5] == 1) or (
f_metric[2] == 1) or (f_metric[5] == 1):
# initialize list
local_area_forces_list = []
for p in self.mesh.points:
local_area_forces_list.append([0.0, 0.0, 0.0])
local_area_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
a_current_pos = t.A.get_pos()
Expand Down Expand Up @@ -1252,7 +1246,7 @@ def elastic_forces(
f_metric[3] == 1) or (f_metric[5] == 1):
# initialize list
global_area_forces_list = []
for p in self.mesh.points:
for _ in self.mesh.points:
global_area_forces_list.append([0.0, 0.0, 0.0])
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
Expand Down Expand Up @@ -1283,9 +1277,7 @@ def elastic_forces(
if (el_forces[4] == 1) or (el_forces[5] == 1) or (
f_metric[4] == 1) or (f_metric[5] == 1):
# initialize list
volume_forces_list = []
for p in self.mesh.points:
volume_forces_list.append([0.0, 0.0, 0.0])
volume_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
a_current_pos = t.A.get_pos()
Expand Down

0 comments on commit 56e77ed

Please sign in to comment.