particle_soa_deserialize Subroutine

private subroutine particle_soa_deserialize(this, unit, err)

Read a container back from an open stream unit.

Validates the envelope and the schema string before touching any payload, so a stream written from a different field list is rejected with ERROR_VALIDATION rather than decoded as garbage. Every field record must hold exactly the element count the prologue announced.

On success the container holds exactly the elements from the stream and its capacity equals its size. On failure it is left deallocated rather than half filled.

Type Bound

particle_soa_t

Arguments

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

Container to fill. Any previous contents are discarded.

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

Stream unit opened for unformatted stream reading.

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

Error state, ERROR_VALIDATION on a layout or length mismatch and ERROR_IO on a truncated stream.


Calls

proc~~particle_soa_deserialize~~CallsGraph proc~particle_soa_deserialize particle_soa_t%particle_soa_deserialize interface~soa_read_field soa_read_field proc~particle_soa_deserialize->interface~soa_read_field proc~error_has_error error_t%error_has_error proc~particle_soa_deserialize->proc~error_has_error proc~soa_read_prologue soa_read_prologue proc~particle_soa_deserialize->proc~soa_read_prologue proc~soa_read_int32_field soa_read_int32_field interface~soa_read_field->proc~soa_read_int32_field proc~soa_read_int64_field soa_read_int64_field interface~soa_read_field->proc~soa_read_int64_field proc~soa_read_logical_field soa_read_logical_field interface~soa_read_field->proc~soa_read_logical_field proc~soa_read_real_dp_field soa_read_real_dp_field interface~soa_read_field->proc~soa_read_real_dp_field proc~soa_read_real_sp_field soa_read_real_sp_field interface~soa_read_field->proc~soa_read_real_sp_field proc~soa_read_prologue->proc~error_has_error interface~read_array read_array proc~soa_read_prologue->interface~read_array interface~to_char to_char proc~soa_read_prologue->interface~to_char proc~error_set error_t%error_set proc~soa_read_prologue->proc~error_set proc~read_header read_header proc~soa_read_prologue->proc~read_header proc~read_char_record read_char_record interface~read_array->proc~read_char_record proc~read_int32_array read_int32_array interface~read_array->proc~read_int32_array proc~read_int64_array read_int64_array interface~read_array->proc~read_int64_array proc~read_real_dp_array read_real_dp_array interface~read_array->proc~read_real_dp_array proc~read_real_sp_array read_real_sp_array interface~read_array->proc~read_real_sp_array 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~read_header->interface~to_char proc~read_header->proc~error_set proc~bswap_int32 bswap_int32 proc~read_header->proc~bswap_int32 proc~check_io check_io proc~read_header->proc~check_io proc~soa_read_int32_field->proc~error_has_error proc~soa_read_int32_field->interface~read_array proc~soa_check_field_count soa_check_field_count proc~soa_read_int32_field->proc~soa_check_field_count proc~soa_read_int64_field->proc~error_has_error proc~soa_read_int64_field->interface~read_array proc~soa_read_int64_field->proc~soa_check_field_count proc~soa_read_logical_field->proc~error_has_error proc~soa_read_logical_field->interface~read_array proc~soa_read_logical_field->interface~to_char proc~soa_read_logical_field->proc~error_set proc~soa_check_alloc soa_check_alloc proc~soa_read_logical_field->proc~soa_check_alloc proc~soa_read_logical_field->proc~soa_check_field_count proc~soa_read_real_dp_field->proc~error_has_error proc~soa_read_real_dp_field->interface~read_array proc~soa_read_real_dp_field->proc~soa_check_field_count proc~soa_read_real_sp_field->proc~error_has_error proc~soa_read_real_sp_field->interface~read_array proc~soa_read_real_sp_field->proc~soa_check_field_count proc~check_io->interface~to_char proc~check_io->proc~error_set proc~read_char_record->proc~check_io proc~error_get_code error_t%error_get_code proc~read_char_record->proc~error_get_code proc~error_wrap error_t%error_wrap proc~read_char_record->proc~error_wrap proc~read_record_header read_record_header proc~read_char_record->proc~read_record_header proc~read_int32_array->proc~bswap_int32 proc~read_int32_array->proc~check_io proc~read_int32_array->proc~error_get_code proc~read_int32_array->proc~error_wrap proc~read_int32_array->proc~read_record_header proc~read_int64_array->proc~check_io proc~bswap_int64 bswap_int64 proc~read_int64_array->proc~bswap_int64 proc~read_int64_array->proc~error_get_code proc~read_int64_array->proc~error_wrap proc~read_int64_array->proc~read_record_header proc~read_real_dp_array->proc~check_io proc~bits_to_real_dp bits_to_real_dp proc~read_real_dp_array->proc~bits_to_real_dp proc~read_real_dp_array->proc~bswap_int64 proc~read_real_dp_array->proc~error_get_code proc~read_real_dp_array->proc~error_wrap proc~read_real_dp_array->proc~read_record_header proc~read_real_sp_array->proc~bswap_int32 proc~read_real_sp_array->proc~check_io proc~bits_to_real_sp bits_to_real_sp proc~read_real_sp_array->proc~bits_to_real_sp proc~read_real_sp_array->proc~error_get_code proc~read_real_sp_array->proc~error_wrap proc~read_real_sp_array->proc~read_record_header proc~soa_check_alloc->interface~to_char proc~soa_check_alloc->proc~error_set proc~soa_check_field_count->interface~to_char proc~soa_check_field_count->proc~error_set proc~error_wrap->proc~error_has_error proc~clip_tail clip_tail proc~error_wrap->proc~clip_tail proc~read_record_header->interface~to_char proc~read_record_header->proc~error_set proc~read_record_header->proc~bswap_int32 proc~read_record_header->proc~check_io proc~read_record_header->proc~bswap_int64 proc~element_bytes element_bytes proc~read_record_header->proc~element_bytes

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: n
logical, private :: swapped

Source Code

   subroutine particle_soa_deserialize(this, unit, err)
      !! Read a container back from an open stream unit.
      !!
      !! Validates the envelope and the schema string before touching any
      !! payload, so a stream written from a different field list is rejected
      !! with `ERROR_VALIDATION` rather than decoded as garbage. Every field
      !! record must hold exactly the element count the prologue announced.
      !!
      !! On success the container holds exactly the elements from the stream
      !! and its capacity equals its size. On failure it is left deallocated
      !! rather than half filled.
      class(particle_soa_t), intent(inout) :: this
         !! Container to fill. Any previous contents are discarded.
      integer(default_int), intent(in) :: unit
         !! Stream unit opened for unformatted stream reading.
      type(error_t), intent(inout) :: err
         !! Error state, `ERROR_VALIDATION` on a layout or length mismatch and
         !! `ERROR_IO` on a truncated stream.

      integer(default_int) :: n
      logical :: swapped

      call this%deallocate()

      call soa_read_prologue(unit, PARTICLE_SOA_SCHEMA, n, swapped, err)
      if (err%has_error()) return

      call soa_read_field(unit, "id", this%id, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if
      call soa_read_field(unit, "x", this%x, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if
      call soa_read_field(unit, "y", this%y, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if
      call soa_read_field(unit, "z", this%z, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if
      call soa_read_field(unit, "mass", this%mass, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if
      call soa_read_field(unit, "active", this%active, n, swapped, err)
      if (err%has_error()) then
         call this%deallocate()
         return
      end if

      this%extent%used = n
      this%extent%capacity = n
   end subroutine particle_soa_deserialize