MOM6
mom_safe_alloc::safe_alloc_ptr Interface Reference

Detailed Description

Allocate a pointer to a 1-d, 2-d or 3-d array.

Definition at line 12 of file MOM_safe_alloc.F90.

Private functions

subroutine safe_alloc_ptr_3d_3arg (ptr, ni, nj, nk)
 Allocate a pointer to a 3-d array based on its dimension sizes. More...
 
subroutine 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. More...
 
subroutine safe_alloc_ptr_2d_2arg (ptr, ni, nj)
 Allocate a pointer to a 2-d array based on its dimension sizes. More...
 
subroutine 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. More...
 
subroutine 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. More...
 
subroutine safe_alloc_ptr_1d (ptr, i1, i2)
 Allocate a pointer to a 1-d array. More...
 

Functions and subroutines

◆ safe_alloc_ptr_1d()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_1d ( real, dimension(:), pointer  ptr,
integer, intent(in)  i1,
integer, intent(in), optional  i2 
)
private

Allocate a pointer to a 1-d array.

Parameters
ptrA pointer to allocate
[in]i1The size of the array, or its starting index if i2 is present
[in]i2The ending index of the array

Definition at line 36 of file MOM_safe_alloc.F90.

36  real, dimension(:), pointer :: ptr !< A pointer to allocate
37  integer, intent(in) :: i1 !< The size of the array, or its starting index if i2 is present
38  integer, optional, intent(in) :: i2 !< The ending index of the array
39  if (.not.associated(ptr)) then
40  if (present(i2)) then
41  allocate(ptr(i1:i2))
42  else
43  allocate(ptr(i1))
44  endif
45  ptr(:) = 0.0
46  endif

◆ safe_alloc_ptr_2d()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_2d ( real, dimension(:,:), pointer  ptr,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je 
)
private

Allocate a pointer to a 2-d array based on its index starting and ending values.

Parameters
ptrA pointer to allocate
[in]isThe start index to allocate for the 1st dimension
[in]ieThe end index to allocate for the 1st dimension
[in]jsThe start index to allocate for the 2nd dimension
[in]jeThe end index to allocate for the 2nd dimension

Definition at line 74 of file MOM_safe_alloc.F90.

74  real, dimension(:,:), pointer :: ptr !< A pointer to allocate
75  integer, intent(in) :: is !< The start index to allocate for the 1st dimension
76  integer, intent(in) :: ie !< The end index to allocate for the 1st dimension
77  integer, intent(in) :: js !< The start index to allocate for the 2nd dimension
78  integer, intent(in) :: je !< The end index to allocate for the 2nd dimension
79  if (.not.associated(ptr)) then
80  allocate(ptr(is:ie,js:je))
81  ptr(:,:) = 0.0
82  endif

◆ safe_alloc_ptr_2d_2arg()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_2d_2arg ( real, dimension(:,:), pointer  ptr,
integer, intent(in)  ni,
integer, intent(in)  nj 
)
private

Allocate a pointer to a 2-d array based on its dimension sizes.

Parameters
ptrA pointer to allocate
[in]niThe size of the 1st dimension of the array
[in]njThe size of the 2nd dimension of the array

Definition at line 51 of file MOM_safe_alloc.F90.

51  real, dimension(:,:), pointer :: ptr !< A pointer to allocate
52  integer, intent(in) :: ni !< The size of the 1st dimension of the array
53  integer, intent(in) :: nj !< The size of the 2nd dimension of the array
54  if (.not.associated(ptr)) then
55  allocate(ptr(ni,nj))
56  ptr(:,:) = 0.0
57  endif

◆ safe_alloc_ptr_3d()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_3d ( real, dimension(:,:,:), pointer  ptr,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je,
integer, intent(in)  nk 
)
private

Allocate a pointer to a 3-d array based on its index starting and ending values.

Parameters
ptrA pointer to allocate
[in]isThe start index to allocate for the 1st dimension
[in]ieThe end index to allocate for the 1st dimension
[in]jsThe start index to allocate for the 2nd dimension
[in]jeThe end index to allocate for the 2nd dimension
[in]nkThe size to allocate for the 3rd dimension

Definition at line 87 of file MOM_safe_alloc.F90.

87  real, dimension(:,:,:), pointer :: ptr !< A pointer to allocate
88  integer, intent(in) :: is !< The start index to allocate for the 1st dimension
89  integer, intent(in) :: ie !< The end index to allocate for the 1st dimension
90  integer, intent(in) :: js !< The start index to allocate for the 2nd dimension
91  integer, intent(in) :: je !< The end index to allocate for the 2nd dimension
92  integer, intent(in) :: nk !< The size to allocate for the 3rd dimension
93  if (.not.associated(ptr)) then
94  allocate(ptr(is:ie,js:je,nk))
95  ptr(:,:,:) = 0.0
96  endif

◆ safe_alloc_ptr_3d_3arg()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_3d_3arg ( real, dimension(:,:,:), pointer  ptr,
integer, intent(in)  ni,
integer, intent(in)  nj,
integer, intent(in)  nk 
)
private

Allocate a pointer to a 3-d array based on its dimension sizes.

Parameters
ptrA pointer to allocate
[in]niThe size of the 1st dimension of the array
[in]njThe size of the 2nd dimension of the array
[in]nkThe size of the 3rd dimension of the array

Definition at line 62 of file MOM_safe_alloc.F90.

62  real, dimension(:,:,:), pointer :: ptr !< A pointer to allocate
63  integer, intent(in) :: ni !< The size of the 1st dimension of the array
64  integer, intent(in) :: nj !< The size of the 2nd dimension of the array
65  integer, intent(in) :: nk !< The size of the 3rd dimension of the array
66  if (.not.associated(ptr)) then
67  allocate(ptr(ni,nj,nk))
68  ptr(:,:,:) = 0.0
69  endif

◆ safe_alloc_ptr_3d_6arg()

subroutine mom_safe_alloc::safe_alloc_ptr::safe_alloc_ptr_3d_6arg ( real, dimension(:,:,:), pointer  ptr,
integer, intent(in)  is,
integer, intent(in)  ie,
integer, intent(in)  js,
integer, intent(in)  je,
integer, intent(in)  ks,
integer, intent(in)  ke 
)
private

Allocate a pointer to a 3-d array based on its index starting and ending values.

Parameters
ptrA pointer to allocate
[in]isThe start index to allocate for the 1st dimension
[in]ieThe end index to allocate for the 1st dimension
[in]jsThe start index to allocate for the 2nd dimension
[in]jeThe end index to allocate for the 2nd dimension
[in]ksThe start index to allocate for the 3rd dimension
[in]keThe end index to allocate for the 3rd dimension

Definition at line 101 of file MOM_safe_alloc.F90.

101  real, dimension(:,:,:), pointer :: ptr !< A pointer to allocate
102  integer, intent(in) :: is !< The start index to allocate for the 1st dimension
103  integer, intent(in) :: ie !< The end index to allocate for the 1st dimension
104  integer, intent(in) :: js !< The start index to allocate for the 2nd dimension
105  integer, intent(in) :: je !< The end index to allocate for the 2nd dimension
106  integer, intent(in) :: ks !< The start index to allocate for the 3rd dimension
107  integer, intent(in) :: ke !< The end index to allocate for the 3rd dimension
108  if (.not.associated(ptr)) then
109  allocate(ptr(is:ie,js:je,ks:ke))
110  ptr(:,:,:) = 0.0
111  endif

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