mpacts.core. indextranslator

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

import mpacts.core.indextranslator
#or assign it to a shorter name
import mpacts.core.indextranslator as ind

IndexTranslator

class mpacts.core.indextranslator.IndexTranslator

Bases: mpacts.core.baseobject.BaseObject

Class that provides translation between local indices (assuming the particle is the only particle in the particle container) and global indices (the index taking into account the other particles in the particlecontainer with different parentParticles.
Has no default location.
  • Optional keywords:
    • translator_map (default value = std::map<unsigned int, std::map<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::map<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > > > > > cannot be printed.) — The map that stores the necessary information for translating global to local indices (and vice versa). It is not recommended to use this property at all, exposed for persistance reasons only
object __init__(tuple args, dict kwds) :
args: name, parent kwds: [translator_map]
IndexTranslator(name, parent, **kwargs)
add_element((IndexTranslator)self, (int)parentIndex) → int :

Adds a new particle to the given parentParticleIndex

add_element_copy((IndexTranslator)self, (int)parentIndex, (int)copyfrom) → int :

Adds a new particle to the given parentParticleIndex, and copies all data from an existing particle

global_to_local_index((IndexTranslator)self, (int)globalindex) → int :

Takes a global index and translates it into a localindex

global_to_parent_particle_index((IndexTranslator)self, (int)globalindex) → int :

Takes a global index and returs the corresponding parentparticle index

kill_subparticle((IndexTranslator)self, (int)parentIndex) → None :

Removes all particles with the same parentIndex

kill_with_global((IndexTranslator)self, (int)globalindex) → None :

Removes a particle with the given globalindex

local_to_global_index((IndexTranslator)arg1, (int)self, (int)parentIndex, localindex) → int :

takes a localindex and a parentIndex and translates it into a global index

reparent((IndexTranslator)self, (int)globalindex, (int)parentIndex) → None :

Assigns an element of the arraymanager to a new parent particle by changing its parentIndex and localIndex, while keeping its globalindex

subparticle_count((IndexTranslator)self, (int)parentIndex) → int :

Takes a global index and translates it into a localindex