123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- !
- ! PArray
- !
- !
- ! Template for PArray routines with integer arguments.
- !
- ! To generate kind specific versions, use:
- !
- ! sed -e 's/<wp>/1/g' parray_iwp.f90 > parray_i1.f90
- ! sed -e 's/<wp>/2/g' parray_iwp.f90 > parray_i2.f90
- ! sed -e 's/<wp>/4/g' parray_iwp.f90 > parray_i4.f90
- ! sed -e 's/<wp>/8/g' parray_iwp.f90 > parray_i8.f90
- !
- module PArray_i<wp>
- implicit none
-
- ! --- in/out -------------------------
-
- private
-
- public :: pa_Init, pa_Done, pa_SetShape, pa_SetCopy
-
-
- ! --- interfaces ---------------------------
-
- interface pa_Init
- module procedure pa_Init_i<wp>_1d
- module procedure pa_Init_i<wp>_2d
- module procedure pa_Init_i<wp>_3d
- module procedure pa_Init_i<wp>_4d
- module procedure pa_Init_i<wp>_5d
- module procedure pa_Init_i<wp>_6d
- module procedure pa_Init_i<wp>_7d
- end interface
-
- interface pa_Done
- module procedure pa_Done_i<wp>_1d
- module procedure pa_Done_i<wp>_2d
- module procedure pa_Done_i<wp>_3d
- module procedure pa_Done_i<wp>_4d
- module procedure pa_Done_i<wp>_5d
- module procedure pa_Done_i<wp>_6d
- module procedure pa_Done_i<wp>_7d
- end interface
-
- interface pa_SetShape
- module procedure pa_SetShape_i<wp>_1d_shp
- module procedure pa_SetShape_i<wp>_1d_n
- module procedure pa_SetShape_i<wp>_2d_shp
- module procedure pa_SetShape_i<wp>_2d_n
- module procedure pa_SetShape_i<wp>_3d_shp
- module procedure pa_SetShape_i<wp>_3d_n
- module procedure pa_SetShape_i<wp>_4d_shp
- module procedure pa_SetShape_i<wp>_4d_n
- module procedure pa_SetShape_i<wp>_5d_shp
- module procedure pa_SetShape_i<wp>_5d_n
- module procedure pa_SetShape_i<wp>_6d_shp
- module procedure pa_SetShape_i<wp>_6d_n
- module procedure pa_SetShape_i<wp>_7d_shp
- module procedure pa_SetShape_i<wp>_7d_n
- end interface
-
- interface pa_SetCopy
- module procedure pa_SetCopy_i<wp>_1d
- module procedure pa_SetCopy_i<wp>_2d
- module procedure pa_SetCopy_i<wp>_3d
- module procedure pa_SetCopy_i<wp>_4d
- module procedure pa_SetCopy_i<wp>_5d
- module procedure pa_SetCopy_i<wp>_6d
- module procedure pa_SetCopy_i<wp>_7d
- end interface
-
-
- contains
- ! =========================================================
- ! ===
- ! === integer(<wp>)
- ! ===
- ! =========================================================
-
-
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 1D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_1d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_1d
- ! ***
-
- subroutine pa_Done_i<wp>_1d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_1d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_1d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:)
- integer, intent(in) :: n(1)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1)) )
-
- end subroutine pa_SetShape_i<wp>_1d_shp
- ! ***
- subroutine pa_SetShape_i<wp>_1d_n( x, n1 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:)
- integer, intent(in) :: n1
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( size(x) /= n1 ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n1) )
-
- end subroutine pa_SetShape_i<wp>_1d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_1d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:)
- integer(<wp>), intent(in) :: y(:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_1d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 2D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_2d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_2d
- ! ***
-
-
- subroutine pa_Done_i<wp>_2d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_2d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_2d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:)
- integer, intent(in) :: n(2)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2)) )
-
- end subroutine pa_SetShape_i<wp>_2d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_2d_n( x, n1, n2 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:)
- integer, intent(in) :: n1, n2
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2/) )
-
- end subroutine pa_SetShape_i<wp>_2d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_2d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:)
- integer(<wp>), intent(in) :: y(:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_2d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 3D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_3d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_3d
- ! ***
-
-
- subroutine pa_Done_i<wp>_3d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_3d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_3d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:)
- integer, intent(in) :: n(3)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2),n(3)) )
-
- end subroutine pa_SetShape_i<wp>_3d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_3d_n( x, n1, n2, n3 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:)
- integer, intent(in) :: n1, n2, n3
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2,n3/) )
-
- end subroutine pa_SetShape_i<wp>_3d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_3d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:)
- integer(<wp>), intent(in) :: y(:,:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_3d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 4D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_4d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_4d
- ! ***
-
-
- subroutine pa_Done_i<wp>_4d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_4d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_4d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:)
- integer, intent(in) :: n(4)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2),n(3),n(4)) )
-
- end subroutine pa_SetShape_i<wp>_4d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_4d_n( x, n1, n2, n3, n4 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:)
- integer, intent(in) :: n1, n2, n3, n4
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2,n3,n4/) )
-
- end subroutine pa_SetShape_i<wp>_4d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_4d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:)
- integer(<wp>), intent(in) :: y(:,:,:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_4d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 5D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_5d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_5d
- ! ***
-
-
- subroutine pa_Done_i<wp>_5d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_5d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_5d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:)
- integer, intent(in) :: n(5)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2),n(3),n(4),n(5)) )
-
- end subroutine pa_SetShape_i<wp>_5d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_5d_n( x, n1, n2, n3, n4, n5 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:)
- integer, intent(in) :: n1, n2, n3, n4, n5
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2,n3,n4,n5/) )
-
- end subroutine pa_SetShape_i<wp>_5d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_5d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:)
- integer(<wp>), intent(in) :: y(:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_5d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 6D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_6d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_6d
- ! ***
-
-
- subroutine pa_Done_i<wp>_6d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_6d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_6d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:)
- integer, intent(in) :: n(6)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2),n(3),n(4),n(5),n(6)) )
-
- end subroutine pa_SetShape_i<wp>_6d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_6d_n( x, n1, n2, n3, n4, n5, n6 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:)
- integer, intent(in) :: n1, n2, n3, n4, n5, n6
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2,n3,n4,n5,n6/) )
-
- end subroutine pa_SetShape_i<wp>_6d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_6d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:)
- integer(<wp>), intent(in) :: y(:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_6d
- ! *******************************************
- ! ***
- ! *** integer(<wp>) 7D
- ! ***
- ! *******************************************
-
-
- subroutine pa_Init_i<wp>_7d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- nullify( x )
-
- end subroutine pa_Init_i<wp>_7d
- ! ***
-
-
- subroutine pa_Done_i<wp>_7d( x )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) deallocate( x )
-
- end subroutine pa_Done_i<wp>_7d
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_7d_shp( x, n )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:,:)
- integer, intent(in) :: n(7)
-
- ! --- begin ---------------------------
-
- if ( associated(x) ) then
- if ( any( shape(x) /= n ) ) deallocate( x )
- end if
- if ( .not. associated(x) ) allocate( x(n(1),n(2),n(3),n(4),n(5),n(6),n(7)) )
-
- end subroutine pa_SetShape_i<wp>_7d_shp
- ! ***
-
-
- subroutine pa_SetShape_i<wp>_7d_n( x, n1, n2, n3, n4, n5, n6, n7 )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:,:)
- integer, intent(in) :: n1, n2, n3, n4, n5, n6, n7
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, (/n1,n2,n3,n4,n5,n6,n7/) )
-
- end subroutine pa_SetShape_i<wp>_7d_n
- ! ***
-
-
- subroutine pa_SetCopy_i<wp>_7d( x, y )
-
- ! --- in/out ---------------------------
-
- integer(<wp>), pointer :: x(:,:,:,:,:,:,:)
- integer(<wp>), intent(in) :: y(:,:,:,:,:,:,:)
-
- ! --- begin ---------------------------
-
- call pa_SetShape( x, shape(y) )
- x = y
-
- end subroutine pa_SetCopy_i<wp>_7d
- end module PArray_i<wp>
|