nodeHandle

class nodeHandle(nodes, t, psi, psi2=None, psi3=None)[source]

Bases: object

Creates a handle with the ability to store and updates node probability.

Parameters:
  • nodes (array of ints) – the nodes to watch (e.g. [0,1,4]).
  • t (float) – the elapsed time at handle initialization.
  • psi (petsc4py.PETSc.Vec) – vector containing the global probability for particle 1.
  • psi2 (None or petsc4py.PETSc.Vec) – vector containing the global probability for particle 2.
  • psi3 (None or petsc4py.PETSc.Vec) – vector containing the global probability for particle 3.

Warning

Note that the handle attributes/methods are not collective; if running on multiple nodes, only local values will be stored/updated on each node.

Method Summary

nodeHandle.getLocalNode(node[, p]) Get thet stored probability and timestep array for particle p at a specified node.
nodeHandle.getLocalNodes([t, p]) Get thet stored node probability and timestep array for particle p over all watched nodes.
nodeHandle.update(t, psi[, psi2, psi3]) Update the handle with node probability for an additional timestep.

Method Details

nodeHandle.getLocalNode(node, p=1)[source]

Get thet stored probability and timestep array for particle p at a specified node.

Parameters:node (int) – the node to retrieve data from.
Keyword Arguments:
 p (int) – (1,``2``,``3``) - the particle to return probability data for.
Returns:tuple of arrays : returns arrays corresponding to the times recorded (if t=None) and the probabilities over the specified node.

Example

>>> timeArray, probXArray, probYArray = nodeHandle.getLocalNodes(3)
nodeHandle.getLocalNodes(t=None, p=1)[source]

Get thet stored node probability and timestep array for particle p over all watched nodes.

Keyword Arguments:
 
  • t (None or float) – the elapsed time at which to return the node probabilities. If None, all timesteps will be returned.
  • p (int) – (1,``2``,``3``) - the particle to return probability data for.
Returns:

tuple of arrays : returns arrays corresponding to the times recorded (if t=None) and the probabilities over watched nodes.

Example

>>> timeArray, probXArray, probYArray = nodeHandle.getLocalNodes()

or

>>> probXArray, probYArray = nodeHandle.getLocalNodes(t=4)
nodeHandle.update(t, psi, psi2=None, psi3=None)[source]

Update the handle with node probability for an additional timestep.

Parameters:
  • t (float) – the elapsed time at handle update.
  • psi (petsc4py.PETSc.Vec) – vector containing the global probability for particle 1.
  • psi2 (None or petsc4py.PETSc.Vec) – vector containing the global probability for particle 2.
  • psi3 (None or petsc4py.PETSc.Vec) – vector containing the global probability for particle 3.