Skip to content

Commit c1444fe

Browse files
committed
Merge branch 'wip/engine' into development
2 parents d6f0125 + e0fe732 commit c1444fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1499
-1281
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ coverage.xml
7979
*.py,cover
8080
.hypothesis/
8181
.pytest_cache/
82+
tests/outputs
8283

8384
# Translations
8485
*.mo

examples/advanced/merged.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
mesh.merge_patches("cylinder_master", "cylinder_slave")
4141
mesh.set_default_patch("walls", "wall")
4242

43-
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"))
43+
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")

examples/advanced/smooth_grader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
move_points = [[0, 1, 1], [2, 1, 1], [3, 1, 1]]
2525

2626
for point in move_points:
27-
vertex = list(finder.find_in_sphere(point))[0]
27+
vertex = next(iter(finder.find_in_sphere(point)))
2828
vertex.translate([0, 0.8, 0])
2929

3030
mesh.set_default_patch("walls", "wall")
31-
mesh.block_list.update()
31+
3232
grader = cb.SmoothGrader(mesh, 0.05)
3333
grader.grade()
3434

examples/complex/cyclone/cyclone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,5 @@ def mirror_region(region: Region):
152152

153153
mesh.set_default_patch("walls", "wall")
154154
mesh.add_geometry(geometry.surfaces)
155-
mesh.settings["scale"] = params.MESH_SCALE
155+
mesh.settings.scale = params.MESH_SCALE
156156
mesh.write(os.path.join("..", "..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")

examples/operation/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@
4444
mesh.add(right_block)
4545

4646
mesh.set_default_patch("walls", "wall")
47-
mesh.settings["scale"] = SCALE
47+
mesh.settings.scale = SCALE
4848
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"))

examples/optimization/duct.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
mesh = cb.Mesh()
99

10-
start_sketch = cb.SplineDisk([0, 0, 0], [2.5, 0, 0], [0, 1, 0], 0, 0)
11-
end_sketch = cb.SplineDisk([0, 0, 0], [1, 0, 0], [0, 2.5, 0], 0, 0).translate([0, 0, 1])
10+
start_sketch = cb.SplineDisk([0, 0, 0], [2, 0, 0], [0, 1, 0], 0, 0)
11+
end_sketch = cb.SplineDisk([0, 0, 0], [1, 0, 0], [0, 2, 0], 0, 0).translate([0, 0, 1])
1212

1313
shape = cb.LoftedShape(start_sketch, end_sketch)
1414

examples/shape/cylinder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
mesh = cb.Mesh()
66

7-
axis_point_1 = [0.0, 0.0, 0.0]
8-
axis_point_2 = [5.0, 5.0, 0.0]
9-
radius_point_1 = [0.0, 0.0, 2.0]
7+
axis_point_1 = [0, 0, 0]
8+
axis_point_2 = [0, 0, 1]
9+
radius_point_1 = [1, 0, 0]
1010

1111
cylinder = cb.Cylinder(axis_point_1, axis_point_2, radius_point_1)
1212

examples/shape/frustum.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
import numpy as np
34

45
import classy_blocks as cb
@@ -24,18 +25,16 @@
2425
cylinder = cb.Cylinder.chain(frustum, 6, start_face=True)
2526

2627
pos = cylinder.sketch_1.positions
27-
pos[:9] += np.array([-0.3,0,0])
28+
pos[:9] += np.array([-0.3, 0, 0])
2829
cylinder.sketch_1.update(pos)
2930
cylinder.sketch_1.add_edges()
3031

3132
pos = frustum.sketch_1.positions
32-
pos[:9] += np.array([-0.3,0,0])
33+
pos[:9] += np.array([-0.3, 0, 0])
3334
frustum.sketch_1.update(pos)
3435
frustum.sketch_1.add_edges()
3536

3637

37-
38-
3938
cylinder.set_end_patch("inlet")
4039
frustum.set_outer_patch("walls")
4140
cylinder.set_outer_patch("walls")
@@ -48,5 +47,5 @@
4847

4948
mesh.add(cylinder)
5049
mesh.add(frustum)
50+
mesh.modify_patch("walls", "wall")
5151
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")
52-

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = { file = "LICENSE" }
77
keywords = ["classy_blocks", "OpenFOAM", "blockMesh"]
88
authors = [{ name = "Nejc Jurkovic", email = "kandelabr@gmail.com" }]
99
requires-python = ">=3.8"
10-
dependencies = ["numpy", "scipy", "nptyping"]
10+
dependencies = ["numpy", "scipy", "nptyping", "numba"]
1111

1212
[project.urls]
1313
"Homepage" = "https://github.com/damogranlabs/classy_blocks"

src/classy_blocks/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from .optimize.clamps.free import FreeClamp
4545
from .optimize.clamps.surface import ParametricSurfaceClamp, PlaneClamp
4646
from .optimize.links import LinkBase, RotationLink, SymmetryLink, TranslationLink
47-
from .optimize.optimizer import MeshOptimizer, SketchOptimizer
47+
from .optimize.optimizer import MeshOptimizer, ShapeOptimizer, SketchOptimizer
4848
from .optimize.smoother import MeshSmoother, SketchSmoother
4949

5050
__all__ = [
@@ -113,6 +113,7 @@
113113
"Scaling",
114114
"SemiCylinder",
115115
"Shape",
116+
"ShapeOptimizer",
116117
"Shear",
117118
"Shell",
118119
"SimpleGrader",

0 commit comments

Comments
 (0)