mom_safe_alloc module reference¶
Convenience functions for safely allocating memory without accidentally reallocating pointer and causing memory leaks.
Functions/Subroutines¶
Allocate a pointer to a 1-d array. |
|
Allocate a pointer to a 2-d array based on its dimension sizes. |
|
Allocate a pointer to a 3-d array based on its dimension sizes. |
|
Allocate a pointer to a 2-d array based on its index starting and ending values. |
|
Allocate a pointer to a 3-d array based on its index starting and ending values. |
|
Allocate a pointer to a 3-d array based on its index starting and ending values. |
|
Allocate a 2-d allocatable array based on its index starting and ending values. |
|
Allocate a 3-d allocatable array based on its index starting and ending values and k-index size. |
|
Allocate a 3-d allocatable array based on its 6 index starting and ending values. |
Detailed Description¶
Convenience functions for safely allocating memory without accidentally reallocating pointer and causing memory leaks.
Function/Subroutine Documentation¶
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_1d
(ptr, i1, i2)¶ Allocate a pointer to a 1-d array.
- Parameters:
ptr :: A pointer to allocate
i1 :: [in] The size of the array, or its starting index if i2 is present
i2 :: [in] The ending index of the array
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_2d_2arg
(ptr, ni, nj)¶ Allocate a pointer to a 2-d array based on its dimension sizes.
- Parameters:
ptr :: A pointer to allocate
ni :: [in] The size of the 1st dimension of the array
nj :: [in] The size of the 2nd dimension of the array
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_3d_3arg
(ptr, ni, nj, nk)¶ Allocate a pointer to a 3-d array based on its dimension sizes.
- Parameters:
ptr :: A pointer to allocate
ni :: [in] The size of the 1st dimension of the array
nj :: [in] The size of the 2nd dimension of the array
nk :: [in] The size of the 3rd dimension of the array
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_2d
(ptr, is, ie, js, je)¶ Allocate a pointer to a 2-d array based on its index starting and ending values.
- Parameters:
ptr :: A pointer to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_3d
(ptr, is, ie, js, je, nk)¶ Allocate a pointer to a 3-d array based on its index starting and ending values.
- Parameters:
ptr :: A pointer to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
nk :: [in] The size to allocate for the 3rd dimension
-
subroutine
mom_safe_alloc/
safe_alloc_ptr_3d_6arg
(ptr, is, ie, js, je, ks, ke)¶ Allocate a pointer to a 3-d array based on its index starting and ending values.
- Parameters:
ptr :: A pointer to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
ks :: [in] The start index to allocate for the 3rd dimension
ke :: [in] The end index to allocate for the 3rd dimension
-
subroutine
mom_safe_alloc/
safe_alloc_allocatable_2d
(ptr, is, ie, js, je)¶ Allocate a 2-d allocatable array based on its index starting and ending values.
- Parameters:
ptr :: An allocatable array to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
-
subroutine
mom_safe_alloc/
safe_alloc_allocatable_3d
(ptr, is, ie, js, je, nk)¶ Allocate a 3-d allocatable array based on its index starting and ending values and k-index size.
- Parameters:
ptr :: An allocatable array to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
nk :: [in] The size to allocate for the 3rd dimension
-
subroutine
mom_safe_alloc/
safe_alloc_allocatable_3d_6arg
(ptr, is, ie, js, je, ks, ke)¶ Allocate a 3-d allocatable array based on its 6 index starting and ending values.
- Parameters:
ptr :: An allocatable array to allocate
is :: [in] The start index to allocate for the 1st dimension
ie :: [in] The end index to allocate for the 1st dimension
js :: [in] The start index to allocate for the 2nd dimension
je :: [in] The end index to allocate for the 2nd dimension
ks :: [in] The start index to allocate for the 3rd dimension
ke :: [in] The end index to allocate for the 3rd dimension