mpacts.commands.misc. optimizebandwidth

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

import mpacts.commands.misc.optimizebandwidth
#or assign it to a shorter name
import mpacts.commands.misc.optimizebandwidth as opt


class mpacts.commands.misc.optimizebandwidth.OptimizeBandwidth(name, clist, contactDetector, do_reorder=True)

Bases: mpacts.core.command.PythonCommand

A python command to optimize the order in which particles are stored in an ArrayManager by reducing the “bandwidth” of the “contact matrix” using the reverse Cuthill-McKee algorithm from the networkx library. Parameters:

  • name - the name
  • clist - a command list, doesn’t need to be simulation
  • contactDetector - a contact detector that should have been already
    executed at that point (pc1==pc2 must hold)

WARNING: Further code-changes have to be done if we want to have this command generally applicable:

  • ContactStates have to be correctly copied if they exist
  • Arrays of raw indices have to listen to the “ET::Signal_Reordered”, and reorder themselves accordingly

The command is already an interesting option to execute once (at initialization) in a system with many particles that are not generated in a highly ordered fashion, or in a system without contact states and raw arrays of indices. For an example look at simulation_archive/DEM/Spheres/

OptimizeBandwidth(name, parent, **kwargs)

Returns both old and new bandwidth of the adjacency matrix WARNING: tries to construct a dense adjacency matrix, could run out of memory!