The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



ListCellPositions


Unit:SDL_openarrays
Class: none
Declaration: [1] function ListCellPositions (Arr: TBoolArray; Value: boolean; MaxCellCnt, Offset: integer; var CellPos: TIntArray): integer;
[2] function ListCellPositions (Arr: TBool2DArray; value: boolean; MaxCellCnt, Offset: integer; var CellPos: TInt2DArray): integer;

The function ListCellPositions converts the boolean array Arr into a list of indices. It therefore searches all cells of the array and stores the index of each cell which contains the value Value in the array CellPos. The maximum number of listed cells can be restricted by means of the parameter MaxCellCnt. The search is aborted when the size of the CellPos array exceeds MaxCellCnt.

The actually stored index can be offset by a fixed value defined by the parameter Offset (this might be important if you want to change the index from a 0-based to a 1-based array).

The function returns the following (error) numbers:

>=0 ... everything is OK, returned value is the number of found cells
   -1 ... the array Arr has no size


Last Update: 2023-Feb-06