Class that act as stacks, queues, and priority queues. See dDynamicArray_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=r64), | 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 dDynamicArray()
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 dDynamicArray()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | 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
dDynamicArray%append() - Append a value to the end of the dynamic array. Will change a sorted dynamic array to unsorted.
Overloaded type bound procedure dDynamicArray%append()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
real(kind=r64) | :: | val | Value to append. |
dDynamicArray%deallocate() - Deallocate a dynamic array.
Overloaded type bound procedure dDynamicArray%deallocate()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this |
dDynamicArray%insertAt() - Insert a value at a given index.
Overloaded type bound procedure dDynamicArray%insertAt()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Insert value at this location. |
|||
real(kind=r64) | :: | val | Insert this value. |
dDynamicArray%insertSorted() - Insert a value into a sorted dynamic array.
Overloaded type bound procedure dDynamicArray%insertSorted()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
real(kind=r64) | :: | val | Insert this value. |
dDynamicArray%insertSortedUnique() - Inserts only unique numbers into a dynamic array.
Overloaded type bound procedure dDynamicArray%insertSortedUnique()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
real(kind=r64) | :: | val | Insert this value. |
dDynamicArray%isEmpty() - True if the array is empty.
Overloaded type bound procedure dDynamicArray%isEmpty()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this |
Array is empty
dDynamicArray%isFilled() - True if the array is filled.
Overloaded type bound procedure dDynamicArray%isFilled()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this |
Array is filled
dDynamicArray%locationOf() - Get the location of a value in a sorted dynamic array.
Overloaded type bound procedure dDynamicArray%locationOf().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
real(kind=r64) | :: | val | Get the location of this value |
Location of value
dDynamicArray%prepend() - Prepend a value to the start of the dynamic array. Only for unsorted dynamic arrays
Overloaded type bound procedure dDynamicArray%prepend()
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
real(kind=r64) | :: | val | Value to prepend. |
dDynamicArray%reallocate() - Create new contiguous memory to match the needs of the expanding or shrinking array.
Overloaded type bound procedure dDynamicArray%reallocate().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | M | Reallocate memory to this size. |
dDynamicArray%remove() - Remove an element from the array.
Overloaded type bound procedure dDynamicArray%remove().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this | ||||
integer(kind=i32) | :: | i | Remove the value at this location. |
dDynamicArray%tighten() - Removes excess buffer memory and trims it to the current length.
Overloaded type bound procedure dDynamicArray%tighten().
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dDynamicArray) | :: | this |