pumapy.generation¶
pumapy.generation.generate_2d_square_array¶
pumapy.generation.generate_sphere¶
-
class
pumapy.generation.generate_sphere.
GeneratorSphere
(size, center, diameter)[source]¶ Bases:
object
-
pumapy.generation.generate_sphere.
generate_sphere
(size, center, diameter)[source]¶ Generation of a sphere at a given point and diameter
- Parameters
size (tuple(int, int, int)) – size of 3D domain (x,y,z)
center (tuple(int, int, int)) – centerpoint of sphere (x,y,z)
diameter – diameter of the random spheres in voxels
- Return type
float
pumapy.generation.random_fibers¶
-
pumapy.generation.random_fibers.
generate_random_fibers
(shape, radius, nfibers=None, porosity=None, phi=0, theta=90, length=None, max_iter=3)[source]¶ Generates random fibers from number of fibers or porosity
- Parameters
shape (tuple(int, int, int)) – the size of the workspace to generate in (Nx, Ny, Nz) where N is the number of voxels.
radius (int) – the radius of the fibers in voxels
nfibers (int, optional) – the number of fibers to add to the domain. Adjust this value to control the final porosity, which is not easily specified since cylinders overlap and intersect different fractions of the domain
porosity (float, optional) – the targeted value for the porosity of the generated mat. The function uses an algorithm for predicted the number of required number of cylinder, and refines this over a certain number of fractional insertions (according to the ‘iterations’ input)
phi (float, optional) – a value between 0 and 90 that controls the amount that the fibers lie out of the XY plane, with 0 meaning all fibers lie in the XY plane, and 90 meaning that cylinders are randomly oriented out of the plane by as much as +/- 90 degrees
theta (float, optional) – a value between 0 and 90 that controls the amount of rotation in the XY plane, with 0 meaning all fibers point in the X-direction, and 90 meaning they are randomly rotated about the Z axis by as much as +/- 90 degrees
length (float, optional) – the length of the cylinders to add. If
None
(default) then the cylinders will extend beyond the domain in both directions so no ends will exist. If a scalar value is given it will be interpreted as the Euclidean distance between the two ends of the cylinder. Note that one or both of the ends may still lie outside the domain, depending on the randomly chosen center point of the cylindermax_iter (int, optional) – the number of fractional fiber insertions used to target the requested porosity. By default a value of 3 is used (and this is typically effective in getting very close to the targeted porosity), but a greater number can be input to improve the achieved porosity
- Returns
random fibers domain
- Return type
pumapy.generation.random_spheres¶
-
class
pumapy.generation.random_spheres.
GeneratorSpheres
(size, diameter, porosity, allow_intersect)[source]¶ Bases:
object
-
pumapy.generation.random_spheres.
generate_random_spheres
(size, diameter, porosity, allow_intersect=True)[source]¶ Generation of triply periodic minimal surface material
- Parameters
size (tuple(int, int, int)) – size of 3D domain (x,y,z)
diameter (float) – diameter of the random spheres in voxels
porosity (float) – target porosity of the generated structure
allow_intersect (bool) – allow the spheres to intersect or not
- Returns
domain with random spheres with input diameter
- Return type
pumapy.generation.sphere¶
pumapy.generation.tpms¶
-
pumapy.generation.tpms.
generate_tpms
(size, w, q, equation=0)[source]¶ Generation of triply periodic minimal surface material
- Parameters
size (tuple(int, int, int)) – size of 3D domain (x,y,z)
w (float or tuple(float, float)) – w parameter for tpms
q (float or tuple(float, float)) – q parameter for tpms (float or tuple)
equation (int) – equation 0, 1, or 2 for tpms
- Returns
TPMS domain
- Return type