shapes.cuboid#
- shapes.cuboid(dim=(1.0, 1.0, 1.0), corner=(0.0, 0.0, 0.0), div=1, eltype='tri3')#
Create a cuboid.
Parameters#
- dimtuple of float, optional
Dimensions of the cuboid. First value specifies the length along the x-axis, second value the width along the y-axis, and third value the height along the z-axis. Default is (1.0, 1.0, 1.0).
- cornerarray_like of shape (3,), optional
Coordinates of the corner of the rectangle with minimal x,y,z values. Default is (0.0, 0.0, 0.0).
- divseed or list of three seeds, optional
Subdivision specification along the length, width and height. div can be any of the values accepted by
smartSeed(), or a list of three such values. If only one seed is given, it is applied to all directions.Accepted values for each seed are:
If int: number of equal subdivisions.
If list of floats: explicit subdivision values (must start with 0.0 and end with 1.0).
If tuple: (n, bias_start, bias_end), see
smartSeed().
- eltype{“hex8”, “quad4”, “tri3”}, optional
Output element type:
“hex8”: hexahedral volume mesh.
“quad4”: quadrilateral surface mesh.
“tri3”: triangular surface mesh (each quad split into triangles).
Returns#
- Mesh
Mesh representation of the cuboid in the specified element type.
Examples#
>>> M1 = cuboid(div=[3, 2, 1], eltype="hex8") >>> print(M1) Mesh: n_nodes: 24, n_elems: 6, plexitude: 8, level: 3, eltype: hex8 BBox: [0. 0. 0.], [1. 1. 1.] Size: [1. 1. 1.] Area: 6.0 Volume: 1.0
Cuboid consisting of quad elements:
>>> M2 = cuboid(div=2, eltype="quad4") >>> print(M2) Mesh: n_nodes: 26, n_elems: 24, plexitude: 4, level: 2, eltype: quad4 BBox: [0. 0. 0.], [1. 1. 1.] Size: [1. 1. 1.] Length: 0.0 Area: 6.0
Cuboid consisting of triangular elements:
>>> M3 = cuboid(dim=(3.0, 2.0, 1.0), corner=(1.0, 1.0, 0.0), eltype="tri3") >>> print(M3) Mesh: n_nodes: 8, n_elems: 12, plexitude: 3, level: 2, eltype: tri3 BBox: [1. 1. 0.], [4. 3. 1.] Size: [3. 2. 1.] Length: 0.0 Area: 22.0