Documentation for module cp_array_utils

various utilities that regard array of different kinds: output, allocation,... maybe it is not a good idea mixing output and memeory utils...

source: cp_array_utils.F
Loading...

public Types:

cp_2d_r_p_type
represent a pointer to a 2d array
cp_3d_logical_p_type
represent a pointer to a 3d array
cp_2d_i_p_type
represent a pointer to a 2d array
cp_1d_i_p_type
represent a pointer to a 1d array
cp_3d_i_p_type
represent a pointer to a 3d array
cp_1d_logical_p_type
represent a pointer to a 1d array
cp_2d_logical_p_type
represent a pointer to a 2d array
cp_3d_r_p_type
represent a pointer to a 3d array
cp_1d_r_p_type
represent a pointer to a 1d array

Generic procedures:

cp_guarantee_size

public Subroutines/Functions:

FUNCTION
INTEGER
cp_1d_i_bsearch (array, el, l_index, u_index)
returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit
returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit
FUNCTION
INTEGER
cp_1d_r_bsearch (array, el, l_index, u_index)
returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit
If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).
writes an array to the given unit

public Types:

TYPE :: cp_1d_i_p_type

represent a pointer to a 1d array


INTEGER(int_4),
DIMENSION(:), POINTER :: array ...

TYPE :: cp_1d_logical_p_type

represent a pointer to a 1d array


LOGICAL,
DIMENSION(:), POINTER :: array ...

TYPE :: cp_1d_r_p_type

represent a pointer to a 1d array


REAL(dp),
DIMENSION(:), POINTER :: array ...

TYPE :: cp_2d_i_p_type

represent a pointer to a 2d array


INTEGER(int_4),
DIMENSION(:,:), POINTER :: array ...

TYPE :: cp_2d_logical_p_type

represent a pointer to a 2d array


LOGICAL,
DIMENSION(:,:), POINTER :: array ...

TYPE :: cp_2d_r_p_type

represent a pointer to a 2d array


REAL(dp),
DIMENSION(:,:), POINTER :: array ...

TYPE :: cp_3d_i_p_type

represent a pointer to a 3d array


INTEGER(int_4),
DIMENSION(:,:,:), POINTER :: array ...

TYPE :: cp_3d_logical_p_type

represent a pointer to a 3d array


LOGICAL,
DIMENSION(:,:,:), POINTER :: array ...

TYPE :: cp_3d_r_p_type

represent a pointer to a 3d array


REAL(dp),
DIMENSION(:,:,:), POINTER :: array ...


Generic procedure cp_guarantee_size

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

REAL(dp),
POINTER
:: array(:) ×
REAL(dp),
POINTER
:: array(:,:) ×
INTEGER(int_4),
POINTER
:: array(:) ×
INTEGER(int_4),
POINTER
:: array(:,:) ×
LOGICAL,
POINTER
:: array(:) ×
LOGICAL,
POINTER
:: array(:,:) ×
INTEGER,
INTENT(in)
:: n × × ×
INTEGER,
INTENT(in)
:: n_rows × × ×
INTEGER,
INTENT(in)
:: n_cols × × ×

FUNCTIONcp_1d_i_bsearch(array, el, l_index, u_index)

returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.

Return Value ::
INTEGER
Arguments:
INTEGER(int_4),
INTENT(in)
:: array(:) the array to search
INTEGER(int_4),
INTENT(in)
:: el the element to look for
INTEGER,
INTENT(in),
OPTIONAL
:: l_index the lower index for binary search (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: u_index the upper index for binary search (defaults to size(array))

SUBROUTINEcp_1d_i_guarantee_size(array, n)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
INTEGER(int_4),
POINTER
:: array(:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n the wanted size

SUBROUTINEcp_1d_i_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
INTEGER(int_4),
INTENT(in)
:: array(:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element

FUNCTIONcp_1d_logical_bsearch(array, el, l_index, u_index)

returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.

Return Value ::
INTEGER
Arguments:
LOGICAL,
INTENT(in)
:: array(:) the array to search
LOGICAL,
INTENT(in)
:: el the element to look for
INTEGER,
INTENT(in),
OPTIONAL
:: l_index the lower index for binary search (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: u_index the upper index for binary search (defaults to size(array))

SUBROUTINEcp_1d_logical_guarantee_size(array, n)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
LOGICAL,
POINTER
:: array(:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n the wanted size

SUBROUTINEcp_1d_logical_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
LOGICAL,
INTENT(in)
:: array(:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element

FUNCTIONcp_1d_r_bsearch(array, el, l_index, u_index)

returns the index at which the element el should be inserted in the array to keep it ordered (array(i)>=el). If the element is bigger than all the elements in the array returns the last index+1.

Return Value ::
INTEGER
Arguments:
REAL(dp),
INTENT(in)
:: array(:) the array to search
REAL(dp),
INTENT(in)
:: el the element to look for
INTEGER,
INTENT(in),
OPTIONAL
:: l_index the lower index for binary search (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: u_index the upper index for binary search (defaults to size(array))

SUBROUTINEcp_1d_r_guarantee_size(array, n)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
REAL(dp),
POINTER
:: array(:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n the wanted size

SUBROUTINEcp_1d_r_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
REAL(dp),
INTENT(in)
:: array(:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element

SUBROUTINEcp_2d_i_guarantee_size(array, n_rows, n_cols)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
INTEGER(int_4),
POINTER
:: array(:,:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n_rows the wanted number of rows
INTEGER,
INTENT(in)
:: n_cols the wanted number of cols

SUBROUTINEcp_2d_i_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
INTEGER(int_4),
INTENT(in)
:: array(:,:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element

SUBROUTINEcp_2d_logical_guarantee_size(array, n_rows, n_cols)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
LOGICAL,
POINTER
:: array(:,:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n_rows the wanted number of rows
INTEGER,
INTENT(in)
:: n_cols the wanted number of cols

SUBROUTINEcp_2d_logical_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
LOGICAL,
INTENT(in)
:: array(:,:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element

SUBROUTINEcp_2d_r_guarantee_size(array, n_rows, n_cols)

If the size of the array is changes reallocate it. Issues a warning when the size changes (but not on allocation and deallocation).

Arguments:
REAL(dp),
POINTER
:: array(:,:) the array to reallocate if necessary
INTEGER,
INTENT(in)
:: n_rows the wanted number of rows
INTEGER,
INTENT(in)
:: n_cols the wanted number of cols

SUBROUTINEcp_2d_r_write(array, unit_nr, el_format)

writes an array to the given unit

Arguments:
REAL(dp),
INTENT(in)
:: array(:,:) the array to write
INTEGER,
INTENT(in)
:: unit_nr the unit to write to (defaults to the standard out)
CHARACTER(*),
INTENT(in),
OPTIONAL
:: el_format the format of a single element