Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | len_init | = | 8 | ||
integer, | public | :: | len | = | 0 | ||
integer, | public | :: | len_max | = | 16 | ||
real(kind=rp), | public, | dimension(:), allocatable | :: | buffer |
Deletes a dvector. No access is allowed to this object after this call.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Clears a dvector. Access allowed after a call to clear.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Returns the ith element of a dvector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in) | :: | this | |||
integer, | intent(in) | :: | i |
Sets the value of the ith element of a dvector. No bounds check is performed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | i | |||
real(kind=rp), | intent(in) | :: | val |
Returns a pointer to the underlying data of a dvector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in), | target | :: | this | ||
real(kind=rp), | intent(out), | dimension(:), pointer | :: | res | ||
integer, | intent(in), | optional | :: | ibeg | ||
integer, | intent(in), | optional | :: | iend |
Adds an element to the end of a dvector. Reallocation will take place if required.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
real(kind=rp), | intent(in) | :: | val |
Removes the last element and returns it. Calling this method on an empty list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Resizes a vector to a given size. Existing data is truncated if desired size is smaller than current size. Otherwise, the empty spaces are filled with zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | new_size | |||
integer, | intent(out), | optional | :: | ierr |
Releases additional memory to fit underlying data of a dvector to a size this%len_init.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | :: | ierr |
Sorts a dvector in ascending order. If order
is provided, it will contain
the sorted indices. The size of order
must be at least this%len
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this | |||
integer, | intent(out), | optional | dimension(:) | :: | order |
Sorts and removes all duplicate entries of a dvector. Note that the internal
buffer size remains unchanged. To reduce the buffer size, call
dvector_shrink_to_fit
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(inout) | :: | this |
Prints a dvector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dvector_t), | intent(in) | :: | this |
type dvector_t
integer :: len_init = 8 !Must be > 0
integer :: len = 0
integer :: len_max = 16 !Must be > len_init
real(rp), dimension(:), allocatable :: buffer
contains
procedure :: delete => dvector_delete
procedure :: clear => dvector_clear
procedure :: get_val => dvector_get_val
procedure :: set_val => dvector_set_val
procedure :: get_data => dvector_get_data
procedure :: append => dvector_append
procedure :: pop => dvector_pop
procedure :: resize => dvector_resize
procedure :: shrink_to_fit => dvector_shrink_to_fit
procedure :: sort => dvector_sort
procedure :: unique => dvector_unique
procedure :: print => dvector_print
end type dvector_t