itm.grid.base - Internal details

Documentation of classes relevant to the inner working of the basic grid classes, but not directly relevant to the user.

Detailed class documentation for itm.grid.base.IndexSet

class itm.grid.base.IndexSet(grid, cls, desc=None)[source]

IndexSet represents a sequence of object index tuples, ordered in the global order of grid objects (i.e. varying the leftmost index fastest).

IndexSet is used by ImplicitObjectList to store the object indices. Its heart is a list of index lists (stored in _ind). Every entry in _ind can either be a IndexRange or a list of integers (which can contain only one integer in the case of a single index for that space).

IndexSet offers a powerful way to define the individual index lists using a descriptor notation (see the constructor documentation).

IndexSet can be used to wrap a complexgrid_indexset, see the static method from_complexgrid_indexset. In this case an IndexSet equivalent to the information in this data structure is created.

The most important routine to look at to understand all this is set_index.

__init__(grid, cls, desc=None)[source]

Create an index set for the given object class cls. The index lists are specified in the descriptor desc.

The descriptor is a list of the same length as cls, where every individual entry can either be 1. None or GRID_UNDEFINED (=0): in this case the index list is set to be all possible values for this index (which depends on the object class) 2. A list, e.g. [1,3,5]: in this case the index can take all values explicitly specified in this list. 3. A tuple, e.g. (2,6): in this case the index can take all values ranging from the first to the second value of the tuple (in the given example: 2,3,4,5,6).

For examples have a look at the test_itm_grid_objectlist.py unit test.

If desc is unspecified/None, the index lists have to be set manually (see e.g. from_complexgrid_indexset).

static from_complexgrid_indexset(grid, cls, cg_indset)[source]

Create an IndexSet as defined in a complexgrid_indexset data structure.

cls[source]

Class of the index set.

nspace[source]

Number of spaces.

__len__()[source]

Returns the number of indices in the index set.

This is effectively a generalized version of Grid.nobj.

__getitem__(setLocalInd)[source]

Returns the object index corresponding to the local index ind of the index set. The inverse of this is the index method. The setLocalInd is zero-based.

__contains__(ind)[source]

Test whether the index list contains the index tuple ind.

index(ind)[source]

Return the position of the given index tuple ind in this IndexSet (0-based). Raises ValueError if ind is not in indexset (c.f. list.index).

is_complete

Returns whether the index set contains all possible indices for it’s class.

It currently does this by checking whether all indices have the maximum length according to the number of subobjects in the individual spaces. ATTENTION: A broken explicit index list (which currently is not tested for) can screw this.

get_index(ind)[source]

Return the index set for the given space.

set_index(ind, value)[source]

Set the index at the given position ind to the given value, where value can be: 1. None 2. GRID_UNDEFINED(=0), 3. a list of indices 4. a 2-tuple with start/end index.

For more details, see the constructor documentation.

__module__ = 'itm.grid.base'

Table Of Contents

Previous topic

Internal details

Next topic

ualconnector - visualizing CPOs in VisIt

This Page