Ignore:
Timestamp:
Jul 15, 2020, 10:14:34 PM (4 years ago)
Author:
adurocher
Message:

Use blocks to allocate compressed arrays to the right size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/cv3a_compress.f90

    r3758 r3760  
    3434 
    3535  public :: array_list, add_array_i1, add_array_r1, add_array_r2, add_array_r3, &
    36             cv3a_compress, cv3a_uncompress, compress_data_t
     36            get_compress_size, cv3a_compress, cv3a_uncompress, compress_data_t
    3737 
    3838  contains
     
    9393    arrays%arrays_r(1,c)%buf => array_in
    9494    arrays%arrays_r(2,c)%buf => array_out
    95   end subroutine
     95  end subroutine
     96
     97  function get_compress_size(len, mask) result(ncum)
     98    use mod_phys_lmdz_omp_data, only : omp_rank
     99    integer, INTENT (IN) :: len ! lenght of the contiguous dimension of arrays to compress
     100    logical, INTENT (IN) :: mask(len) ! Mask of convective cells
     101    integer :: ncum ! Number of cells in compressed arrays (first dimension)
     102   
     103    select case (compress_mode)
     104      case (COMPRESS_MODE_COMPRESS)
     105          ncum = count(mask)
     106      case (COMPRESS_MODE_COPY)
     107          ncum = len
     108      case default
     109        call abort_physic("get_compress_size", "Unknown compress mode", 1)
     110    end select
     111  end function
    96112   
    97113  ! Compress arrays from 'arrays' according to 'mask'.
Note: See TracChangeset for help on using the changeset viewer.