add_tag Subroutine

private elemental subroutine add_tag(self, tag)

Arguments

Type IntentOptional AttributesName
class(xml_file), intent(inout) :: self

XML file.

type(xml_tag), intent(in) :: tag

XML tag.

Description

Add tag to XML file.


Variables

TypeVisibility AttributesNameInitial
type(xml_tag), public, allocatable:: tag_new(:)

New (extended) tags array.


Source Code

  elemental subroutine add_tag(self, tag)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Add tag to XML file.
  !---------------------------------------------------------------------------------------------------------------------------------
  class(xml_file), intent(inout) :: self       !< XML file.
  type(xml_tag),   intent(in)    :: tag        !< XML tag.
  type(xml_tag), allocatable     :: tag_new(:) !< New (extended) tags array.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  if (self%Nt>0_I4P) then
    allocate(tag_new(1:self%Nt + 1))
    tag_new(1:self%Nt) = self%tag(1:self%Nt)
    tag_new(self%Nt + 1) = tag
  else
    allocate(tag_new(1:1))
    tag_new(1) = tag
  endif
  call move_alloc(from=tag_new, to=self%tag)
  self%Nt = self%Nt + 1
  !---------------------------------------------------------------------------------------------------------------------------------
  endsubroutine add_tag