v_sim.NodeArray

g GObject.GInterface GObject.GInterface v_sim.Maskable v_sim.Maskable GObject.GInterface->v_sim.Maskable GObject.Object GObject.Object v_sim.NodeArray v_sim.NodeArray GObject.Object->v_sim.NodeArray v_sim.Maskable->v_sim.NodeArray

Subclasses:

v_sim.Data

Methods

Inherited:

GObject.Object (37), v_sim.Maskable (3)

Structs:

GObject.ObjectClass (5)

allocate (elements, nNodes)

allocateByNames (nNodesPerElement, elementNames)

allocateNodesForElement (eleId, nNodes)

compareElements (data2)

completeAdding ()

completeMoving ()

containsElement (element)

copyNode (node)

freeNodes ()

freeProperty (key)

getElement (node)

getElementId (element)

getFromId (number)

getNElements (physical)

getNNodes ()

getNOriginalNodes ()

getNewNode (element)

getNewNodeForId (iEle)

getOriginal (nodeId)

getProperty (key)

iterNext (iter)

iterNextArray (iter)

iterNextElement (iter, allowEmpty)

iterNextList (iter)

iterNextNode (iter)

iterNextNodeNumber (iter)

iterNextNodeOriginal (iter)

iterNextVisible (iter)

iterRestartNode (iter)

iterStart (iter)

iterStartArray (arr)

iterStartList (lst)

iterStartNumber (iter)

iterStartVisible (iter)

iterWhere (where, *data)

iter_new ()

join (frag, at)

moveNode (id, at)

moveNodes (ids, xyz)

property_newFloatArray (key, len)

property_newInteger (key)

property_newPointer (key, freeFunc, newAndCopyFunc, *user_data)

removeAllDuplicateNodes ()

removeNodes (nodeNumbers)

removeNodesOfElement (element)

rotateNodes (ids, axis, center, angle)

setElement (node, element)

setNodeVisibility (id, status)

setOriginal (nodeId)

shiftNode (id, delta)

shiftNodes (ids, delta)

startAdding ()

startMoving ()

switchNumber (from_, to)

traceProperty (id)

Virtual Methods

Inherited:

GObject.Object (7), v_sim.Maskable (1)

Properties

Name

Type

Flags

Short Description

elements

GLib.Array

r

all elements

n-nodes

int

r

total number of nodes

n-original-nodes

int

r

total number of original nodes

Signals

Inherited:

GObject.Object (1), v_sim.Maskable (1)

Name

Short Description

ElementMaskableChanged

Gets emitted when the maskable characteristic of one element changes.

ElementVisibilityChanged

Gets emitted when the visibility characteristic of one element changes.

PopulationDecrease

Gets emitted when the number of nodes has changed, decreasing.

PopulationIncrease

Gets emitted when the number of nodes has changed, increasing.

position-changed

Gets emitted when one or more nodes have moved, because of translations or because the user has moved them manually.

Fields

Inherited:

GObject.Object (1), v_sim.Maskable (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class v_sim.NodeArray(**kwargs)
Bases:

GObject.Object, v_sim.Maskable

Abstract:

No

Structure:

v_sim.NodeArrayClass

Opaque structure representing array of nodes object.

allocate(elements, nNodes)
Parameters:
  • elements ([v_sim.Element]) – the size of nNodes.

  • nNodes ([int]) – an array giving the number of nodes per element.

Reallocate the internal arrays to match elements and nNodes.

allocateByNames(nNodesPerElement, elementNames)
Parameters:

This method allocates the storing part of the given v_sim.NodeArray structure and store all the v_sim.Nodes.

allocateNodesForElement(eleId, nNodes)
Parameters:

This routine is used to allocate space for nNodes of a v_sim.Element. This v_sim.Element is identified by its internal id, see v_sim.NodeArray.getElementId(). If this v_sim.Element has already enough space in this self, nothing is done, otherwise space is reallocated.

New in version 3.7.

compareElements(data2)
Parameters:

data2 (v_sim.NodeArray) – an other v_sim.Data object.

Returns:

True if the two objects contains exactly the same v_sim.Element objects (not one more or one less or one different), False otherwise.

Return type:

bool

This method is used to compare the composition of the given two v_sim.Data objects. The test is only done on v_sim.Element lists.

completeAdding()

After new nodes have been added, call this routine to ensure that proper signals are emitted. See v_sim.NodeArray.startAdding() to start a bunch addition of new nodes.

New in version 3.8.

completeMoving()

After new nodes have been moved, call this routine to ensure that proper signals are emitted. See v_sim.NodeArray.startMoving() to start a bunch movements of new nodes.

New in version 3.8.

containsElement(element)
Parameters:

element (v_sim.Element) – a v_sim.Element object.

Returns:

True, if self contains element.

Return type:

bool

Tests if element is contained in self. element may be part of self but without nodes.

New in version 3.8.

copyNode(node)
Parameters:

node (v_sim.Node) – a node of the given v_sim.NodeArray.

Returns:

the location of a newly used node.

Return type:

v_sim.Node

Return the location of an unstored node that is the deep copy of the given node. The returned node is then added in the list of used nodes.

freeNodes()

Deallocate all nodes of the object and related properties but keep the object alive.

freeProperty(key)
Parameters:

key (str) – the name of the property to be removed.

This method free the given property and all associated data.

getElement(node)
Parameters:

node (v_sim.Node) – a v_sim.Node of this array.

Returns:

a v_sim.Element, owned by V_Sim.

Return type:

v_sim.Element

This routine gets the v_sim.Element the node belongs to.

New in version 3.7.

getElementId(element)
Parameters:

element (v_sim.Element) – a v_sim.Element object.

Returns:

a positive number or -1 if not found.

Return type:

int

This routines returns the internal id used to represent element, or -1 if not found.

New in version 3.7.

getFromId(number)
Parameters:

number (int) – an integer.

Returns:

the found v_sim.Node or None if none corresponds to number.

Return type:

v_sim.Node

This methods retrieves the v_sim.Node identified by the integer number. The number must be strictly positive. No error is raised if no node corresponds to the given number.

getNElements(physical)
Parameters:

physical (bool) – a boolean.

Returns:

a positive number.

Return type:

int

The parameter self stores several v_sim.Node of v_sim.Element. This routine is used to get the number of v_sim.Element that are used by this self. Depending on physical value, the number of v_sim.Element representing physical element or not is retrieved. The actual returned number of v_sim.Element take into account only elements with a positive number of nodes.

New in version 3.7.

getNNodes()
Returns:

a positive number.

Return type:

int

This routines returns the number of v_sim.Node stored in self.

New in version 3.7.

getNOriginalNodes()
Returns:

a positive number.

Return type:

int

This routines returns the number of original v_sim.Node stored in self.

New in version 3.7.

getNewNode(element)
Parameters:

element (v_sim.Element) – a v_sim.Element object.

Returns:

the location of a newly used node.

Return type:

v_sim.Node

Return the location of an unstored node for the given v_sim.Element. The returned node is then added in the list of used nodes.

New in version 3.8.

getNewNodeForId(iEle)
Parameters:

iEle (int) – the id used in self to index a v_sim.Element.

Returns:

the location of a newly used node.

Return type:

v_sim.Node

Return the location of an unstored node for the given v_sim.Element. The returned node is then added in the list of used nodes.

getOriginal(nodeId)
Parameters:

nodeId (int) – a node id.

Returns:

the original node index or -1 if nodeId is original.

Return type:

int

Test if the given nodeId is an original or a replica for the periodisation.

getProperty(key)
Parameters:

key (str) – a string.

Returns:

a v_sim.NodeProperty.

Return type:

v_sim.NodeProperty

This method is used to retrieve the node property associated to the given key.

iterNext(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node and element internal pointers to the next node, or None if none remains.

iterNextArray(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node and element internal pointers to the next node from the starting array, or None if none remains.

New in version 3.8.

iterNextElement(iter, allowEmpty)
Parameters:

Modify element internal pointer to the next element and set node to the first one, or None if none remains. If allowEmpty is True, this iterator may return an element with no nodes, otherwise, it skips elements with no nodes.

iterNextList(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node and element internal pointers to the next node from the starting list, or None if none remains.

New in version 3.7.

iterNextNode(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node internal pointer to the next node, or None if none remains. Contrary to v_sim.NodeArray.iterNext() it does not go to the next element if one exists.

iterNextNodeNumber(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node internal pointer to the next node, increasing the id of the current node. The element internal pointer is also updated accordingly. If no more nodes exist after the given one, node and element internal pointers are set to None.

iterNextNodeOriginal(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Modify node internal pointer to the next original node, or None if none remains. Contrary to v_sim.NodeArray.iterNext() it does not go to the next element if one exists.

New in version 3.6.

iterNextVisible(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Go to the next rendered node (changing element if required).

iterRestartNode(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

The element internal pointer must be associated. Then, it returns the node pointer to the first node for this element.

iterStart(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Initialise the node and element internal pointers for a run over the nodes.

iterStartArray(arr)
Parameters:

arr ([int]) – an array of node ids to iterate on.

Returns:

an alocated iterator.

Return type:

iter: v_sim.NodeArrayIter

Set values to a v_sim.NodeArrayIter object to iterate over nodes of the given array.

New in version 3.8.

iterStartList(lst)
Parameters:

lst ([int]) – a list of node ids to iterate on.

Returns:

an alocated iterator.

Return type:

iter: v_sim.NodeArrayIter

Set values to a v_sim.NodeArrayIter object to iterate over nodes of the given list.

New in version 3.7.

iterStartNumber(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Initialise the node and element internal pointers for a run following the node oder.

iterStartVisible(iter)
Parameters:

iter (v_sim.NodeArrayIter) – a v_sim.NodeArrayIter object.

Initialise the node and element internal pointers for a run over the visible nodes (see v_sim.NodeArray.iterNextVisible).

iterWhere(where, *data)
Parameters:
Returns:

an alocated iterator.

Return type:

iter: v_sim.NodeArrayIter

Starts iter to iterate on nodes of self, when the condition defined by where evaluates to True. iter is then to be used with v_sim.NodeArray.iterNextArray().

New in version 3.8.

iter_new()
Returns:

an alocated iterator.

Return type:

iter: v_sim.NodeArrayIter

Set values to a v_sim.NodeArrayIter object to iterate over nodes. Its contain is initialised with the array size (number of elements, number of nodes per element…).

join(frag, at)
Parameters:
Returns:

the ids of the added nodes in self.

Return type:

[int]

Add all nodes from frag to self and position them centred at at.

New in version 3.8.

moveNode(id, at)
Parameters:
  • id (int) – a node id.

  • at ([float]) – a position in cartesian coordinates.

Move the node id at the posityion at given in cartesian coordinates. If several nodes should be moved, consider using v_sim.NodeArray.moveNodes() or encapsulate the calls within v_sim.NodeArray.startMoving() and v_sim.NodeArray.completeMoving().

New in version 3.8.

moveNodes(ids, xyz)
Parameters:
  • ids ([int]) – a set of v_sim.Node ids.

  • xyz ([float]) – a set of cartesian displacements.

Apply translations on all nodes defined by ids. Displacements are read from xyz which is an array containing as many float triplets as nodes in ids.

New in version 3.8.

property_newFloatArray(key, len)
Parameters:
  • key (str) – a string ;

  • len (int) – the number of floats to be stored per node.

Returns:

the newly created v_sim.NodeProperty object or the existing one.

Return type:

v_sim.NodeProperty

This method creates and allocates a new area to store nodes associated data that can be retrieve with the key. These data are constant float arrays of length len.

If the property already exists, it is returned.

New in version 3.8.

property_newInteger(key)
Parameters:

key (str) – a string.

Returns:

the newly created v_sim.NodeProperty object.

Return type:

v_sim.NodeProperty

This method creates and allocates a new area to store nodes associated integer values. This is the same than v_sim.NodeArray.property_newPointer() but for static integers instead of pointers as data.

property_newPointer(key, freeFunc, newAndCopyFunc, *user_data)
Parameters:
  • key (str) – a string ;

  • freeFunc (GLib.Func or None) – a method to free each token (can be None).

  • newAndCopyFunc (GLib.CopyFunc) – a method to create or copy each token.

  • user_data (object or None) – a user defined pointer that will be given to the free and copy routine.

Returns:

the newly created v_sim.NodeProperty object or the existing one.

Return type:

v_sim.NodeProperty

This method creates and allocates a new area to store nodes associated data that can be retrieve with the key. These data are pointers on allocated memory locations. When the property is removed with the #visu_node_freePropertry (or the associated v_sim.NodeArray is free) the area is free and freeFunc is called for each token (or GLib.free() if freeFunc is None).

The method newAndCopyFunc is used when the number of nodes is increased, if the const object of the GLib.CopyFunc is not None, then we require a copy, if it is None, then the routine must create a new token with default values.

If the property already exists, it is returned.

removeAllDuplicateNodes()
Returns:

True if some nodes have been removed.

Return type:

bool

Remove all nodes that are not original in the box.

removeNodes(nodeNumbers)
Parameters:

nodeNumbers ([int]) – an array of integers (negative terminated).

Remove the given v_sim.Node from the self. The properties are also updated.

removeNodesOfElement(element)
Parameters:

element (v_sim.Element) – a v_sim.Element object.

Remove all the v_sim.Node from the element element. The properties are also updated.

New in version 3.7.

rotateNodes(ids, axis, center, angle)
Parameters:
  • ids ([int]) – a set of v_sim.Node ids.

  • axis ([float]) – an axis orientation.

  • center ([float]) – point coordinates.

  • angle (float) – an angle in degrees.

Apply the rotation defined by angle along axis passing by center to all nodes referenced in ids.

New in version 3.8.

setElement(node, element)
Parameters:
Returns:

the new location of the v_sim.Node.

Return type:

v_sim.Node

Change the nature of the v_sim.Element of node to be element.

New in version 3.8.

setNodeVisibility(id, status)
Parameters:
  • id (int) – a node id.

  • status (bool) – a boolean.

Returns:

True if visibility of node id is indeed changed.

Return type:

bool

Change the visibility of node id in self. If id is out of bound, nothing is done and no error raised. If visibility is indeed changed, then v_sim.NodeArray ::VisibilityChanged signal is emitted.

New in version 3.8.

setOriginal(nodeId)
Parameters:

nodeId (int) – a node id.

Returns:

True if nodeId was not original.

Return type:

bool

Make nodeId an original node.

shiftNode(id, delta)
Parameters:
  • id (int) – a node id.

  • delta ([float]) – a shift in cartesian coordinates.

Move the node id of the quantity delta given in cartesian coordinates. If several nodes should be shifted, consider using v_sim.NodeArray.shiftNodes() or encapsulate the calls within v_sim.NodeArray.startMoving() and v_sim.NodeArray.completeMoving().

New in version 3.8.

shiftNodes(ids, delta)
Parameters:
  • ids ([int]) – a set of v_sim.Node ids.

  • delta ([float]) – a shift in cartesian coordinates.

Apply delta on the coordinates of every nodes in ids.

New in version 3.8.

startAdding()

Begin to accumulate the node ids that are added to the structure. When addition is finished, call v_sim.NodeArray.completeAdding() to ensure completion and emit signals.

New in version 3.8.

startMoving()

Begin to accumulate the node ids that are moved in the structure. When moving is finished, call v_sim.NodeArray.completeMoving() to ensure completion and emit signals.

New in version 3.8.

switchNumber(from_, to)
Parameters:
  • from (int) – a node id.

  • to (int) – another node id.

Returns:

True if number is switched.

Return type:

bool

Two nodes of self switches their number.

New in version 3.6.

traceProperty(id)
Parameters:

id (str) – a property name.

This is a debug method. It outputs on stderr the values for all nodes of the property id.

Signal Details

v_sim.NodeArray.signals.ElementMaskableChanged(node_array, ele)
Signal Name:

ElementMaskableChanged

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

Gets emitted when the maskable characteristic of one element changes.

New in version 3.8.

v_sim.NodeArray.signals.ElementVisibilityChanged(node_array, ele)
Signal Name:

ElementVisibilityChanged

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

Gets emitted when the visibility characteristic of one element changes.

New in version 3.8.

v_sim.NodeArray.signals.PopulationDecrease(node_array, ids)
Signal Name:

PopulationDecrease

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

Gets emitted when the number of nodes has changed, decreasing. ids contains all removed ids. When emitted, nodes have already been removed, so no external routines should keep pointers on these nodes.

New in version 3.4.

v_sim.NodeArray.signals.PopulationIncrease(node_array, ids)
Signal Name:

PopulationIncrease

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

Gets emitted when the number of nodes has changed, increasing. ids contains all new ids.

New in version 3.4.

v_sim.NodeArray.signals.position_changed(node_array, ids)
Signal Name:

position-changed

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:
  • node_array (v_sim.NodeArray) – The object which received the signal

  • ids ([int] or None) – ids of moved nodes.

Gets emitted when one or more nodes have moved, because of translations or because the user has moved them manually.

New in version 3.2.

Property Details

v_sim.NodeArray.props.elements
Name:

elements

Type:

GLib.Array

Default Value:

None

Flags:

READABLE

all elements

v_sim.NodeArray.props.n_nodes
Name:

n-nodes

Type:

int

Default Value:

0

Flags:

READABLE

total number of nodes

v_sim.NodeArray.props.n_original_nodes
Name:

n-original-nodes

Type:

int

Default Value:

0

Flags:

READABLE

total number of original nodes