subroutine write_topology_tag(self, nx1, nx2, ny1, ny2, nz1, nz2, mesh_kind)
!< Write XML topology tag.
class(xml_writer_abstract), intent(inout) :: self !< Writer.
integer(I4P), intent(in), optional :: nx1 !< Initial node of x axis.
integer(I4P), intent(in), optional :: nx2 !< Final node of x axis.
integer(I4P), intent(in), optional :: ny1 !< Initial node of y axis.
integer(I4P), intent(in), optional :: ny2 !< Final node of y axis.
integer(I4P), intent(in), optional :: nz1 !< Initial node of z axis.
integer(I4P), intent(in), optional :: nz2 !< Final node of z axis.
character(*), intent(in), optional :: mesh_kind !< Kind of mesh data: Float64, Float32, ecc.
type(string) :: buffer !< Buffer string.
buffer = ''
select case(self%topology%chars())
case('RectilinearGrid', 'StructuredGrid')
buffer = 'WholeExtent="'// &
trim(str(n=nx1))//' '//trim(str(n=nx2))//' '//&
trim(str(n=ny1))//' '//trim(str(n=ny2))//' '//&
trim(str(n=nz1))//' '//trim(str(n=nz2))//'"'
case('PRectilinearGrid', 'PStructuredGrid')
buffer = 'WholeExtent="'// &
trim(str(n=nx1))//' '//trim(str(n=nx2))//' '//&
trim(str(n=ny1))//' '//trim(str(n=ny2))//' '//&
trim(str(n=nz1))//' '//trim(str(n=nz2))//'" GhostLevel="#"'
case('PUnstructuredGrid')
buffer = 'GhostLevel="0"'
endselect
call self%write_start_tag(name=self%topology%chars(), attributes=buffer%chars())
! parallel topologies peculiars
select case(self%topology%chars())
case('PRectilinearGrid')
if (.not.present(mesh_kind)) then
self%error = 1
return
endif
call self%write_start_tag(name='PCoordinates')
call self%write_self_closing_tag(name='PDataArray', attributes='type="'//trim(mesh_kind)//'"')
call self%write_self_closing_tag(name='PDataArray', attributes='type="'//trim(mesh_kind)//'"')
call self%write_self_closing_tag(name='PDataArray', attributes='type="'//trim(mesh_kind)//'"')
call self%write_end_tag(name='PCoordinates')
case('PStructuredGrid', 'PUnstructuredGrid')
if (.not.present(mesh_kind)) then
self%error = 1
return
endif
call self%write_start_tag(name='PPoints')
call self%write_self_closing_tag(name='PDataArray', &
attributes='type="'//trim(mesh_kind)//'" NumberOfComponents="3" Name="Points"')
call self%write_end_tag(name='PPoints')
endselect
endsubroutine write_topology_tag