particle_soa_allocate Subroutine

private subroutine particle_soa_allocate(this, n, err)

Give the container n live elements, discarding any it already had.

Equivalent to clear followed by resize(n), so calling it twice is well defined: the second call simply replaces the contents. Every element is set to the zero value of its field’s type. Capacity is never lowered, so a smaller second call reuses the existing memory.

On failure the container is left empty rather than half filled.

Type Bound

particle_soa_t

Arguments

Type IntentOptional Attributes Name
class(particle_soa_t), intent(inout) :: this

Container to (re)allocate.

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

Number of live elements. Must not be negative.

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

Error state, ERROR_VALIDATION on a negative n and ERROR_ALLOC if the field arrays cannot be allocated.


Calls

proc~~particle_soa_allocate~~CallsGraph proc~particle_soa_allocate particle_soa_t%particle_soa_allocate proc~particle_soa_resize particle_soa_t%particle_soa_resize proc~particle_soa_allocate->proc~particle_soa_resize interface~soa_resize_field soa_resize_field proc~particle_soa_resize->interface~soa_resize_field proc~error_has_error error_t%error_has_error proc~particle_soa_resize->proc~error_has_error proc~soa_plan_resize soa_plan_resize proc~particle_soa_resize->proc~soa_plan_resize proc~soa_resize_int32_field soa_resize_int32_field interface~soa_resize_field->proc~soa_resize_int32_field proc~soa_resize_int64_field soa_resize_int64_field interface~soa_resize_field->proc~soa_resize_int64_field proc~soa_resize_logical_field soa_resize_logical_field interface~soa_resize_field->proc~soa_resize_logical_field proc~soa_resize_real_dp_field soa_resize_real_dp_field interface~soa_resize_field->proc~soa_resize_real_dp_field proc~soa_resize_real_sp_field soa_resize_real_sp_field interface~soa_resize_field->proc~soa_resize_real_sp_field interface~to_char to_char proc~soa_plan_resize->interface~to_char proc~error_set error_t%error_set proc~soa_plan_resize->proc~error_set proc~soa_grow_capacity soa_grow_capacity proc~soa_plan_resize->proc~soa_grow_capacity 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 proc~soa_resize_int32_field->proc~error_has_error proc~soa_check_alloc soa_check_alloc proc~soa_resize_int32_field->proc~soa_check_alloc proc~soa_check_resize_args soa_check_resize_args proc~soa_resize_int32_field->proc~soa_check_resize_args proc~soa_resize_int64_field->proc~error_has_error proc~soa_resize_int64_field->proc~soa_check_alloc proc~soa_resize_int64_field->proc~soa_check_resize_args proc~soa_resize_logical_field->proc~error_has_error proc~soa_resize_logical_field->proc~soa_check_alloc proc~soa_resize_logical_field->proc~soa_check_resize_args proc~soa_resize_real_dp_field->proc~error_has_error proc~soa_resize_real_dp_field->proc~soa_check_alloc proc~soa_resize_real_dp_field->proc~soa_check_resize_args proc~soa_resize_real_sp_field->proc~error_has_error proc~soa_resize_real_sp_field->proc~soa_check_alloc proc~soa_resize_real_sp_field->proc~soa_check_resize_args proc~soa_check_alloc->interface~to_char proc~soa_check_alloc->proc~error_set proc~soa_check_resize_args->interface~to_char proc~soa_check_resize_args->proc~error_set

Source Code

   subroutine particle_soa_allocate(this, n, err)
      !! Give the container `n` live elements, discarding any it already had.
      !!
      !! Equivalent to `clear` followed by `resize(n)`, so calling it twice is
      !! well defined: the second call simply replaces the contents. Every
      !! element is set to the zero value of its field's type. Capacity is
      !! never lowered, so a smaller second call reuses the existing memory.
      !!
      !! On failure the container is left empty rather than half filled.
      class(particle_soa_t), intent(inout) :: this
         !! Container to (re)allocate.
      integer(default_int), intent(in) :: n
         !! Number of live elements. Must not be negative.
      type(error_t), intent(inout) :: err
         !! Error state, `ERROR_VALIDATION` on a negative `n` and
         !! `ERROR_ALLOC` if the field arrays cannot be allocated.

      this%extent%used = 0
      call this%resize(n, err)
   end subroutine particle_soa_allocate