mpacts.commands.monitors. checkpredicate

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

import mpacts.commands.monitors.checkpredicate
#or assign it to a shorter name
import mpacts.commands.monitors.checkpredicate as che

PredicateCounterCommand

class mpacts.commands.monitors.checkpredicate.PredicateCounterCommand

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

Counts the number of ‘True’ evaluations for a given predicate in a particle container
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)
    • 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.
  • Read only properties:
    • count — Value which keeps the count of ‘True’ evaluations of the given predicate.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate]
PredicateCounterCommand(name, parent, **kwargs)

StopWhenPcEmptyCommand

class mpacts.commands.monitors.checkpredicate.StopWhenPcEmptyCommand

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

Stops if a given Particle Container has size 0 (i.e. is empty).
Default location: ‘loop_cmds/stop_loop_cmds’
  • Required keywords:
    • pc — Particle container which stops the simulation if empty
  • 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: pc, [gate]
StopWhenPcEmptyCommand(name, parent, **kwargs)

StopWhenPredicateAllCommand

class mpacts.commands.monitors.checkpredicate.StopWhenPredicateAllCommand

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

Command which terminates the simulation when, for a given array manager, a given predicate evaluates to ‘True’ for all particles in that manager. Note that you should ‘run_until_done’ on the simulation in order to use this.
Default location: ‘loop_cmds/stop_loop_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • predicate — Predicate deciding whether the command should be executed for a given particle.
  • 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: predicate, pc, [gate]
StopWhenPredicateAllCommand(name, parent, **kwargs)

StopWhenPredicateAnyCommand

class mpacts.commands.monitors.checkpredicate.StopWhenPredicateAnyCommand

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

Command which terminates the simulation when, for a given array manager, a given predicate evaluates to ‘True’ for at least ONE particle in that manager. Note that you should ‘run_until_done’ on the simulation in order to use this.
Default location: ‘loop_cmds/stop_loop_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]
StopWhenPredicateAnyCommand(name, parent, **kwargs)

StoreIndexCommand

class mpacts.commands.monitors.checkpredicate.StoreIndexCommand

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

Stores the indices of all elements for which the given predicate evaluates to ‘True’.
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)
    • 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.
    • reset (default value = 1) — If ‘True’ (default), the array of indices will be cleared before each execution of this command. Warning: If ‘False’, this might lead to a very large indices array. Use at your own risk.
  • Read only properties:
    • indices_manager — Local array manager for book-keeping that only keeps the indices array.
    • indices — Indices of elements for which given predicate evaluated to True.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate, reset]
StoreIndexCommand(name, parent, **kwargs)