sort_array2 Subroutine

public subroutine sort_array2(tab_inout, tab0, tab1, tab2, tab3, n)

Sort 1D arrays, real or integer, according the first one

Arguments

Type IntentOptional Attributes Name
class(*), intent(inout), dimension(n) :: tab_inout

reference array to sort

integer(kind=I4), intent(inout), optional, dimension(n) :: tab0

second array to sort according the order of the first one

class(*), intent(inout), optional, dimension(n) :: tab1

third array to sort according the order of the first one

class(*), intent(inout), optional, dimension(n) :: tab2

4th array to sort according the order of the first one

class(*), intent(inout), optional, dimension(n) :: tab3

5th array to sort according the order of the first one

integer(kind=I4), intent(in) :: n

size of the arrays


Calls

proc~~sort_array2~~CallsGraph proc~sort_array2 sort_array2 proc~change_array_order change_array_order proc~sort_array2->proc~change_array_order proc~init_order init_order proc~sort_array2->proc~init_order proc~sort_array_integer_with_order sort_array_integer_with_order proc~sort_array2->proc~sort_array_integer_with_order proc~sort_array_real_with_order sort_array_real_with_order proc~sort_array2->proc~sort_array_real_with_order proc~sort_array_integer_with_order->proc~sort_array_integer_with_order proc~sort_array_real_with_order->proc~sort_array_real_with_order

Called by

proc~~sort_array2~~CalledByGraph proc~sort_array2 sort_array2 proc~from_elemental_to_assembled from_elemental_to_assembled proc~from_elemental_to_assembled->proc~sort_array2 proc~melange melange proc~melange->proc~sort_array2 proc~read_surf~2 read_surf proc~read_surf~2->proc~sort_array2 program~main main program~main->proc~sort_array2 proc~convert_matrice_format convert_matrice_format proc~convert_matrice_format->proc~from_elemental_to_assembled program~test_algen test_algen program~test_algen->proc~melange program~test_surfile test_surfile program~test_surfile->proc~read_surf~2 program~test_solvers test_solvers program~test_solvers->proc~convert_matrice_format

Source Code

   subroutine sort_array2(tab_inout, tab0, tab1, tab2, tab3, n)
   !! Sort 1D arrays, real or integer, according the first one
   implicit none
   integer(kind=I4), intent(in)                            :: n            !! *size of the arrays*
   class(*)        , intent(inout), dimension(n)           :: tab_inout    !! *reference array to sort*
   integer(kind=I4), intent(inout), dimension(n), optional :: tab0         !! *second array to sort according the order of the first one*
   class(*)        , intent(inout), dimension(n), optional :: tab1         !! *third array to sort according the order of the first one*
   class(*)        , intent(inout), dimension(n), optional :: tab2         !! *4th array to sort according the order of the first one*
   class(*)        , intent(inout), dimension(n), optional :: tab3         !! *5th array to sort according the order of the first one*

      integer(kind=I4), allocatable, dimension(:) :: tab_order

      allocate( tab_order(1:n) )

      if ( .not.present(tab0) ) then

         call init_order(order = tab_order(1:n), n = n)

      else

         tab_order(1:n) = tab0(1:n)

      endif

      select type(tab_inout)

         type is( integer(kind=I4) )
            call sort_array_integer_with_order(g = 1, d = n, itabref = tab_inout(1:n), order = tab_order(1:n))

         type is( real(kind=R8) )
            call sort_array_real_with_order   (g = 1, d = n, rtabref = tab_inout(1:n), order = tab_order(1:n))

      endselect

      if ( present(tab1) ) call change_array_order(tab_inout = tab1(1:n), order = tab_order(1:n), n = n)
      if ( present(tab2) ) call change_array_order(tab_inout = tab2(1:n), order = tab_order(1:n), n = n)
      if ( present(tab3) ) call change_array_order(tab_inout = tab3(1:n), order = tab_order(1:n), n = n)

      if ( present(tab0) ) then

          tab0(1:n) = tab_order(1:n)

      endif

      deallocate( tab_order )

   return
   endsubroutine sort_array2