vector_m Module

Implements a vector as an extendable array.


Uses

  • module~~vector_m~~UsesGraph module~vector_m vector_m module~constants_m constants_m module~vector_m->module~constants_m module~qsort_m qsort_m module~vector_m->module~qsort_m iso_fortran_env iso_fortran_env module~constants_m->iso_fortran_env module~qsort_m->module~constants_m

Used by

  • module~~vector_m~~UsedByGraph module~vector_m vector_m module~connectivity_m connectivity_m module~connectivity_m->module~vector_m module~table_m table_m module~connectivity_m->module~table_m module~table_m->module~vector_m module~pairtab_m pairtab_m module~pairtab_m->module~vector_m module~pairtab_m->module~connectivity_m module~pairtab_m->module~table_m module~cell_list_m cell_list_m module~pairtab_m->module~cell_list_m module~aabbtree_m aabbtree_m module~pairtab_m->module~aabbtree_m module~cell_list_m->module~vector_m module~aabbtree_m->module~vector_m module~aabbtree_sm aabbtree_sm module~aabbtree_sm->module~aabbtree_m module~interaction_m interaction_m module~interaction_m->module~table_m module~interaction_m->module~pairtab_m module~bd_solver_m bd_solver_m module~bd_solver_m->module~interaction_m module~setup_m setup_m module~setup_m->module~interaction_m module~setup_m->module~bd_solver_m program~main main program~main->module~setup_m

Contents


Interfaces

public interface ivector_init

  • public interface ivector_init()

    Arguments

    None
  • public subroutine ivector_from_array(this, x)

    Creates an ivector with all elements from an array

    Arguments

    Type IntentOptional AttributesName
    type(ivector_t), intent(inout) :: this
    integer, intent(in), dimension(:):: x

public interface dvector_init

  • public interface dvector_init()

    Arguments

    None
  • public subroutine dvector_from_array(this, x)

    Creates a dvector with all elements from an array

    Arguments

    Type IntentOptional AttributesName
    type(dvector_t), intent(inout) :: this
    real(kind=rp), intent(in), dimension(:):: x

public interface assignment(=)

  • public subroutine ivector_assign(this, other)

    Copies the contents of ivector other to ivector this

    Arguments

    Type IntentOptional AttributesName
    class(ivector_t), intent(inout) :: this
    class(ivector_t), intent(in) :: other
  • public subroutine dvector_assign(this, other)

    Copies the contents of dvector other to dvector this

    Arguments

    Type IntentOptional AttributesName
    class(dvector_t), intent(inout) :: this
    class(dvector_t), intent(in) :: other
  • public subroutine i_dvector_assign(this, other)

    Copies the contents of ivector other to dvector this. Integers are cast to reals.

    Arguments

    Type IntentOptional AttributesName
    class(dvector_t), intent(inout) :: this
    class(ivector_t), intent(in) :: other

Derived Types

type, public :: ivector_t

Components

TypeVisibility AttributesNameInitial
integer, public :: len_init =8
integer, public :: len =0
integer, public :: len_max =16
integer, public, dimension(:), allocatable:: buffer

Type-Bound Procedures

procedure, public :: delete => ivector_delete
procedure, public :: clear => ivector_clear
procedure, public :: get_val => ivector_get_val
procedure, public :: set_val => ivector_set_val
procedure, public :: get_data => ivector_get_data
procedure, public :: append => ivector_append
procedure, public :: pop => ivector_pop
procedure, public :: resize => ivector_resize
procedure, public :: shrink_to_fit => ivector_shrink_to_fit
procedure, public :: sort => ivector_sort
procedure, public :: unique => ivector_unique
procedure, public :: print => ivector_print

type, public :: dvector_t

Components

TypeVisibility AttributesNameInitial
integer, public :: len_init =8
integer, public :: len =0
integer, public :: len_max =16
real(kind=rp), public, dimension(:), allocatable:: buffer

Type-Bound Procedures

procedure, public :: delete => dvector_delete
procedure, public :: clear => dvector_clear
procedure, public :: get_val => dvector_get_val
procedure, public :: set_val => dvector_set_val
procedure, public :: get_data => dvector_get_data
procedure, public :: append => dvector_append
procedure, public :: pop => dvector_pop
procedure, public :: resize => dvector_resize
procedure, public :: shrink_to_fit => dvector_shrink_to_fit
procedure, public :: sort => dvector_sort
procedure, public :: unique => dvector_unique
procedure, public :: print => dvector_print

Functions

public function ivector_get_len(this) result(res)

Returns the length of an ivector

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(in) :: this

Return Value integer

public function dvector_get_len(this) result(res)

Returns the length of a dvector

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(in) :: this

Return Value integer

public function ivector_get_val(this, i) result(res)

Returns the ith element of an ivector.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(in) :: this
integer, intent(in) :: i

Return Value integer

public function dvector_get_val(this, i) result(res)

Returns the ith element of a dvector.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(in) :: this
integer, intent(in) :: i

Return Value real(kind=rp)

public function ivector_pop(this) result(val)

Removes the last element and returns it. Calling this method on an empty list

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this

Return Value integer

public function dvector_pop(this) result(val)

Removes the last element and returns it. Calling this method on an empty list

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this

Return Value real(kind=rp)


Subroutines

public subroutine ivector_init(this, len_init, ierr)

Creates an empty ivector with all elements equal to zero.

Arguments

Type IntentOptional AttributesName
type(ivector_t), intent(inout) :: this
integer, intent(in), optional :: len_init

Must be > 0

integer, intent(out), optional :: ierr

public subroutine dvector_init(this, len_init, ierr)

Creates an empty dvector with all elements equal to zero.

Arguments

Type IntentOptional AttributesName
type(dvector_t), intent(inout) :: this
integer, intent(in), optional :: len_init

Must be > 0

integer, intent(out), optional :: ierr

public subroutine ivector_from_array(this, x)

Creates an ivector with all elements from an array

Arguments

Type IntentOptional AttributesName
type(ivector_t), intent(inout) :: this
integer, intent(in), dimension(:):: x

public subroutine dvector_from_array(this, x)

Creates a dvector with all elements from an array

Arguments

Type IntentOptional AttributesName
type(dvector_t), intent(inout) :: this
real(kind=rp), intent(in), dimension(:):: x

public subroutine ivector_delete(this)

Deletes an ivector. No access is allowed to this object after this call.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this

public subroutine dvector_delete(this)

Deletes a dvector. No access is allowed to this object after this call.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this

public subroutine ivector_clear(this)

Clears an ivector. Access allowed after a call to clear.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this

public subroutine dvector_clear(this)

Clears a dvector. Access allowed after a call to clear.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this

public subroutine ivector_assign(this, other)

Copies the contents of ivector other to ivector this

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
class(ivector_t), intent(in) :: other

public subroutine dvector_assign(this, other)

Copies the contents of dvector other to dvector this

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
class(dvector_t), intent(in) :: other

public subroutine i_dvector_assign(this, other)

Copies the contents of ivector other to dvector this. Integers are cast to reals.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
class(ivector_t), intent(in) :: other

public subroutine ivector_set_val(this, i, val)

Sets the value of the ith element of an ivector. No bounds check is performed.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
integer, intent(in) :: i
integer, intent(in) :: val

public subroutine dvector_set_val(this, i, val)

Sets the value of the ith element of a dvector. No bounds check is performed.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
integer, intent(in) :: i
real(kind=rp), intent(in) :: val

public subroutine ivector_append(this, val)

Adds an element to the end of an ivector. Reallocation will take place if required.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
integer, intent(in) :: val

public subroutine dvector_append(this, val)

Adds an element to the end of a dvector. Reallocation will take place if required.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
real(kind=rp), intent(in) :: val

public subroutine ivector_get_data(this, res, ibeg, iend)

Returns a pointer to the underlying data of an ivector

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(in), target:: this
integer, intent(out), dimension(:), pointer:: res
integer, intent(in), optional :: ibeg
integer, intent(in), optional :: iend

public subroutine dvector_get_data(this, res, ibeg, iend)

Returns a pointer to the underlying data of a dvector

Arguments

Type IntentOptional AttributesName
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

public subroutine ivector_resize(this, new_size, ierr)

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.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
integer, intent(in) :: new_size
integer, intent(out), optional :: ierr

public subroutine dvector_resize(this, new_size, ierr)

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.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
integer, intent(in) :: new_size
integer, intent(out), optional :: ierr

public subroutine ivector_shrink_to_fit(this, ierr)

Releases additional memory to fit underlying data of an ivector to a size this%len_init.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
integer, intent(out), optional :: ierr

public subroutine dvector_shrink_to_fit(this, ierr)

Releases additional memory to fit underlying data of a dvector to a size this%len_init.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
integer, intent(out), optional :: ierr

public subroutine ivector_sort(this, order)

Sorts an ivector in ascending order. If order is provided, it will contain the sorted indices. The size of order must be at least this%len.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this
integer, intent(out), optional dimension(:):: order

public subroutine dvector_sort(this, order)

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.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this
integer, intent(out), optional dimension(:):: order

public subroutine ivector_unique(this)

Sorts and removes all duplicate entries of an ivector. Note that the internal buffer size remains unchanged. To reduce the buffer size, call ivector_shrink_to_fit.

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(inout) :: this

public subroutine dvector_unique(this)

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.

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(inout) :: this

public subroutine ivector_print(this)

Prints an ivector

Arguments

Type IntentOptional AttributesName
class(ivector_t), intent(in) :: this

public subroutine dvector_print(this)

Prints a dvector

Arguments

Type IntentOptional AttributesName
class(dvector_t), intent(in) :: this