Class that act as stacks, queues, and priority queues. See rDynamicArray_Class for more information on how to use this class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=i32), | public | :: | N | Current size of the array |
|||
real(kind=r32), | public, | allocatable | :: | values(:) | Memory for values, can be larger than N |
||
logical, | public | :: | sorted | = | .false. | Keep track of whether the array is sorted for potential speed increases |
|
logical, | public | :: | fixed | = | .false. | Don't allow the memory to change after initial instantiation. |
Overloaded by interface rDynamicArray()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i32), | intent(in), | optional | :: | M | Amount of memory to allocate. |
|
logical, | intent(in), | optional | :: | sorted | Maintain a sorted array. |
|
logical, | intent(in), | optional | :: | fixed | Maintain a fixed size array. |
Return type.
Overloaded by interface rDynamicArray()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r32), | intent(in) | :: | values(:) | Set of values to initialize with. |
||
integer(kind=i32), | intent(in), | optional | :: | M | Amount of memory to allocate. |
|
logical, | intent(in), | optional | :: | sorted | Maintain a sorted array. |
|
logical, | intent(in), | optional | :: | fixed | Maintain a fixed size array. |
Return type
rDynamicArray%append() - Append a value to the end of the dynamic array. Will change a sorted dynamic array to unsorted.
Overloaded type bound procedure rDynamicArray%append()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
real(kind=r32) | :: | val | Value to append. |
rDynamicArray%deallocate() - Deallocate a dynamic array.
Overloaded type bound procedure rDynamicArray%deallocate()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this |
rDynamicArray%insertAt() - Insert a value at a given index.
Private insert into array without checking for sorted flag.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Insert value at this location. |
|||
real(kind=r32) | :: | val | Insert this value. |
rDynamicArray%insertSorted() - Insert a value into a sorted dynamic array.
Overloaded type bound procedure rDynamicArray%insertSorted()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
real(kind=r32) | :: | val | Insert this value. |
rDynamicArray%insertSortedUnique() - Inserts only unique numbers into a dynamic array.
Overloaded type bound procedure rDynamicArray%insertSortedUnique()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
real(kind=r32) | :: | val | Insert this value. |
rDynamicArray%isEmpty() - True if the array is empty.
Overloaded type bound procedure rDynamicArray%isEmpty()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this |
Array is empty
rDynamicArray%isFilled() - True if the array is filled.
Overloaded type bound procedure rDynamicArray%isFilled()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this |
Array is filled
rDynamicArray%locationOf() - Get the location of a value in a sorted dynamic array.
Overloaded type bound procedure rDynamicArray%locationOf().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
real(kind=r32) | :: | val | Get the location of this value |
Location of value
rDynamicArray%prepend() - Prepend a value to the start of the dynamic array. Only for unsorted dynamic arrays
Overloaded type bound procedure rDynamicArray%prepend()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
real(kind=r32) | :: | val | Value to prepend. |
rDynamicArray%reallocate() - Create new contiguous memory to match the needs of the expanding or shrinking array.
Overloaded type bound procedure rDynamicArray%reallocate().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | M | Reallocate memory to this size. |
rDynamicArray%remove() - Remove an element from the array.
Overloaded type bound procedure rDynamicArray%remove().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Remove the value at this location. |
rDynamicArray%tighten() - Removes excess buffer memory and trims it to the current length.
Overloaded type bound procedure rDynamicArray%tighten().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rDynamicArray) | :: | this |