import pyck L = [10.0, 10.0, 0.0] r = 0.1 # Create a packer, see packers directory for options cubic = pyck.CubicPacker(L, r) # do not create the cubic packer in this function call as it will be # destroyed, blame SWIG developers pack = pyck.StructuredPack(cubic) # Create some shapes, see shapes directory for options and reference # First argument is always a tag for these particles # Mapping operations are applied sequentially sphere = pyck.Sphere(1, [2, 2, 2], 5, True) # Map the shapes and generate the pack # As with creating the cubic packer, do not create the shapes within the # function call here pack.AddShape(sphere) pack.Process() # Create a new model from the pack model = pyck.Model(pack) # Create a new field of n-dimensional integers # Arguments are CreateIntField(label,dimensions) # label - label for this field in the vtp file # dimensions - dimensionality of this field, doesnt have to correspond to model dimensions # Create field of doubles in the same way with CreateDoubleField stateField = model.CreateIntField("State", 1)
import pyck domain = [10.0, 10.0, 10.0] h = 0.02 smoothingKernelFunc = 2 speedsound = 1 density = 1 shearmodulus = 1 bulkmodulus = 1 # Create a packer, see packers directory for options cubic = pyck.CubicPacker([10.0, 10.0, 10.0], h) # pack = pyck.Pack(cubic); # do not create the cubic packer in this # function call as it will be destroyed, blame SWIG developers pack = pyck.StructuredPack(cubic) # Create some shapes, see shapes directory for options and reference # First argument is always a tag for these particles # Mapping operations are applied sequentially tri = pyck.TriPrism(1, [1.5, 3.0, 0.0], [3, 0, 0], [0, 0, 0], 2) # Map the shapes and generate the pack # pack.AddShape(cube); # As with creating the cubic packer, do not create the shapes within the function call here # pack.AddShape(sphere); pack.AddShape(tri) pack.Process() # Create a new model from the pack model = pyck.Model(pack) # Create a new field of n-dimensional integers # Arguments are CreateIntField(label,dimensions)
import pyck L = [10.0, 10.0, 0.0] offset = [100.0, 50.0, 0.0] r = 0.1 # Create a packer, see packers directory for options cubic = pyck.CubicPacker(L, r, offset) # do not create the cubic packer in this function call as it will be # destroyed, blame SWIG developers pack = pyck.StructuredPack(cubic) # Create some shapes, see shapes directory for options and reference # First argument is always a tag for these particles # Mapping operations are applied sequentially cube = pyck.Cuboid(1, [102, 52, -1], [106, 56, 1]) sphere = pyck.Sphere(2, [102, 52, 2], 5) # Map the shapes and generate the pack # As with creating the cubic packer, do not create the shapes within the # function call here pack.AddShape(cube) pack.AddShape(sphere) pack.Process() # Create a new model from the pack model = pyck.Model(pack) # Create a new field of n-dimensional integers # Arguments are CreateIntField(label,dimensions) # label - label for this field in the vtp file