write_dataarray1_rank2_I4P Function

private function write_dataarray1_rank2_I4P(self, data_name, x, one_component, is_tuples) result(error)

Arguments

TypeIntentOptionalAttributesName
class(xml_writer_appended), intent(inout) :: self
character, intent(in) :: data_name
integer(kind=I4P), intent(in) :: x(1:,1:)
logical, intent(in), optional :: one_component
logical, intent(in), optional :: is_tuples

Return Value integer(kind=I4P)


Contents


Source Code

  function write_dataarray1_rank2_I4P(self, data_name, x, one_component, is_tuples) result(error)
  !< Write `<DataArray... NumberOfComponents="n"...>...</DataArray>` tag (I4P).
  class(xml_writer_appended), intent(inout)        :: self          !< Writer.
  character(*),               intent(in)           :: data_name     !< Data name.
  integer(I4P),               intent(in)           :: x(1:,1:)      !< Data variable.
  logical,                    intent(in), optional :: one_component !< Force one component.
  logical,                    intent(in), optional :: is_tuples     !< Use "NumberOfTuples".
  integer(I4P)                                     :: error         !< Error status.
  character(len=:), allocatable                    :: data_type     !< Data type.
  integer(I4P)                                     :: n_components  !< Number of components.

  data_type = 'Int32'
  n_components = size(x, dim=1)
  if (present(one_component)) then
    if (one_component) n_components = 1
  endif
  call self%write_dataarray_tag_appended(data_type=data_type, number_of_components=n_components, data_name=data_name, &
                                         is_tuples=is_tuples)
  call self%ioffset_update(n_byte=self%write_on_scratch_dataarray(x=x))
  error = self%error
  endfunction write_dataarray1_rank2_I4P