metawards.Nodes

class metawards.Nodes

This is a container class for Nodes. This uses Numpy arrays to store a list of Node objects as a “struct of arrays”. This should improve speed of loading and access.

__init__(self, N: int = 0)

Create a container for up to “N” nodes

Attributes

assert_not_null Assert that this collection of nodes is not null
assert_valid_index Assert that the passed index ‘i’ is valid for this collection.
is_null
resize Resize this container to hold ‘N’ nodes.
assert_not_null

Assert that this collection of nodes is not null

assert_valid_index

Assert that the passed index ‘i’ is valid for this collection. This will return the index with Python reverse indexing, so that “-1” refers to the last node in the collection

is_null
resize

Resize this container to hold ‘N’ nodes. This will expand the container if ‘N’ is greater than len(self), or will contract the container (deleting excess nodes) if ‘N’ is less than len(self). This function is called typically when you pre-allocate a large Nodes container, and then want to reduce the size to fit the number of loaded nodes