mpacts.commands.onarrays. transfer

In order to be able to use this module import it like this:

import mpacts.commands.onarrays.transfer
#or assign it to a shorter name
import mpacts.commands.onarrays.transfer as tra

AddToDataFromGhostCommand

class mpacts.commands.onarrays.transfer.AddToDataFromGhostCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

A command that will add the value of specific user defined arrays in the target manager to the arrays with the same name (and type) in the pc manager.
Has no default location.
  • Required keywords:
    • add_these_arrays — Arrays that need to get the ghost data added to them
    • pc — Particle container on which the command is applied
    • target — The ghost array from which we want to add the data to our data
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, target, add_these_arrays, [gate, predicate]
AddToDataFromGhostCommand(name, parent, **kwargs)

AverageSegmentValueFromNodesCommand

class mpacts.commands.onarrays.transfer.AverageSegmentValueFromNodesCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Averages the (scalar) value of the nodes to a segment value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • NodeArray — Array of the nodes that will be used to average from
    • SegmentArray — Array (currently scalars only) of the Segments that will be used to average to
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: SegmentArray, NodeArray, [gate]
AverageSegmentValueFromNodesCommand(name, parent, **kwargs)

AverageSegmentValueFromNodesForSymmetricMatrixCommand

class mpacts.commands.onarrays.transfer.AverageSegmentValueFromNodesForSymmetricMatrixCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Averages the Symmetric Matrix of the nodes to a segment value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • NodeArray — Array of the nodes that will be used to average from
    • SegmentArray — Array (currently scalars only) of the Segments that will be used to average to
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: SegmentArray, NodeArray, [gate]
AverageSegmentValueFromNodesForSymmetricMatrixCommand(name, parent, **kwargs)

AverageSegmentValueFromNodesForVectorCommand

class mpacts.commands.onarrays.transfer.AverageSegmentValueFromNodesForVectorCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Averages the (vector) value of the nodes to a segment value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • NodeArray — Array of the nodes that will be used to average from
    • SegmentArray — Array (currently scalars only) of the Segments that will be used to average to
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: SegmentArray, NodeArray, [gate]
AverageSegmentValueFromNodesForVectorCommand(name, parent, **kwargs)

ComputeNodeValuesFromTrianglesCommand

class mpacts.commands.onarrays.transfer.ComputeNodeValuesFromTrianglesCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Computes the weighted average of the triangles’ values as the node values (weighted with the generalized Voronoi-area in each triangle)
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing triangles that surround each node.
    • value_nodes — Array with values in nodes; to be set by this functor
    • value_triangles — Array with values in triangles
  • Optional keywords:
    • conserve_sum (default value = 0) — If true, the total sum of all the nodes values will be equal to the sum of the triangle values. Note: this is usually NOT what you want for field variables.
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate deciding whether the command should be executed for a given particle; if given it checks on the triangle-manager!
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, triangles, value_triangles, value_nodes, [gate, predicate, conserve_sum]
ComputeNodeValuesFromTrianglesCommand(name, parent, **kwargs)

ComputeTriangleValuesFromNodesCommand

class mpacts.commands.onarrays.transfer.ComputeTriangleValuesFromNodesCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Computes the weighted average of the nodes’ values as the triangle values (weighted with the generalized Voronoi-area in each triangle)
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • value_nodes — Array with values in nodes
    • value_triangles — Array with values in triangles; to be set by this functor
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, value_triangles, value_nodes, [gate, predicate]
ComputeTriangleValuesFromNodesCommand(name, parent, **kwargs)

CopyArrayCommand

class mpacts.commands.onarrays.transfer.CopyArrayCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Copies the contents of one array to the contents of another array which is given by the user.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • copy_from — Array of which the values should be copied to ‘copy_to
    • copy_to — Array to which the values in ‘copy_from’ should be copied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: copy_from, copy_to, [gate, predicate]
CopyArrayCommand(name, parent, **kwargs)

CopyArrayToGhostCommand

class mpacts.commands.onarrays.transfer.CopyArrayToGhostCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

A command that will copy a single data array in the pc to the target, using the target’s __source_idx array to link the indices in both particle containers to each other.
Has no default location.
  • Required keywords:
    • pc — Particle container on which the command is applied
    • source — The single original array we want to copy the data from
    • target — The single ghost array we want to copy the data to. Needs to be in a Ghost particle manager!
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, target, source, [gate, predicate]
CopyArrayToGhostCommand(name, parent, **kwargs)

CopyDataToGhostCommand

class mpacts.commands.onarrays.transfer.CopyDataToGhostCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

A command that will copy all data arrays in the pc to the target, using the targets __source_idx array to link the indices in both particle containers to each other.
Has no default location.
  • Required keywords:
    • pc — Particle container on which the command is applied
    • target — The ghost array manager to which we want to copy the data
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, target, [gate, predicate]
CopyDataToGhostCommand(name, parent, **kwargs)

CropIndicesCommand

class mpacts.commands.onarrays.transfer.CropIndicesCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Indices per particle are ‘cropped’ to the smallest unique version of them. i.e. (1,4,10,10,4) -> (1,2,3,3,2)
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_from — Array with the uncropped indices
    • array_to — Array with the cropped indices (output)
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, array_from, array_to, [gate, predicate]
CropIndicesCommand(name, parent, **kwargs)

DistributeArrayFromParentToChild

class mpacts.commands.onarrays.transfer.DistributeArrayFromParentToChild

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Distributes an array from a parent to a specified child particle container. Each child particle gets the value of the corresponding parent particle, divided by the number of children for that given parent
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_child — Array to which the parent array should be distributed
    • array_count — Array in which the number of particles per parent is counted
    • array_parent — Parent array which will keep the sum
    • pc — Particle Container
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Optional predicate
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array_child, array_parent, array_count, pc, [gate, predicate]
DistributeArrayFromParentToChild(name, parent, **kwargs)

DistributeSegmentForceMomentToNodeForceCommand

class mpacts.commands.onarrays.transfer.DistributeSegmentForceMomentToNodeForceCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Distributes a force (F) and a moment (M) that are exerted on a position (x) on a capsule/segment to unique pure forces (F) at the node ends, usually the degrees of freedom. If no array with points of force/moment application is provided, we assume they are applied on the center of mass of the segment.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
    • x_segment (default value = None) — Array with position per segment where force and moment is applied. If not given, we will assume the center of the segment (x1+x2)/2.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate, x_segment]
DistributeSegmentForceMomentToNodeForceCommand(name, parent, **kwargs)

InheritRotationb2iCommand

class mpacts.commands.onarrays.transfer.InheritRotationb2iCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Inherits the rotation of a specified rigid body, transfering from body to inertial frame coordinates. This command need two arrays of the same type, pc of the rotating rigid body and the index of the rotating body.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • Rotor — Particle container in which we will look for the q and center of rotation of the rotor
    • arrayBF — Array expressed in the body reference frame of ‘Rotor’
    • array — Array expressed in the inertial reference frame
    • idx — Index of rigid body particle from which our particles will inherit their rotation
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array, arrayBF, idx, Rotor, [gate]
InheritRotationb2iCommand(name, parent, **kwargs)

InheritRotationi2bCommand

class mpacts.commands.onarrays.transfer.InheritRotationi2bCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Inherits the rotation of a specified rigid body, transfering from inertial to body frame coordinates. This command need two arrays of the same type, pc of the rotating rigid body and the index of the rotating body.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • Rotor — Particle container in which we will look for the q and center of rotation of the rotor
    • arrayBF — Array expressed in the body reference frame of ‘Rotor’
    • array — Array expressed in the inertial reference frame
    • idx — Index of rigid body particle from which our particles will inherit their rotation
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array, arrayBF, idx, Rotor, [gate]
InheritRotationi2bCommand(name, parent, **kwargs)

NormalizeParentArrayWithChildCount

class mpacts.commands.onarrays.transfer.NormalizeParentArrayWithChildCount

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Normalizes a parent array with the number of particles per parent: i.e. array_i = array_i / N_children_i. The count array should be provided by the user (see also CountPerParentCommand).
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_count — Array in which the number of particles per parent is counted
    • array — Array normalize with count array
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array, array_count, [gate, predicate]
NormalizeParentArrayWithChildCount(name, parent, **kwargs)

ReflectSphereCommand

class mpacts.commands.onarrays.transfer.ReflectSphereCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

A command that will reflect the ‘x’ array of the pc to the other side of a given sphere, at a radial position r-width. Should be used for creating periodic boundaries around a sphere.
Has no default location.
  • Required keywords:
    • pc — Particle container on which the command is applied
    • radius — Radius of the sphere beyond which particles will be reflected to the other side at position radius-width
    • width — Width of the ‘reflection zone’ of the reflecting sphere (Note that this zone is always below radius!)
  • Optional keywords:
    • center (default value = 0 0 0) — Center postion of the sphere, default = (0,0,0)
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, radius, width, [gate, predicate, center]
ReflectSphereCommand(name, parent, **kwargs)

SumArrayToParentCommand

class mpacts.commands.onarrays.transfer.SumArrayToParentCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Sums up elements in child array and adds them up into the parent array according to the parentParticleIndex map. Warning: Does not Zero the parent array!
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_parent — Parent array which will keep the sum
    • array — Array to be summed up to parent
    • pc — Particle Container
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
    • weights (default value = None) — Weights (scalar) with which ‘array’ will be multiplied before summation.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array, array_parent, pc, [gate, weights, predicate]
SumArrayToParentCommand(name, parent, **kwargs)

TrackParentPositionCommand

class mpacts.commands.onarrays.transfer.TrackParentPositionCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Uses the position of parent to set the position of the particle according to corresponding weights.
Default location: ‘loop_cmds/post_integration_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • weights — Array with the weights of the parents nodes - one weight per node.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • parentIndices (default value = None) — Array with indices of triangles to which we are attached. If not provided uses the array ‘segmentIndex’ by default.
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, weights, [gate, predicate, parentIndices]
TrackParentPositionCommand(name, parent, **kwargs)

TrackParentPositionCommand_Triangle

class mpacts.commands.onarrays.transfer.TrackParentPositionCommand_Triangle

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Uses the position of parent to set the position of the particle according to corresponding weights.
Default location: ‘loop_cmds/post_integration_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • weights — Array with the weights of the parents nodes - one weight per node.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • parentIndices (default value = None) — Array with indices of triangles to which we are attached. If not provided uses the array ‘triangleIndex’ by default.
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, weights, [gate, predicate, parentIndices]
TrackParentPositionCommand_Triangle(name, parent, **kwargs)

TransferArrayFromParentToChild

class mpacts.commands.onarrays.transfer.TransferArrayFromParentToChild

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Transfers an array from a parent to a specified child particle container. This can be used to visualize, for instance, forces from the Rigid Body in Paraview.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_child — The array that will be given the value of the corresponding particle array, using the parentIndex in the manager of array_child
    • array_parent — The parent array that will be used to provide the value of the corresponding child particles.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array_child, array_parent, [gate]
TransferArrayFromParentToChild(name, parent, **kwargs)

TransferControlPointsToParticleCommand

class mpacts.commands.onarrays.transfer.TransferControlPointsToParticleCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Command for computing the center point of Rigid Spheres based on its control point (so basically just copying the control point).
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • x — Array with control point positions
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, x, [gate, predicate]
TransferControlPointsToParticleCommand(name, parent, **kwargs)

TransferForcesToDofCommand

class mpacts.commands.onarrays.transfer.TransferForcesToDofCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Transfers forces on controlpoints to Forces and Moments on the degrees of freedom (DOF) of a particle. ‘pc’ should be the controlpoints manager. ‘x’ array should be intertial frame co-oordinates!
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate]
TransferForcesToDofCommand(name, parent, **kwargs)

TransferVelocityToControlPointsCommand

class mpacts.commands.onarrays.transfer.TransferVelocityToControlPointsCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Transfers velocity and angular velocity of parent particles to corresponding velocities of the rigid body control points.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • ignore_w (default value = 0) — If ‘true’, the angular velocity ‘w’ will NOT be taken into account.
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate, ignore_w]
TransferVelocityToControlPointsCommand(name, parent, **kwargs)

TranslateParticlesCommand

class mpacts.commands.onarrays.transfer.TranslateParticlesCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

A command that will apply a given offset to the ‘x’ array of the pc, if the predicate is satisfied.This command could for instance be used to ‘recycle’ particles, whitout add/delete operations.
Has no default location.
  • Required keywords:
    • offset — The offset that is applied to particles that conform to the predicate.
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, offset, [gate, predicate]
TranslateParticlesCommand(name, parent, **kwargs)