コード例 #1
0
ファイル: 2dinverted.py プロジェクト: MITGeonumerics/pyck
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)
コード例 #2
0
bulkmodulus = 1
# Create a packer, see packers directory for options
Hcp = pyck.Hcp2dPacker(domain, h)
pack = pyck.StructuredPack(Hcp)


# 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_center = [0.5, 0.5, 0.0]
print(sphere_center)
# Recenter the sphere on the closest particle
sphere_center = pack.GetClosestParticlePosition(sphere_center)
print(sphere_center)
sphere = pyck.Sphere(2, sphere_center, 0.4)

# Map the shapes and generate the pack
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)
コード例 #3
0
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
cube = pyck.Cuboid(1, [2, 2, 2], [6, 6, 6])
sphere = pyck.Sphere(2, [2, 2, 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
# dimensions - dimensionality of this field, doesnt have to correspond to model dimensions
コード例 #4
0
ファイル: offset.py プロジェクト: MITGeonumerics/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
# dimensions - dimensionality of this field, doesnt have to correspond to model dimensions