write_on_scratch_dataarray1_rank4 Function

private function write_on_scratch_dataarray1_rank4(self, x) result(n_byte)

Arguments

TypeIntentOptionalAttributesName
class(xml_writer_appended), intent(inout) :: self
class(*), intent(in) :: x(1:,1:,1:,1:)

Return Value integer(kind=I4P)


Contents


Source Code

  function write_on_scratch_dataarray1_rank4(self, x) result(n_byte)
  !< Write a dataarray with 1 components of rank 4.
  class(xml_writer_appended), intent(inout) :: self           !< Writer.
  class(*),                   intent(in)    :: x(1:,1:,1:,1:) !< Data variable.
  integer(I4P)                              :: n_byte         !< Number of bytes
  integer(I4P)                              :: nn             !< Number of elements.

  nn = size(x, dim=1)*size(x, dim=2)*size(x, dim=3)*size(x, dim=4)
  select type(x)
  type is(real(R8P))
    n_byte = nn*BYR8P
    write(unit=self%scratch, iostat=self%error)n_byte, 'R8', nn
    write(unit=self%scratch, iostat=self%error)x
  type is(real(R4P))
    n_byte = nn*BYR4P
    write(unit=self%scratch, iostat=self%error)n_byte, 'R4', nn
    write(unit=self%scratch, iostat=self%error)x
  type is(integer(I8P))
    n_byte = nn*BYI8P
    write(unit=self%scratch, iostat=self%error)n_byte, 'I8', nn
    write(unit=self%scratch, iostat=self%error)x
  type is(integer(I4P))
    n_byte = nn*BYI4P
    write(unit=self%scratch, iostat=self%error)n_byte, 'I4', nn
    write(unit=self%scratch, iostat=self%error)x
  type is(integer(I2P))
    n_byte = nn*BYI2P
    write(unit=self%scratch, iostat=self%error)n_byte, 'I2', nn
    write(unit=self%scratch, iostat=self%error)x
  type is(integer(I1P))
    n_byte = nn*BYI1P
    write(unit=self%scratch, iostat=self%error)n_byte, 'I1', nn
    write(unit=self%scratch, iostat=self%error)x
  endselect
  endfunction write_on_scratch_dataarray1_rank4