FMUTIL  0.1
Fortran Miscellaneous UTILities
vectors::vector Type Reference

Vector type. More...

+ Collaboration diagram for vectors::vector:

Public Member Functions

procedure assignvector
 
generic, public assignment => assignvector
 Assignment operator for the Vector type, this enables copying of RHS vector contents to LHS vector. Note that after this operation, LHS Vector will be an exact copy of the RHS vector including data and internal state. More...
 
procedure create_newbkts
 
procedure index2bkt
 
procedure, public init => initialize
 Initialize the vector with different options and allocates memory. More...
 
procedure, public size => vec_size
 Returns size of the vector or number of elements stored. More...
 
procedure, public capacity
 Returns the current capacity of the vector. More...
 
procedure, public nusedbkts
 Returns number of non-empty internal buckets. More...
 
procedure, public reserve
 Reserve the requested storage minimum capacity by allocating new buckets if needed. More...
 
procedure, public shrinktofit
 Shrink the capacity by deallocating unused buckets if needed. It tries to make Capacity as close to Size as possible. More...
 
procedure, public pushback => push_back
 Push one element at the back of the vector. More...
 
procedure, public popback => pop_back
 Pop one element from the back of the vector. More...
 
procedure, public elemat => elem_at
 Returns a pointer to the element with the given index (1-based) More...
 
procedure, public front => elem_front
 Returns the element with the index-1. More...
 
procedure, public back => elem_back
 Returns the element with the last index. More...
 
procedure, public slice => vec_slice
 Returns an array containing vector elements within the requested lower and upper bounds. This is inefficient as it copies the requested contents in a new array and returns it. More...
 
procedure, public bktslice => bkt_slice
 Returns the pointer to the element array starting from the user-specified lower bound. If the upper bound is beyond the extent of the current data bucket, then the array is truncated at the the current bucket boundary. This is an efficient method as no copying of data is performed. More...
 
procedure, public insert => elem_insert
 Inserts the element/elements at the given index and relocate elements at the later indices. More...
 
procedure, public erase => elem_erase
 Delete the element/elements at the given index and relocate the elements at the later indices. More...
 
procedure, public clear
 Clear the contents of the Vector but memory is not deallocated. More...
 
final destroy
 Frees up all the memory allocated. More...
 

Public Attributes

integer, public status = 0
 Status: 0-success, any negative value-exception condition. More...
 
logical storageallocated = .FALSE.
 Flag to indicate Vector storage has been allocated. More...
 
integer newbktstoallocate = DEFAULT_NEWBKTSALLOCATED
 Number of new buckets to create on Vector capacity increase. More...
 
integer bktcap = DEFAULT_BKTCAP
 Each bucket capacity. More...
 
integer usedbkts = 0
 Number of buckets that currently contain data. More...
 
integer allocatedbkts = 0
 Number of buckets that are currently allocated. More...
 
class(vecelem), allocatable moldelem
 Mold element to be used for memory allocation. More...
 
type(bktptr), dimension(:), allocatable vecdata
 Array of bucket pointers. More...
 

Detailed Description

Vector type.

Definition at line 111 of file vector.f90.

Member Function/Subroutine Documentation

◆ assignment()

generic, public vectors::vector::assignment

Assignment operator for the Vector type, this enables copying of RHS vector contents to LHS vector. Note that after this operation, LHS Vector will be an exact copy of the RHS vector including data and internal state.

Definition at line 149 of file vector.f90.

References vectors::assignvector().

+ Here is the call graph for this function:

◆ assignvector()

procedure vectors::vector::assignvector

Definition at line 143 of file vector.f90.

◆ back()

procedure, public vectors::vector::back

Returns the element with the last index.

Definition at line 188 of file vector.f90.

◆ bktslice()

procedure, public vectors::vector::bktslice

Returns the pointer to the element array starting from the user-specified lower bound. If the upper bound is beyond the extent of the current data bucket, then the array is truncated at the the current bucket boundary. This is an efficient method as no copying of data is performed.

Definition at line 200 of file vector.f90.

◆ capacity()

procedure, public vectors::vector::capacity

Returns the current capacity of the vector.

Definition at line 162 of file vector.f90.

◆ clear()

procedure, public vectors::vector::clear

Clear the contents of the Vector but memory is not deallocated.

Definition at line 211 of file vector.f90.

◆ create_newbkts()

procedure vectors::vector::create_newbkts

Definition at line 152 of file vector.f90.

◆ destroy()

final vectors::vector::destroy
final

Frees up all the memory allocated.

Definition at line 214 of file vector.f90.

References vectors::destroy().

+ Here is the call graph for this function:

◆ elemat()

procedure, public vectors::vector::elemat

Returns a pointer to the element with the given index (1-based)

Definition at line 182 of file vector.f90.

◆ erase()

procedure, public vectors::vector::erase

Delete the element/elements at the given index and relocate the elements at the later indices.

Definition at line 208 of file vector.f90.

◆ front()

procedure, public vectors::vector::front

Returns the element with the index-1.

Definition at line 185 of file vector.f90.

◆ index2bkt()

procedure vectors::vector::index2bkt

Definition at line 153 of file vector.f90.

◆ init()

procedure, public vectors::vector::init

Initialize the vector with different options and allocates memory.

Definition at line 156 of file vector.f90.

◆ insert()

procedure, public vectors::vector::insert

Inserts the element/elements at the given index and relocate elements at the later indices.

Definition at line 204 of file vector.f90.

◆ nusedbkts()

procedure, public vectors::vector::nusedbkts

Returns number of non-empty internal buckets.

Definition at line 165 of file vector.f90.

◆ popback()

procedure, public vectors::vector::popback

Pop one element from the back of the vector.

Definition at line 179 of file vector.f90.

◆ pushback()

procedure, public vectors::vector::pushback

Push one element at the back of the vector.

Definition at line 176 of file vector.f90.

◆ reserve()

procedure, public vectors::vector::reserve

Reserve the requested storage minimum capacity by allocating new buckets if needed.

Definition at line 169 of file vector.f90.

◆ shrinktofit()

procedure, public vectors::vector::shrinktofit

Shrink the capacity by deallocating unused buckets if needed. It tries to make Capacity as close to Size as possible.

Definition at line 173 of file vector.f90.

◆ size()

procedure, public vectors::vector::size

Returns size of the vector or number of elements stored.

Definition at line 159 of file vector.f90.

◆ slice()

procedure, public vectors::vector::slice

Returns an array containing vector elements within the requested lower and upper bounds. This is inefficient as it copies the requested contents in a new array and returns it.

Definition at line 193 of file vector.f90.

Member Data Documentation

◆ allocatedbkts

integer vectors::vector::allocatedbkts = 0

Number of buckets that are currently allocated.

Definition at line 131 of file vector.f90.

◆ bktcap

integer vectors::vector::bktcap = DEFAULT_BKTCAP

Each bucket capacity.

Definition at line 125 of file vector.f90.

◆ moldelem

class(vecelem), allocatable vectors::vector::moldelem

Mold element to be used for memory allocation.

Definition at line 134 of file vector.f90.

◆ newbktstoallocate

integer vectors::vector::newbktstoallocate = DEFAULT_NEWBKTSALLOCATED

Number of new buckets to create on Vector capacity increase.

Definition at line 122 of file vector.f90.

◆ status

integer, public vectors::vector::status = 0

Status: 0-success, any negative value-exception condition.

Definition at line 116 of file vector.f90.

◆ storageallocated

logical vectors::vector::storageallocated = .FALSE.

Flag to indicate Vector storage has been allocated.

Definition at line 119 of file vector.f90.

◆ usedbkts

integer vectors::vector::usedbkts = 0

Number of buckets that currently contain data.

Definition at line 128 of file vector.f90.

◆ vecdata

type(bktptr), dimension(:), allocatable vectors::vector::vecdata

Array of bucket pointers.

Definition at line 137 of file vector.f90.


The documentation for this type was generated from the following file: