Skip to content

Commit a3ea902

Browse files
committed
Clean up imports and aliases
1 parent 61f301a commit a3ea902

10 files changed

Lines changed: 62 additions & 32 deletions

src/nfd_numpy/nfd/geometry.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@
2828
# =================================================
2929

3030
s, c = sin, cos
31-
def s2(x): return s(x) * s(x) # noqa E704
32-
def c2(x): return c(x) * c(x) # noqa E704
31+
32+
33+
def s2(x):
34+
return s(x) * s(x)
35+
36+
37+
def c2(x):
38+
return c(x) * c(x)
3339

3440

3541
# =================================================

src/nfd_numpy/scripts/01_hypar.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -43,6 +43,7 @@
4343
# =================================================
4444
# get mesh data
4545
# =================================================
46+
4647
P = mesh.vertices_attributes(['px', 'py', 'pz'])
4748
S = mesh.faces_attribute('s_pre')
4849
Q = mesh.edges_attribute('q_pre')
@@ -51,13 +52,15 @@
5152
# =================================================
5253
# run solver
5354
# =================================================
55+
5456
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10, s_calc=1)
5557
mesh_update(mesh, xyz, r, s, f)
5658

5759

5860
# =================================================
5961
# visualisation
6062
# =================================================
63+
6164
viewer = app.App()
6265
viewer.add(mesh)
6366
viewer.show()

src/nfd_numpy/scripts/02_hypar_opening.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,13 +19,11 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

2626
central_vertex = 3
27-
# nbrs = mesh.vertex_neighborhood(central_vertex, ring=2)
28-
# for nbr in nbrs:
29-
# mesh.delete_vertex(nbr)
3027
mesh.delete_vertex(3)
3128

3229
mesh = mesh_subdivide(mesh, scheme='quad', k=3)
@@ -50,6 +47,7 @@
5047
# =================================================
5148
# get mesh data
5249
# =================================================
50+
5351
P = mesh.vertices_attributes(['px', 'py', 'pz'])
5452
S = mesh.faces_attribute('s_pre')
5553
Q = mesh.edges_attribute('q_pre')
@@ -58,6 +56,7 @@
5856
# =================================================
5957
# run solver
6058
# =================================================
59+
6160
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
6261
s_calc=1, s_tol=.05, xyz_tol=.01)
6362
mesh_update(mesh, xyz, r, s, f)
@@ -66,6 +65,7 @@
6665
# =================================================
6766
# visualisation
6867
# =================================================
68+
6969
viewer = app.App()
7070
viewer.add(mesh)
7171
viewer.show()

src/nfd_numpy/scripts/03_hypar_quads.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -42,6 +42,7 @@
4242
# =================================================
4343
# get mesh data
4444
# =================================================
45+
4546
P = mesh.vertices_attributes(['px', 'py', 'pz'])
4647
S = mesh.faces_attribute('s_pre')
4748
Q = mesh.edges_attribute('q_pre')
@@ -50,6 +51,7 @@
5051
# =================================================
5152
# run solver
5253
# =================================================
54+
5355
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
5456
s_calc=1, s_tol=.05, xyz_tol=.01)
5557
mesh_update(mesh, xyz, r, s, f)
@@ -58,6 +60,7 @@
5860
# =================================================
5961
# visualisation
6062
# =================================================
63+
6164
viewer = app.App()
6265
viewer.add(mesh)
6366
viewer.show()

src/nfd_numpy/scripts/04_hypar_quads_tris.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -46,6 +46,7 @@
4646
# =================================================
4747
# get mesh data
4848
# =================================================
49+
4950
P = mesh.vertices_attributes(['px', 'py', 'pz'])
5051
S = mesh.faces_attribute('s_pre')
5152
Q = mesh.edges_attribute('q_pre')
@@ -54,6 +55,7 @@
5455
# =================================================
5556
# run solver
5657
# =================================================
58+
5759
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
5860
s_calc=1, s_tol=.05, xyz_tol=.01)
5961
mesh_update(mesh, xyz, r, s, f)
@@ -62,6 +64,7 @@
6264
# =================================================
6365
# visualisation
6466
# =================================================
67+
6568
viewer = app.App()
6669
viewer.add(mesh)
6770
viewer.show()

src/nfd_numpy/scripts/05_hypar_support.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -70,6 +70,7 @@
7070
# =================================================
7171
# get mesh data
7272
# =================================================
73+
7374
P = mesh.vertices_attributes(['px', 'py', 'pz'])
7475
S = mesh.faces_attribute('s_pre')
7576
Q = mesh.edges_attribute('q_pre')
@@ -78,6 +79,7 @@
7879
# =================================================
7980
# run solver
8081
# =================================================
82+
8183
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
8284
s_calc=1, s_tol=.001, xyz_tol=.001)
8385
mesh_update(mesh, xyz, r, s, f)
@@ -86,6 +88,7 @@
8688
# =================================================
8789
# visualisation
8890
# =================================================
91+
8992
viewer = app.App()
9093
viewer.add(mesh)
9194
viewer.show()

src/nfd_numpy/scripts/06_hypar_anisotropic_stress_A.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -43,6 +43,7 @@
4343
# =================================================
4444
# get mesh data
4545
# =================================================
46+
4647
P = mesh.vertices_attributes(['px', 'py', 'pz'])
4748
S = mesh.faces_attribute('s_pre')
4849
Q = mesh.edges_attribute('q_pre')
@@ -51,6 +52,7 @@
5152
# =================================================
5253
# run solver
5354
# =================================================
55+
5456
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
5557
s_calc=3, s_ref=(1, 1, 0))
5658
mesh_update(mesh, xyz, r, s, f)
@@ -59,6 +61,7 @@
5961
# =================================================
6062
# visualisation
6163
# =================================================
64+
6265
viewer = app.App()
6366
viewer.add(mesh)
6467
viewer.show()

src/nfd_numpy/scripts/07_hypar_anisotropic_stress_B.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from os import path
2-
import sys
3-
sys.path.append(path.dirname(path.dirname(__file__)))
42

53
from compas.datastructures import Mesh, mesh_subdivide
64
from compas_view2 import app
75

8-
from nfd import nfd_ur_numpy
6+
from compas_fd.nfd_numpy import nfd_ur_numpy
97
from _helpers import mesh_update
108

119

1210
# =================================================
1311
# IO
1412
# =================================================
13+
1514
HERE = path.dirname(__file__)
1615
FILE_I = path.join(HERE, '..', 'data', 'in_hypar_mesh.json')
1716
mesh = Mesh.from_json(FILE_I)
@@ -20,6 +19,7 @@
2019
# =================================================
2120
# input mesh
2221
# =================================================
22+
2323
mesh.vertices_attribute('is_anchor', True,
2424
mesh.vertices_where({'vertex_degree': 2}))
2525

@@ -43,6 +43,7 @@
4343
# =================================================
4444
# get mesh data
4545
# =================================================
46+
4647
P = mesh.vertices_attributes(['px', 'py', 'pz'])
4748
S = mesh.faces_attribute('s_pre')
4849
Q = mesh.edges_attribute('q_pre')
@@ -51,6 +52,7 @@
5152
# =================================================
5253
# run solver
5354
# =================================================
55+
5456
xyz, r, s, f = nfd_ur_numpy(mesh, S, Q, vertex_loads=P, kmax=10,
5557
s_calc=3, s_ref=(1, 0.5, 0))
5658
mesh_update(mesh, xyz, r, s, f)
@@ -59,6 +61,7 @@
5961
# =================================================
6062
# visualisation
6163
# =================================================
64+
6265
viewer = app.App()
6366
viewer.add(mesh)
6467
viewer.show()

0 commit comments

Comments
 (0)