Skip to content

Commit 2cec911

Browse files
committed
Direct imports of *Joints
1 parent b03abcd commit 2cec911

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

examples/assembly/l_joint.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
3+
import classy_blocks as cb
4+
from classy_blocks.construct.assemblies.joints import LJoint
5+
from classy_blocks.util import functions as f
6+
7+
mesh = cb.Mesh()
8+
9+
axis_point_1 = [0.0, 0.0, 0.0]
10+
axis_point_2 = [5.0, 5.0, 0.0]
11+
radius_point_1 = [0.0, 0.0, 2.0]
12+
13+
joint = LJoint(axis_point_1, axis_point_2, radius_point_1)
14+
15+
cell_size = f.norm(radius_point_1) / 10
16+
17+
joint.chop_axial(start_size=cell_size * 5, end_size=cell_size)
18+
joint.chop_radial(start_size=cell_size, end_size=cell_size / 10)
19+
joint.chop_tangential(start_size=cell_size)
20+
21+
joint.set_outer_patch("walls")
22+
joint.set_hole_patch(0, "inlet")
23+
joint.set_hole_patch(1, "outlet")
24+
25+
mesh.add(joint)
26+
27+
mesh.write(os.path.join("..", "case", "system", "blockMeshDict"), debug_path="debug.vtk")

src/classy_blocks/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .base.transforms import Mirror, Rotation, Scaling, Translation
2+
from .construct.assemblies.joints import LJoint, NJoint, TJoint
23
from .construct.curves.analytic import AnalyticCurve, CircleCurve, LineCurve
34
from .construct.curves.discrete import DiscreteCurve
45
from .construct.curves.interpolated import LinearInterpolatedCurve, SplineInterpolatedCurve
@@ -113,4 +114,8 @@
113114
"MeshSmoother",
114115
"SketchSmoother",
115116
"ViewpointReorienter",
117+
# Assemblies
118+
"NJoint",
119+
"TJoint",
120+
"LJoint",
116121
]

src/classy_blocks/construct/curves/curve.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ def center(self):
119119
warnings.warn("Using an approximate default curve center (average)!", stacklevel=2)
120120
return np.average(self.discretize(), axis=0)
121121

122-
@property
123-
def parts(self):
124-
return [self.array]
125-
126122

127123
class FunctionCurveBase(PointCurveBase):
128124
"""A base object for curves, driven by functions"""

tests/test_construct/test_curves/test_discrete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_get_length(self, param_from, param_to):
7979
def test_get_closest_param(self, point, index):
8080
self.assertEqual(self.curve.get_closest_param(point), index)
8181

82-
def test_transform(self):
82+
def test_translate(self):
8383
"""A simple translation to test .parts property"""
8484
curve = self.curve
8585
curve.translate([0, 0, 1])

tests/test_construct/test_shape.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ def test_core(self):
227227

228228
self.assertEqual(len(sphere.core), 1)
229229

230+
def test_center(self):
231+
sphere = EighthSphere([0, 0, 0], [1, 0, 0], [0, 0, 1])
232+
233+
np.testing.assert_equal(sphere.center, [0, 0, 0])
234+
230235

231236
class FrustumTests(unittest.TestCase):
232237
def test_non_perpendicular_axis_radius(self):

0 commit comments

Comments
 (0)