Autodocs are generated for PDMaterialPoints using Documenter.jl.
PDMaterialPoints.Cone
— TypeCone(radius::QF, length::QF)
Cone shape.
Fields
radius::QF
: Radius of the cone.length::QF
: Length of the cone.
Example
using PDMaterialPoints
# Create a cone
cone = Cone(1.0, 1.0)
# Create a material-point-geometry.
mpg =create(cone; resolution=0.1, rand_=0.01, type=1)
See also
References
PDMaterialPoints.Cone
— MethodPDMaterialPoints.Cuboid
— TypeCuboid(bounds::Array{QF, 2})
Cuboid shape.
Fields
bounds::Array{QF, 2}
: Bounds of the cuboid.
Example
using PDMaterialPoints
# Create a cuboid
cuboid = Cuboid([0.0 1.0; 0.0 1.0; 0.0 1.0])
# Create a material-point-geometry.
mpg =create(cuboid)
See also
References
PDMaterialPoints.Cuboid
— MethodCuboid()
Cuboid shape. Bounds are [-0.5 0.5; -0.5 0.5; -0.5 0.5]. Length is 1.0.
see also
PDMaterialPoints.Cylinder
— TypeCylinder
Cylinder shape.
Fields
radius::QF
: Radius of the cylinder.thickness::QF
: Thickness of the cylinder.length::QF
: Length of the cylinder.
Example
using PDMaterialPoints
# Create a cylinder
cylinder = Cylinder(1.0, 0.1, 2.0)
# Create a material-point-geometry.
mpg =create(cylinder, resolution=0.1)
PDMaterialPoints.Disk
— TypeDisk
Disk shape.
Fields
radius::QF
: Radius of the disk.thickness::QF
: Thickness of the disk.
Example
using PDMaterialPoints
# Create a disk
disk = Disk(1.0, 0.1)
# Create a material-point-geometry.
mpg =create(disk, resolution=0.1)
PDMaterialPoints.PostOpObj
— TypePostOpObj
These objects are used to create a post operation object (lazy) from object ( or post operation object)and an operation. Operations will be applied while a create call.
Fields
name::String
: Name of the object.objs::Vector{Any}
: Objects to be operated on.operations::Array{Function}
: Operations to be applied.
PDMaterialPoints.Shape
— TypeShape
Abstract type for shapes.
PDMaterialPoints.Shell
— TypeShell
Shell shape.
Fields
outer_radius::QF
: Outer radius of the shell.inner_radius::QF
: Inner radius of the shell.
Example
using PDMaterialPoints
# Create a shell
shell = Shell(1.0, 0.5)
# Create a material-point-geometry.
mpg =create(shell, resolution=0.1)
PDMaterialPoints.Sphere
— TypeSphere
Sphere shape.
Fields
radius::QF
: Radius of the sphere.
Example
using PDMaterialPoints
# Create a sphere
sphere = Sphere(1.0)
# Create a material-point-geometry.
mpg =create(sphere, resolution=0.1)
PDMaterialPoints.Cube
— MethodCube(L)
Cube shape. A special case of Cuboid.
Arguments
L::QF
: Length of the cube.
Example
using PDMaterialPoints
# Create a cube
cube = Cube(1.0)
# Create a material-point-geometry.
mpg =create(cube)
See also
PDMaterialPoints.Cube
— MethodPDMaterialPoints.Indentor
— MethodIndentor(angle, height; sides=3)
Indentor shape. A special case of Pyramid.
Arguments
angle::QF
: Apex angle of the Indentor.height::QF
: Height of the Indentor.
Keyword Arguments
sides::Int
: Number of sides of the Indentor.
Example
using PDMaterialPoints
# Create a Indentor
Indentor = Indentor(60.0, 1.0)
# Create a material-point-geometry.
mpg =create(Indentor)
See also
PDMaterialPoints.Pyramid
— MethodPyramid
Pyramid shape.
Arguments
angle::QF
: Apex angle of the Pyramid.
Example
using PDMaterialPoints
# Create a Pyramid
Pyramid = Pyramid(60.0)
# Create a material-point-geometry.
mpg =create(Pyramid)
See also
References
PDMaterialPoints.StandardCone
— MethodStandardCone()
Standard cone shape. A special case of Cone. Radius and length are 1.0.
Example
using PDMaterialPoints
# Create a standard cone
cone = StandardCone()
# Create a material-point-geometry.
mpg =create(cone)
See also
PDMaterialPoints.StandardCuboid
— MethodStandardCuboid()
Standard cuboid shape. A special case of Cuboid. Bounds are [-0.5 0.5; -0.5 0.5; -0.5 0.5]. Length is 1.0.
Example
using PDMaterialPoints
# Create a standard cuboid
cuboid = StandardCuboid()
# Create a material-point-geometry.
mpg =create(cuboid)
See also
PDMaterialPoints.StandardCylinder
— MethodStandardCylinder()
Standard cylinder shape. A special case of Cylinder. Radius is 1.0. Thickness is 0.3. Length is 1.0.
Example
using PDMaterialPoints
# Create a standard cylinder
cylinder = StandardCylinder()
# Create a material-point-geometry.
mpg =create(cylinder)
See also
PDMaterialPoints.StandardDisk
— MethodStandardDisk()
Standard disk shape. A special case of Disk. Radius is 1.0. Thickness is 0.3.
Example
using PDMaterialPoints
# Create a standard disk
disk = StandardDisk()
# Create a material-point-geometry.
mpg =create(disk)
See also
PDMaterialPoints.StandardSphere
— MethodStandardSphere()
Standard sphere shape. A special case of Sphere. Radius is 1.0.
Example
using PDMaterialPoints
# Create a standard sphere
sphere = StandardSphere()
# Create a material-point-geometry.
mpg =create(sphere, resolution=0.1)
See also
PDMaterialPoints.changetype
— Methodchangetype(type::Array{Int,1}, mask, ntype::Int)
Change material point type for object using boolean array mask.
Arguments
type::Array{Int,1}
: Array of particle types.mask
: Boolean array.ntype::Int
: New particle type.
Returns
type::Array{Int,1}
: Array of particle types.
See also
PDMaterialPoints.changetype
— Methodchangetype(obj::T, f::Function, ntype::Int) where T <: SuperShape
Change material point type for object using function f.
Arguments
obj::T
: Object.f::Function
: Function that returns a boolean array.ntype::Int
: New particle type.
Returns
obj::T
: Object.
See also
Example
using PDMaterialPoints
# Create a disk
disk = Disk(1.0, 0.1)
# Create a material-point-geometry.
mpg =create(disk, resolution=0.1)
# Change particle type
mpg =changetype(mpg, out -> out['x'][:, 1] .> 0.0, 2)
PDMaterialPoints.combine
— Methodcombine(obj1::T1, obj2::T2) where {T1<:SuperShape, T2<:SuperShape}
Combine two objects. Duplicate of add.
PDMaterialPoints.create
— Methodcreate(c::Cone; resolution=nothing, rand_=0.0, type::Int=1)
Create a material-point-geometry of a cone.
Arguments
c::Cone
: Cone shape.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
Dict
: Material point gemetry.
Example
using PDMaterialPoints
# Create a cone
cone = Cone(1.0, 1.0)
# Create a material-point-geometry.
mpg =create(cone)
See also
PDMaterialPoints.create
— Methodcreate(c::Cuboid; resolution=nothing, rand_=0.0, type::Int=1)
Create a material-point-geometry of a cuboid.
Arguments
c::Cuboid
: Cuboid shape.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
Dict
: Material point gemetry.
Example
using PDMaterialPoints
# Create a cuboid
cuboid = Cuboid([0.0 1.0; 0.0 1.0; 0.0 1.0])
# Create a material-point-geometry.
mpg =create(cuboid)
See also
PDMaterialPoints.create
— Methodcreate(c::Cylinder; resolution=nothing, rand_=0.0, type::Int=1)
Create a material-point-geometry from a cylinder.
Arguments
c::Cylinder
: Cylinder object.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
Example
using PDMaterialPoints
# Create a cylinder
cylinder = Cylinder(1.0, 0.1, 2.0)
# Create a material-point-geometry.
mpg =create(cylinder, resolution=0.1)
PDMaterialPoints.create
— Methodcreate(c::Disk; resolution=nothing, rand_=0.0, type::Int=1)
Create a material-point-geometry from a disk.
Arguments
c::Disk
: Disk object.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
Example
using PDMaterialPoints
# Create a disk
disk = Disk(1.0, 0.1)
# Create a material-point-geometry.
mpg =create(disk, resolution=0.1)
PDMaterialPoints.create
— Methodcreate(pobj::PostOpObj, args...; kwargs...)
Create a material-point-geometry from a post operation object.
Arguments
pobj::PostOpObj
: Post operation object.args...
: Arguments to be passed to the create function.kwargs...
: Keyword arguments to be passed to the create function.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
PDMaterialPoints.create
— Methodcreate(s::Sphere; resolution=nothing, rand_=0.0, type::Int=1)
Create a material-point-geometry from a sphere or shell.
Arguments
s::Sphere
: Sphere object.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
PDMaterialPoints.create
— Methodcreate(shape::T; resolution=nothing, rand_=0.0, type::Int=1) where T <: Shape
Abstact function for creating Shape objects.
Arguments
shape::T
: Shape object.resolution=nothing
: Resolution of the material-point-geometry.rand_=0.0
: Randomization factor.type::Int=1
: Type of the material-point-geometry.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
PDMaterialPoints.delete
— Methoddelete(obj::T, f::Function) where T <: SuperShape
Delete material points for object using function f.
Arguments
obj::T
: Object.f::Function
: Function that returns a boolean array.
Returns
obj::T
: Object.
Example
using PDMaterialPoints
# Create a disk
disk = Disk(1.0, 0.1)
# Create a material-point-geometry.
mpg =create(disk, resolution=0.1)
# Delete particles
mpg =delete(mpg, out -> out['x'][:, 1] .> 0.0)
See also
PDMaterialPoints.make
— Methodmake(shape::T) where T <: Shape
Create a material-point-geometry from a shape. This function is a wrapper for the create function. It is used to create a material-point-geometry from a shape with default arguments.
Arguments
shape::T
: Shape object.
Returns
out::Dict{Symbol, Any}
: Dictionary containing the material-point-geometry data.
PDMaterialPoints.move
— Methodmove(x::Array{QF,2}; by=[0.0, 0.0, 0.0])
Move material points for object by given "by".
Arguments
x::Array{QF,2}
: Array of material points.by=[0.0, 0.0, 0.0]
: Translation vector.
Returns
x::Array{QF,2}
: Array of material points.
See also
PDMaterialPoints.move
— Methodmove(obj::T; by=[0.0, 0.0, 0.0]) where T
Move material points for object by given "by".
Arguments
obj::T
: Object.by=[0.0, 0.0, 0.0]
: Translation vector.
Returns
obj::T
: Object.
Example
using PDMaterialPoints
# Create a disk
disk = Disk(1.0, 0.1)
# Create a material-point-geometry.
mpg =create(disk, resolution=0.1)
# Move particles
mpg =move(mpg, by=[0.0, 0.0, 0.1])
See also
PDMaterialPoints.repack!
— Methodrepack!(d::Dict, keys_, vals)
Repack a dictionary from its components inplace.
Arguments
d::Dict
: Dictionary to be repacked.keys_
: Keys of the dictionary.vals
: Values of the dictionary.
Returns
d::Dict
: Dictionary containing the components.
PDMaterialPoints.repack
— Methodrepack(args...; keys_ = (:x, :v, :y, :volume, :type))
Repack a dictionary from its components.
Arguments
args...
: Components to be packed.keys_ = (:x, :v, :y, :volume, :type)
: Keys of the dictionary.
Returns
d::Dict
: Dictionary containing the components.
PDMaterialPoints.rotate
— Methodrotate(x::Array{QF,2}; angle=0.0, point=[0.0, 0.0, 0.0], vector_=[1.0, 0.0, 0.0])
Rotate material points for object by given angle about given vector and point.
Arguments
x::Array{QF,2}
: Array of material points.angle=0.0
: Rotation angle.point=[0.0, 0.0, 0.0]
: Rotation point.vector_=[1.0, 0.0, 0.0]
: Rotation vector.
Returns
x::Array{QF,2}
: Array of material points.
See also
PDMaterialPoints.rotate
— Methodrotate(obj::T; angle=0.0, point=[0.0, 0.0, 0.0], vector_=[1.0, 0.0, 0.0]) where T <: SuperShape
Rotate shape object by given angle about given vector and point.
PDMaterialPoints.unpack
— Methodunpack(d::Dict)
Unpack a dictionary into its components.
Arguments
d::Dict
: Dictionary to be unpacked.
Returns
x::Array{QF, 1}
: x coordinates.v::Array{QF, 1}
: v coordinates.y::Array{QF, 1}
: y coordinates.volume::Array{QF, 1}
: Volume of the material-point-geometry.type::Array{Int, 1}
: Type of the material-point-geometry.
PDMaterialPoints.velocity
— Methodvelocity(v::Array{QF,2}; velocity=[0.0, 0.0, 0.0])
Change velocity of particles for object by given "velocity".
Arguments
v::Array{QF,2}
: Array of material-point-geometry velocities.velocity=[0.0, 0.0, 0.0]
: Velocity vector.
Returns
v::Array{QF,2}
: Array of material-point-geometry velocities.
PDMaterialPoints.velocity
— Methodvelocity(v::Array{QF,2}; velocity=[0.0, 0.0, 0.0])
Change velocity of particles for object by given "velocity".
Arguments
v::Array{QF,2}
: Array of material-point-geometry velocities.velocity=[0.0, 0.0, 0.0]
: Velocity vector.
Returns
v::Array{QF,2}
: Array of material-point-geometry velocities.
PDMaterialPoints.velocity
— Methodvelocity(obj::T, f::Function, vel) where T <: SuperShape
Change velocity of particles for object using boolean array from function f.
Arguments
obj::T
: Object.f::Function
: Function that returns boolean array.vel
: Velocity vector.
Returns
obj::T
: Object.
PDMaterialPoints.write_data
— Methodwrite_data(filename::String, out::Dict)
Write data to a file in the following format:
N
# id, type, position, velocity, volume
1, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
2, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
3, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
4, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
5, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
where N is the number of particles, id is the particle id, type is the particle type,
position is the particle position, velocity is the particle velocity, and
volume is the particle volume.
Arguments
filename::String
: Name of the file to write to.out::Dict
: Dictionary containing the following keys::x
: Position of the particles.:v
: Velocity of the particles.:type
: Type of the particles.:volume
: Volume of the particles.
Example
using PDMaterialPoints
# Create a cube
cube = Cube(1.0, 1.0, 1.0)
# Create a dictionary of the union
out = create(cube)
# Write the data to a file
write_data("data.txt", out)
See also
PDMaterialPoints.write_data
— Methodwrite_data(filename::String, x::Matrix, v::Matrix, type::Vector, vol::Vector)
Write data to a file in the following format:
N
# id, type, position, velocity, volume
1, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
2, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
3, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
4, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
5, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
where N is the number of particles, id is the particle id, type is the particle type, position is the particle position, velocity is the particle velocity, and volume is the particle volume.
Arguments
filename::String
: Name of the file to write to.x::Matrix
: Position of the particles.v::Matrix
: Velocity of the particles.type::Vector
: Type of the particles.vol::Vector
: Volume of the particles.
see also
PDMaterialPoints.write_data
— Methodwrite_data(filename::String, obj::SuperShape; kwargs...)
Write data to a file in the following format:
N
# id, type, position, velocity, volume
1, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
2, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
3, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
4, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
5, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
where N is the number of particles, id is the particle id, type is the particle type,
position is the particle position, velocity is the particle velocity, and
volume is the particle volume.
Arguments
filename::String
: Name of the file to write to.obj::SuperShape
: Shape or post operation object to write to file.
Keyword Arguments
kwargs...
: Keyword arguments to pass tocreate
.
Example
using PDMaterialPoints
# Create a cube
cube = Cube(1.0, 1.0, 1.0)
# Write the data to a file
write_data("data.txt", cube)
See also
PDMaterialPoints.write_data_peridigm
— Methodwrite_data_peridigm(filename::String, x::Matrix, type::Vector, vol::Vector)
Write data to a file in the following format:
N
# position, type, volume
0.0, 0.0, 0.0, 1, 1.0
0.0, 0.0, 0.0, 1, 1.0
0.0, 0.0, 0.0, 1, 1.0
0.0, 0.0, 0.0, 1, 1.0
0.0, 0.0, 0.0, 1, 1.0
where N is the number of particles, type is the particle type, position is the particle position, and volume is the particle volume.
Arguments
filename::String
: Name of the file to write to.x::Matrix
: Position of the particles.type::Vector
: Type of the particles.vol::Vector
: Volume of the particles.
see also
PDMaterialPoints.set_device
— Functionset_device(device::Symbol)
Set the device to use for computations. The device can be either :cpu
or :cuda
.
Arguments
device::Symbol
: Device to use for computations.
Example
using PDMaterialPoints
# Set the device to use for computations
set_device(:cuda)
PDMaterialPoints.get_valid_device
— Functionget_valid_device(x::Symbol)
Get a valid device. If x
is :cuda
and CUDA is not available, then :cpu
is returned.
Arguments
x::Symbol
: Device to check.
PDMaterialPoints.keepit
— Functionkeepit(out, mask::BitArray)
Keep material points for object using boolean array mask.
Arguments
out
: Material point gemetry data.mask::BitArray
: Boolean array.
Returns
out
: Material point gemetry data.
PDMaterialPoints.reset_cuda
— Functionreset_cuda()
Reset the device to :cuda
. If CUDA is not available, then the device is set to :cpu
.
PDMaterialPoints.add
— Functionadd(obj1::T1, obj2::T2) where {T1<:SuperShape, T2<:SuperShape}
Add two objects.
Arguments
obj1::T1
: First object.obj2::T2
: Second object.
PDMaterialPoints.fhandle
— Functionfhandle(filename::String)
Create a file handle for a given filename.
Arguments
filename::String
: Name of the file to create.
PDMaterialPoints.SuperShape
— TypeSuperShape
Abstract type for supershapes.