soa_check_resize_args Subroutine

public subroutine soa_check_resize_args(new_capacity, keep, fill_to, err)

Validate the arguments of a field resize.

Rejects negative lengths and any request to preserve or fill more elements than the new array will hold.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: new_capacity

Requested allocated length.

integer(kind=default_int), intent(in) :: keep

Number of leading elements to preserve.

integer(kind=default_int), intent(in) :: fill_to

Highest index to zero-fill above keep.

type(error_t), intent(inout) :: err

Error state, ERROR_VALIDATION on an inconsistent request.


Calls

proc~~soa_check_resize_args~~CallsGraph proc~soa_check_resize_args soa_check_resize_args interface~to_char to_char proc~soa_check_resize_args->interface~to_char proc~error_set error_t%error_set proc~soa_check_resize_args->proc~error_set proc~to_char_char to_char_char interface~to_char->proc~to_char_char proc~to_char_dp to_char_dp interface~to_char->proc~to_char_dp proc~to_char_int32 to_char_int32 interface~to_char->proc~to_char_int32 proc~to_char_int64 to_char_int64 interface~to_char->proc~to_char_int64 proc~to_char_logical to_char_logical interface~to_char->proc~to_char_logical proc~to_char_matrix_dp to_char_matrix_dp interface~to_char->proc~to_char_matrix_dp proc~to_char_matrix_int32 to_char_matrix_int32 interface~to_char->proc~to_char_matrix_int32 proc~to_char_matrix_int64 to_char_matrix_int64 interface~to_char->proc~to_char_matrix_int64 proc~to_char_matrix_sp to_char_matrix_sp interface~to_char->proc~to_char_matrix_sp proc~to_char_sp to_char_sp interface~to_char->proc~to_char_sp proc~to_char_vector_dp to_char_vector_dp interface~to_char->proc~to_char_vector_dp proc~to_char_vector_int32 to_char_vector_int32 interface~to_char->proc~to_char_vector_int32 proc~to_char_vector_int64 to_char_vector_int64 interface~to_char->proc~to_char_vector_int64 proc~to_char_vector_sp to_char_vector_sp interface~to_char->proc~to_char_vector_sp

Called by

proc~~soa_check_resize_args~~CalledByGraph proc~soa_check_resize_args soa_check_resize_args proc~soa_resize_int32_field soa_resize_int32_field proc~soa_resize_int32_field->proc~soa_check_resize_args proc~soa_resize_int64_field soa_resize_int64_field proc~soa_resize_int64_field->proc~soa_check_resize_args proc~soa_resize_logical_field soa_resize_logical_field proc~soa_resize_logical_field->proc~soa_check_resize_args proc~soa_resize_real_dp_field soa_resize_real_dp_field proc~soa_resize_real_dp_field->proc~soa_check_resize_args proc~soa_resize_real_sp_field soa_resize_real_sp_field proc~soa_resize_real_sp_field->proc~soa_check_resize_args interface~soa_resize_field soa_resize_field interface~soa_resize_field->proc~soa_resize_int32_field interface~soa_resize_field->proc~soa_resize_int64_field interface~soa_resize_field->proc~soa_resize_logical_field interface~soa_resize_field->proc~soa_resize_real_dp_field interface~soa_resize_field->proc~soa_resize_real_sp_field proc~particle_soa_resize particle_soa_t%particle_soa_resize proc~particle_soa_resize->interface~soa_resize_field proc~particle_soa_allocate particle_soa_t%particle_soa_allocate proc~particle_soa_allocate->proc~particle_soa_resize

Source Code

   subroutine soa_check_resize_args(new_capacity, keep, fill_to, err)
      !! Validate the arguments of a field resize.
      !!
      !! Rejects negative lengths and any request to preserve or fill more
      !! elements than the new array will hold.
      integer(default_int), intent(in) :: new_capacity
         !! Requested allocated length.
      integer(default_int), intent(in) :: keep
         !! Number of leading elements to preserve.
      integer(default_int), intent(in) :: fill_to
         !! Highest index to zero-fill above `keep`.
      type(error_t), intent(inout) :: err
         !! Error state, `ERROR_VALIDATION` on an inconsistent request.

      if (new_capacity < 0 .or. keep < 0 .or. fill_to < 0) then
         call err%set(ERROR_VALIDATION, "soa: negative length in resize request")
         return
      end if
      if (keep > new_capacity .or. fill_to > new_capacity) then
         call err%set(ERROR_VALIDATION, "soa: resize would keep or fill past the new capacity "// &
                      to_char(int(new_capacity, int64)))
      end if
   end subroutine soa_check_resize_args