mpacts.core. arrays

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

import mpacts.core.arrays
#or assign it to a shorter name
import mpacts.core.arrays as arr

Array

class mpacts.core.arrays.Array

Bases: mpacts.core.baseobject.BaseObject

Raises an exception This class cannot be instantiated from Python

Array(name, parent, **kwargs)
clear((Array)arg1) → None
copy_to_array((Array)arg1, (Array)arg2) → None
create_same_array_in((Array)self, (ArrayManager)manager, (str)new_name) → Array :

Creates a new array with a given name of the same type as this array in a given ArrayManager.

get_element((Array)arg1, (object)arg2) → object
n_alive_elements((Array)self) → int :

Returns the number of alive elements. If there are dead elements: n_alive_elements() < size(),otherwise : n_alive_elements() == size().

set_array((Array)arg1, (object)arg2) → None
set_element((Array)arg1, (object)arg2, (object)arg3) → None
size((Array)arg1) → int
tolist((Array)arg1) → list

ArrayManager

class mpacts.core.arrays.ArrayManager

Bases: mpacts.core.baseobject.BaseObject

The parent item for a collection of DynamicArrays, all arrays managed by the same ArrayManager will/must have the same length.
Has no default location.
  • Optional keywords:
    • size (default value = Uninitialized) — Sets the size of all arrays managed by this arraymanager
object __init__(tuple args, dict kwds) :
args: name, parent kwds: [size]
ArrayManager(name, parent, **kwargs)
active((ArrayManager)self, (int)i) → bool :

Tests if element i is active (=not masked and not dead) (True/False).

add_element((ArrayManager)self) → int :

Returns the index of a new element that can be initialized by the client. If possible, a dead element is recycled, in which case the returned index will be smaller than size(), and size() does not change. Otherwise the arrays are resized to size()+1 and returned index is that of the last element.

add_element_copy((ArrayManager)self, (int)copyFromThisIndex) → int :

Returns the index of a new element that has been initialized as a copy of another element. If possible, a dead element is recycled, in which case the returned index will be smaller than size(), and size() does not change. Otherwise the arrays are resized to size()+1 and returned index is that of the last element.

alive((ArrayManager)self, (int)i) → bool :

Tests if element i is alive (True/False).

clear((ArrayManager)self) → None :

Destroys all arrays and content of the arrays.

create_array((ArrayManager)self, (str)content type, (str)name) → Array :

creates an array in this arraymanager.

get_array((ArrayManager)self, (str)array_name) → Array :

Identical as find_child, but casts immediately to ArrayBase. Returns None if child is not an ArrayBase

kill((ArrayManager)self, (int)i) → None :

Kills element i. Usage of this function is not recommended! Use delete_particle instead (which is much safer).

mask((ArrayManager)self, (int)i) → None :

Masks element i, causing it to no longer be calculated by commands that take the mask into account.

n_active_elements((ArrayManager)self) → int :

Returns the number of active elements in the simulation. This is the number of particles that are unmasked and are actually being simulated.

n_alive_elements((ArrayManager)self) → int :

Returns the number of alive elements. If there are dead elements: n_alive_elements() < size(),otherwise : n_alive_elements() == size().

pack((ArrayManager)self) → int :

Removes all dead elements and makes the array compact again. Post condition = size()==n_alive_elements().This invalidates all existing indices to the elements in this arraymanager.As a result, usage of this function will destroy almost all simulations.Do not use, unless you are sure about what you want to do!

reorder_with_new_positions((ArrayManager)self, (Array)positions) → None :

Reorders all arrays in the ArrayManager with ‘positions’, equivalent to: for( i=0; i<n; ++i )

Anew[position[i]] = A[i];
reorder_with_old_positions((ArrayManager)self, (Array)positions) → None :

Reorders all arrays in the ArrayManager with ‘positions’, equivalent to: for( i=0; i<n; ++i )

Anew[i] = A[positions[i]];
resize((ArrayManager)arg1, (int)self) → None :

Resizes the arrays of this ArrayManager.

size((ArrayManager)self) → int :

Returns the size of the arrays managed by the ArrayManager

unmask((ArrayManager)self, (int)i) → None :

Unmasks element i, causing it to be active again and calculated by all commands.

Array_ArrayManagers

class mpacts.core.arrays.Array_ArrayManagers

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of arraymanagers (needed for support of conjugate gradient)
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_ArrayManagers(name, parent, **kwargs)

Array_BaseObjects

class mpacts.core.arrays.Array_BaseObjects

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of BaseObjects
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_BaseObjects(name, parent, **kwargs)

Array_ContactDataStorage

class mpacts.core.arrays.Array_ContactDataStorage

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of ContactDataStorage (needed for support of conjugate gradient)
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_ContactDataStorage(name, parent, **kwargs)

Array_ContactModel

class mpacts.core.arrays.Array_ContactModel

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of ContactModels
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_ContactModel(name, parent, **kwargs)

Array_Index

class mpacts.core.arrays.Array_Index

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of indices (unsigned int) instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Index(name, parent, **kwargs)

Array_Int

class mpacts.core.arrays.Array_Int

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of int instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Int(name, parent, **kwargs)

Array_LUT2Scalar

class mpacts.core.arrays.Array_LUT2Scalar

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of 2D lookuptables returning scalars
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_LUT2Scalar(name, parent, **kwargs)

Array_LineIndex

class mpacts.core.arrays.Array_LineIndex

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of LineIndices instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_LineIndex(name, parent, **kwargs)

Array_LongIndex

class mpacts.core.arrays.Array_LongIndex

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of long indices (long long int) instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_LongIndex(name, parent, **kwargs)

Array_Matrix

class mpacts.core.arrays.Array_Matrix

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of matrices (3x3) (unsigned int) instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Matrix(name, parent, **kwargs)

Array_Point

class mpacts.core.arrays.Array_Point

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of points instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Point(name, parent, **kwargs)

Array_QuadIndex

class mpacts.core.arrays.Array_QuadIndex

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of QuadIndices instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_QuadIndex(name, parent, **kwargs)

Array_Quaternion

class mpacts.core.arrays.Array_Quaternion

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of quaternions instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Quaternion(name, parent, **kwargs)

Array_Scalar

class mpacts.core.arrays.Array_Scalar

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of scalars instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Scalar(name, parent, **kwargs)

Array_String

class mpacts.core.arrays.Array_String

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of std::string instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_String(name, parent, **kwargs)

Array_SymmetricMatrix

class mpacts.core.arrays.Array_SymmetricMatrix

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of symmetric matrices (3x3) (unsigned int) instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_SymmetricMatrix(name, parent, **kwargs)

Array_TriangleIndex

class mpacts.core.arrays.Array_TriangleIndex

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of TriangleIndices instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_TriangleIndex(name, parent, **kwargs)

Array_UnsignedLong

class mpacts.core.arrays.Array_UnsignedLong

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of unsigned long instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_UnsignedLong(name, parent, **kwargs)

Array_Vector

class mpacts.core.arrays.Array_Vector

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of vectors instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_Vector(name, parent, **kwargs)

Array_VectorIndex

class mpacts.core.arrays.Array_VectorIndex

Bases: mpacts.core.arrays.Array, mpacts.core.baseobject.BaseObject

Array of std::vector of indices instantation (can also be created with ‘create_array’ factory
Has no default location.
object __init__(tuple args, dict kwds) :
args: name, parent kwds:
Array_VectorIndex(name, parent, **kwargs)
mpacts.core.arrays.create_array((str)content type, (str)name, (ArrayManager)mgr) → Array
mpacts.core.arrays.registerCommonTypes() → None