Class Reference doubleList

The doubleList class provides a list of double precision floating point numbers. More...

Member

doubleList( )
doubleList( doubleList list )
void append(double d)
double at(int i)
void clear()
bool contains(double d)
int indexOf(double d, int index=0)
void insert(int pos, double value)
void prepend(double value)
int removeAll(double value)
void removeAt(int pos)
int size()
void set(int i, double d)
void swap(int pos1, int pos2)

Detailed Description

graph LR ce(cell)--getDensityLayer-->dl(doubleList) pd(plotData)--itemData-->dl click ce "/layoutscript/api/cell" click pd "/layoutscript/api/plotdata" click dl "/layoutscript/api/doublelist" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class dl thisClas class ce,pd clas

A doubleList is a dynamic list of double-precision numbers. cell getDensityLayer (the tiled overload) returns one density per window; plotData itemData returns one simulation row. In C++ macros a double array is the same type: you can index it as an array and still call at, contains, or append. Index 0 is the first entry; size is the count; set has no effect if i is past the end. clear empties the list; insert and prepend grow it; removeAll returns how many values were dropped. In Python this maps to a native list of floats rather than this class name.

Example:

doubleList dens;
dens.append(0.25);
dens.append(0.80);
if (dens.contains(0.25)) {
 double v = dens.at(0);
 dens.set(1, v + 0.1);
}

Member Function Documentation


doubleList::doubleList( )

Creates an empty list of doubles.


doubleList::doubleList( doubleList list )

Creates a list of doubles with copied data from list.


void doubleList::append(double d)

Inserts d at the end of the list.


double doubleList::at(int i)

Returns: the double at index i. The first entry is 0.


void doubleList::clear()

Removes all items from the list. (introduced with release 20230121)


bool doubleList::contains(double d)

Returns: true if the list contains d, otherwise false.


int doubleList::indexOf(double d, int index=0)

Returns: the index of the first occurrence of d, searching forward from index. Returns -1 if d is not found.


void doubleList::insert(int pos, double value)

Inserts value at pos. Later entries move one position.


void doubleList::prepend(double value)

Inserts value at the beginning of the list. (introduced with release 20260714)


int doubleList::removeAll(double value)

Removes every occurrence of value.

Returns: the number of entries removed.


void doubleList::removeAt(int pos)

Removes the entry at pos. The list shrinks by one.


int doubleList::size()

Returns: the number of doubles in the list.


void doubleList::set(int i, double d)

Sets entry i to d. The first entry is 0. Has no effect if the list is shorter than i.


void doubleList::swap(int pos1, int pos2)

Swaps the values at pos1 and pos2.