FEDEM Solver
R8.0
Source code of the dynamics solver
|
Module with subroutines for dynamic allocation of arrays. More...
Data Types | |
interface | reallocate |
Allocates, reallocates or deallocates a generic array. More... | |
interface | logallocmem |
Prints the accumulated memory usage to log file. More... | |
Functions/Subroutines | |
subroutine | reallocateint (label, array, nw, ierr, preserveContent) |
Allocate, reallocate or deallocate a one-dimensional integer array. More... | |
subroutine | reallocateint8 (label, array, nw, ierr, preserveContent) |
Allocate, reallocate or deallocate a one-dimensional integer array. More... | |
subroutine | reallocatefloat1d (label, array, nw, ierr) |
Allocate, reallocate or deallocate a one-dimensional real array. More... | |
subroutine | reallocatefloat2d (label, array, n1, n2, ierr) |
Allocate, reallocate or deallocate a two-dimensional real array. More... | |
subroutine | reallocatedouble1d (label, array, nw, ierr, preserveContent) |
Allocate, reallocate or deallocate a one-dimensional real array. More... | |
subroutine | reallocatebigdouble1d (label, array, nw, ierr) |
Allocate, reallocate or deallocate a big one-dimensional real array. More... | |
subroutine | reallocatedouble2d (label, array, n1, n2, ierr) |
Allocate, reallocate or deallocate a two-dimensional real array. More... | |
subroutine | logallocmemi8 (label, oldSize, newSize, nBytes) |
Prints the current accumulated memory usage to the log file. More... | |
subroutine | logallocmemi4 (label, oldSize, newSize, nBytes) |
Prints the current accumulated memory usage to the log file. More... | |
subroutine, public | closememlogfile () |
Closes the memory logging file. More... | |
subroutine, public | writepeakmem (lpu) |
Writes the peak memory usage to file unit lpu. More... | |
subroutine, public | writestorage (name, nwI, nwR, lpu) |
Writes storage requirement information for an item to unit lpu. More... | |
character(len=12) function, public | strbytes (nBytes) |
Converts a number of bytes to a user-friendly string. More... | |
Variables | |
logical, save, public | dologmem = .false. |
Toggle for print of memory usage. More... | |
integer, save | logfile = 0 |
File unit number for memory logging. More... | |
integer(i8), save | totmem = 0_i8 |
Total number of bytes allocatedy. More... | |
integer(i8), save | peakmem = 0_i8 |
Maximum number of bytes allocated. More... | |
Module with subroutines for dynamic allocation of arrays.
This module contains utility subroutines to facilitate allocation, reallocation, and deallocation of integer, real and double precision arrays, with optional log of accumulated memory usage. They work much in the similar way as the C-function realloc(). The allocation subroutines are accessed via the common interface allocationmodule::reallocate().
subroutine, public allocationmodule::closememlogfile |
Closes the memory logging file.
subroutine allocationmodule::logallocmemi4 | ( | character(len=*), intent(in) | label, |
integer, intent(in) | oldSize, | ||
integer, intent(in) | newSize, | ||
integer, intent(in) | nBytes | ||
) |
Prints the current accumulated memory usage to the log file.
[in] | label | Name of calling subroutine |
[in] | oldSize | Number of words deallocated |
[in] | newSize | Number of words allocated |
[in] | nBytes | Number of bytes per word |
subroutine allocationmodule::logallocmemi8 | ( | character(len=*), intent(in) | label, |
integer(i8), intent(in) | oldSize, | ||
integer(i8), intent(in) | newSize, | ||
integer, intent(in) | nBytes | ||
) |
Prints the current accumulated memory usage to the log file.
[in] | label | Name of calling subroutine |
[in] | oldSize | Number of words deallocated |
[in] | newSize | Number of words allocated |
[in] | nBytes | Number of bytes per word |
subroutine allocationmodule::reallocatebigdouble1d | ( | character(len=*), intent(in) | label, |
real(dp), dimension(:), pointer | array, | ||
integer(i8), intent(in) | nw, | ||
integer, intent(inout) | ierr | ||
) |
Allocate, reallocate or deallocate a big one-dimensional real array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The double precision real array to (re)allocate | |
[in] | nw | Number of words in array after reallocation |
[out] | ierr | Error flag |
This subroutine is used for arrays that may contain more than 2^31 words, which is the largest number that can be represented by normal 4-byte integer variables.
subroutine allocationmodule::reallocatedouble1d | ( | character(len=*), intent(in) | label, |
real(dp), dimension(:), pointer | array, | ||
integer, intent(in), optional | nw, | ||
integer, intent(inout), optional | ierr, | ||
logical, intent(in), optional | preserveContent | ||
) |
Allocate, reallocate or deallocate a one-dimensional real array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The double precision real array to (re)allocate | |
[in] | nw | Number of words in array after reallocation |
[out] | ierr | Error flag |
[in] | preserveContent | If .true., the existing contents is preserved when the array is reallocated |
subroutine allocationmodule::reallocatedouble2d | ( | character(len=*), intent(in) | label, |
real(dp), dimension(:,:), pointer | array, | ||
integer, intent(in), optional | n1, | ||
integer, intent(in), optional | n2, | ||
integer, intent(inout), optional | ierr | ||
) |
Allocate, reallocate or deallocate a two-dimensional real array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The double precision real array to (re)allocate | |
[in] | n1 | Number of rows in array after reallocation |
[in] | n2 | Number of columns in array after reallocation |
[out] | ierr | Error flag |
subroutine allocationmodule::reallocatefloat1d | ( | character(len=*), intent(in) | label, |
real(sp), dimension(:), pointer | array, | ||
integer, intent(in), optional | nw, | ||
integer, intent(inout), optional | ierr | ||
) |
Allocate, reallocate or deallocate a one-dimensional real array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The single precision real array to (re)allocate | |
[in] | nw | Number of words in array after reallocation |
[out] | ierr | Error flag |
subroutine allocationmodule::reallocatefloat2d | ( | character(len=*), intent(in) | label, |
real(sp), dimension(:,:), pointer | array, | ||
integer, intent(in), optional | n1, | ||
integer, intent(in), optional | n2, | ||
integer, intent(inout), optional | ierr | ||
) |
Allocate, reallocate or deallocate a two-dimensional real array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The single precision real array to (re)allocate | |
[in] | n1 | Number of rows in array after reallocation |
[in] | n2 | Number of columns in array after reallocation |
[out] | ierr | Error flag |
|
private |
Allocate, reallocate or deallocate a one-dimensional integer array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The integer array to (re)allocate | |
[in] | nw | Number of words in array after reallocation |
[out] | ierr | Error flag |
[in] | preserveContent | If .true., the existing contents is preserved when the array is reallocated |
subroutine allocationmodule::reallocateint8 | ( | character(len=*), intent(in) | label, |
integer(i8), dimension(:), pointer | array, | ||
integer, intent(in), optional | nw, | ||
integer, intent(inout), optional | ierr, | ||
logical, intent(in), optional | preserveContent | ||
) |
Allocate, reallocate or deallocate a one-dimensional integer array.
[in] | label | Name of calling subroutine (for memory logging) |
array | The integer*8 array to (re)allocate | |
[in] | nw | Number of words in array after reallocation |
[out] | ierr | Error flag |
[in] | preserveContent | If .true., the existing contents is preserved when the array is reallocated |
character(len=12) function, public allocationmodule::strbytes | ( | integer(i8), intent(in) | nBytes | ) |
Converts a number of bytes to a user-friendly string.
[in] | nBytes | Number of bytes |
subroutine, public allocationmodule::writepeakmem | ( | integer, intent(in) | lpu | ) |
Writes the peak memory usage to file unit lpu.
subroutine, public allocationmodule::writestorage | ( | character(len=*), intent(in) | name, |
integer(i8), intent(in) | nwI, | ||
integer(i8), intent(in) | nwR, | ||
integer, intent(in) | lpu | ||
) |
Writes storage requirement information for an item to unit lpu.
[in] | name | Name of the item to write storage info for |
[in] | nwI | Number of integer words |
[in] | nwR | Number of real words |
[in] | lpu | File unit number to write to |
logical, save, public allocationmodule::dologmem = .false. |
Toggle for print of memory usage.
|
private |
File unit number for memory logging.
|
private |
Maximum number of bytes allocated.
|
private |
Total number of bytes allocatedy.