Bridges-Python 3.5.1
Bridges(Python API)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | Properties | List of all members
bridges.array.Array Class Reference

This class can be used to create arrays of type Element. More...

Inheritance diagram for bridges.array.Array:
bridges.array1d.Array1D bridges.array2d.Array2D bridges.array3d.Array3D

Public Member Functions

 __init__ (self, **kwargs)
 Array constructor.
 
None set_size (self, int nd, list dim)
 Set the size of each dimensions; also allocates array space.
 
str get_data_structure_type (self)
 Gets the data structure type.
 
List[int] get_dimensions (self)
 Get the size of each dimensions.
 
Element get_element (self, *args, **kwargs)
 Getter function for an element in the array at given position.
 
 set_element (self, *args, **kwargs)
 Setter function for an element in the array at given position.
 
 __getitem__ (self, item)
 
 __setitem__ (self, key, value)
 
dict get_data_structure_representation (self)
 Generating the JSON string for a bridges array object.
 

Static Public Attributes

list dims = [1,1,1]
 

Protected Attributes

 _dims
 
 _array_data
 
 _num_dims
 
 _size
 

Properties

 num_dims = property
 Getter for representing the number of dimensions in the array.
 
 size = property
 Getter for representing the size of array.
 

Detailed Description

This class can be used to create arrays of type Element.

Author
Matthew McQuaigue, Erik Saule
Date
10/8/16, 6/09/19, 7/20/22

This class can be used to create arrays of type Element. Element enables to store objects of any types and provide styling features for visualization purposes.

Arrays are internally represented as 1D arrays; currently 1D, 2D and 3D arrays are supported.

Example Tutorial at: https://bridgesuncc.github.io/tutorials/Array.html (1D, 2D, and 3D Array)

Constructor & Destructor Documentation

◆ __init__()

bridges.array.Array.__init__ (   self,
**  kwargs 
)

Array constructor.

Parameters
dimssize of each dimension (array)
num_dimsThe dimensions of the array (1-3). Defaults to 1 dimension (int)
Returns
None

Reimplemented in bridges.array3d.Array3D, bridges.array2d.Array2D, and bridges.array1d.Array1D.

Member Function Documentation

◆ __getitem__()

bridges.array.Array.__getitem__ (   self,
  item 
)
Parameters
item(tuple) indices
Returns
element at index

◆ __setitem__()

bridges.array.Array.__setitem__ (   self,
  key,
  value 
)

◆ get_data_structure_representation()

dict bridges.array.Array.get_data_structure_representation (   self)

Generating the JSON string for a bridges array object.

Returns
dict the dict that will represent the json when dumped

◆ get_data_structure_type()

str bridges.array.Array.get_data_structure_type (   self)

Gets the data structure type.

Exceptions
ValueErrorif number of dimensions is < 1 or > 3
Returns
str type of data structure

◆ get_dimensions()

List[int] bridges.array.Array.get_dimensions (   self)

Get the size of each dimensions.

Returns
list size of each dimension

◆ get_element()

Element bridges.array.Array.get_element (   self,
args,
**  kwargs 
)

Getter function for an element in the array at given position.

       (int) x,y,z,: indices

       (int) index: the index of array to get in array
       (int) x: column index into array
       (int) y: row index into array
       (int) z: slice index into array
Returns
Element the element at position given

◆ set_element()

bridges.array.Array.set_element (   self,
args,
**  kwargs 
)

Setter function for an element in the array at given position.

       (int) x,y,z: indices
       (Element) el: element object to be assigned to index, always last position arg if using unnamed args

       (Element) el: element object to be assigned to index
       (int) index: the index of array to get in array
       (int) x: column index into array
       (int) y: row index into array
       (int) z: slice index into array
Returns
None

◆ set_size()

None bridges.array.Array.set_size (   self,
int  nd,
list  dim 
)

Set the size of each dimensions; also allocates array space.

       (int) nd: number of dimensions
       (list) dim: size of each dimension
Returns
None

Member Data Documentation

◆ _array_data

bridges.array.Array._array_data
protected

◆ _dims

bridges.array.Array._dims
protected

◆ _num_dims

bridges.array.Array._num_dims
protected

◆ _size

bridges.array.Array._size
protected

◆ dims

list bridges.array.Array.dims = [1,1,1]
static

Property Documentation

◆ num_dims

bridges.array.Array.num_dims = property
static

Getter for representing the number of dimensions in the array.

Returns
int number of dimensions

◆ size

bridges.array.Array.size = property
static

Getter for representing the size of array.

Returns
int the size

The documentation for this class was generated from the following file: