anchor.diff:    return
     !---------------------------------------------------------------------------------------------------------------------------------
     endfunction VTK_INI_XML
  +
  +
  +!-----------------------------------------------------------------------------------------------------------------------------------
  +  function VTK_INI_XML_READ(input_format,filename,mesh_topology,npieces,nx1,nx2,ny1,ny2,nz1,nz2,cf) result(E_IO)
  +!  function VTK_INI_XML(output_format,filename,mesh_topology,cf,nx1,nx2,ny1,ny2,nz1,nz2) result(E_IO)
  +  !---------------------------------------------------------------------------------------------------------------------------------
  +  !< Procedure for initializing VTK-XML file when reading.
  +  !<
  +  !< Supported input formats are (the passed specifier value is case insensitive):
  +  !<- ASCII: data are saved in ASCII format; (Not implemented!)
  +  !<- BINARY: data are saved in base64 encoded format; (Not tested!)
  +  !<- RAW: data are saved in raw-binary format in the appended tag of the XML file; (Not implemented!)
  +  !<- BINARY-APPENDED: data are saved in base64 encoded format in the appended tag of the XML file. (Not implemented!)
  +  !< Supported topologies are:
  +  !<- RectilinearGrid; (Not supported!)
  +  !<- StructuredGrid; (Not supported)
  +  !<- UnstructuredGrid.
  +  !<### Example of usage
  +  !<```fortran
  +  !< integer(I4P):: nx1,nx2,ny1,ny2,nz1,nz2
  +  !< ...
  +  !< E_IO = VTK_INI_XML_READ('BINARY','XML_RECT_BINARY.vtr','RectilinearGrid',nx1=nx1,nx2=nx2,ny1=ny1,ny2=ny2,nz1=nz1,nz2=nz2)
  +  !< ...
  +  !<```
  +  !< Note that the file extension is necessary in the file name. The XML standard has different extensions for each
  +  !< different topologies (e.g. *vtr* for rectilinear topology). See the VTK-standard file for more information.
  +  !---------------------------------------------------------------------------------------------------------------------------------
  +  character(*), intent(IN)            :: input_format   !< input format: ASCII or BINARY
  +  character(*), intent(IN)            :: filename       !< file name
  +  character(*), intent(IN)            :: mesh_topology  !< mesh topology
  +  integer(I4P), intent(OUT), optional :: npieces        !< Number of pieces stored in the file
  +  integer(I4P), intent(OUT), optional :: nx1            !< Initial node of x axis.
  +  integer(I4P), intent(OUT), optional :: nx2            !< Final node of x axis.
  +  integer(I4P), intent(OUT), optional :: ny1            !< Initial node of y axis.
  +  integer(I4P), intent(OUT), optional :: ny2            !< Final node of y axis.
  +  integer(I4P), intent(OUT), optional :: nz1            !< Initial node of z axis.
  +  integer(I4P), intent(OUT), optional :: nz2            !< Final node of z axis.
  +  integer(I4P), intent(OUT), optional :: cf             !< Current file index (for concurrent files IO).
  +  integer(I4P)                        :: rf             !< Real file index.
  +  integer(I4P)                        :: np             !< Real number of pieces.
  +  character(len=:),allocatable        :: s_buffer       !< Buffer string.
  +  integer(I4P)                        :: E_IO           !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
  +  character                           :: c1, c2
  +  character(len=:),allocatable        :: aux
  +  integer(I4P), dimension(6)          :: rn  !< Real node numbers
  +
  +  E_IO = -1_I4P
  +  if (.not.ir_initialized) call IR_Init
  +  if (.not.b64_initialized) call b64_init
  +  call vtk_update(act='add',cf=rf,Nvtk=Nvtk,vtk=vtk)
  +  f = rf
  +  if (present(cf)) cf = rf
  +  vtk(rf)%topology = trim(mesh_topology)
  +  select case(trim(Upper_Case(input_format)))
  +  case('ASCII')
  +    vtk(rf)%f = ascii
  +
  +  case('BINARY')
  +    vtk(rf)%f = binary
  +    select case(trim(vtk(rf)%topology))
  +    case('RectilinearGrid')
  +      open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),status='old', &
  +           form='UNFORMATTED',access='STREAM',action='READ', &
  +           convert='BIG_ENDIAN',iostat=E_IO, position='REWIND')
  +
  +      ! Get WholeExtent
  +      E_IO = move(inside='VTKFile', to_find='RectilinearGrid', repeat=1, cf=rf,buffer=s_buffer)
  +      call get_char(buffer=s_buffer, attrib='WholeExtent', val=aux)
  +      read(aux,*) rn
  +      if(present(nx1)) nx1 = rn(1)
  +      if(present(nx2)) nx2 = rn(2)
  +      if(present(ny1)) ny1 = rn(3)
  +      if(present(ny2)) ny2 = rn(4)
  +      if(present(nz1)) nz1 = rn(5)
  +      if(present(nz2)) nz2 = rn(6)
  +
  +      ! count the pieces
  +      rewind(unit=vtk(rf)%u, iostat=E_IO)
  +      np = 0
  +      do
  +        E_IO = read_record(s_buffer, cf=rf)
  +        s_buffer = trim(adjustl(Upper_Case(s_buffer)))
  +        if (index(s_buffer, '</RECTILINEARGRID') > 0) exit !end of ASCII header section found
  +        if (index(s_buffer, '<PIECE') > 0) np = np + 1
  +      enddo
  +!      ! calculate the offset to reach the appended data
  +!      rewind(unit=vtk(rf)%u, iostat=E_IO)
  +!      read(unit=vtk(rf)%u,iostat=E_IO) c1
  +!      do 
  +!        read(unit=vtk(rf)%u,iostat=E_IO) c2
  +!        if (iachar(c1)==10 .or. c2 =='_') exit
  +!        c1 = c2
  +!      enddo
  +      inquire(unit=vtk(rf)%u, pos=vtk(rf)%ioffset)
  +
  +    case('StructuredGrid')
  +
  +      open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),status='old', &
  +           form='UNFORMATTED',access='STREAM',action='READ', &
  +           convert='BIG_ENDIAN',iostat=E_IO, position='REWIND')
  +
  +      ! Get WholeExtent
  +      E_IO = move(inside='VTKFile', to_find='StructuredGrid', repeat=1, cf=rf,buffer=s_buffer)
  +      call get_char(buffer=s_buffer, attrib='WholeExtent', val=aux); read(aux,*) rn
  +      if(present(nx1)) nx1 = rn(1)
  +      if(present(nx2)) nx2 = rn(2)
  +      if(present(ny1)) ny1 = rn(3)
  +      if(present(ny2)) ny2 = rn(4)
  +      if(present(nz1)) nz1 = rn(5)
  +      if(present(nz2)) nz2 = rn(6)
  +
  +      ! count the pieces
  +      rewind(unit=vtk(rf)%u, iostat=E_IO)
  +      np = 0
  +      do
  +        E_IO = read_record(s_buffer, cf=rf)
  +        s_buffer = trim(adjustl(Upper_Case(s_buffer)))
  +        if (index(s_buffer, '</STRUCTUREDGRID') > 0) exit !end of ASCII header section found
  +        if (index(s_buffer, '<PIECE') > 0) np = np + 1
  +      enddo
  +!      ! calculate the offset to reach the appended data
  +!      rewind(unit=vtk(rf)%u, iostat=E_IO)
  +!      read(unit=vtk(rf)%u,iostat=E_IO) c1
  +!      do 
  +!        read(unit=vtk(rf)%u,iostat=E_IO) c2
  +!        if (iachar(c1)==10 .or. c2 =='_') exit
  +!        c1 = c2
  +!      enddo
  +    case('UnstructuredGrid')    
  +      open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),status='old', &
  +           form='UNFORMATTED',access='STREAM',action='READ', &
  +           convert='BIG_ENDIAN',iostat=E_IO, position='REWIND')
  +      ! count the pieces
  +      np = 0
  +      do
  +        E_IO = read_record(s_buffer, cf=rf)
  +        s_buffer = trim(adjustl(Upper_Case(s_buffer)))
  +        if (index(s_buffer, '</UNSTRUCTUREDGRID') > 0) exit !end of ASCII header section found
  +        if (index(s_buffer, '<PIECE') > 0) np = np + 1
  +      enddo
  +!      ! calculate the offset to reach the appended data
  +!      rewind(unit=vtk(rf)%u, iostat=E_IO)
  +!      read(unit=vtk(rf)%u,iostat=E_IO) c1
  +!      do 
  +!        read(unit=vtk(rf)%u,iostat=E_IO) c2
  +!        if (iachar(c1)==10 .or. c2 =='_') exit
  +!        c1 = c2
  +!      enddo
  +      inquire(unit=vtk(rf)%u, pos=vtk(rf)%ioffset)
  +    end select
  +  end select  
  +  if(present(npieces)) npieces = np
  +  end function VTK_INI_XML_READ
  +
  +
  +
  +  function VTK_END_XML_READ(cf) result(E_IO)
  +  !---------------------------------------------------------------------------------------------------------------------------------
  +  !< Function for close an opened VTK file.
  +  !---------------------------------------------------------------------------------------------------------------------------------
  +  integer(I4P), optional :: cf
  +  integer(I4P) :: rf
  +  integer(I4P) :: E_IO 
  +
  +
  +  rf = f 
  +  if (present(cf)) rf = cf
  +  
  +  select case(vtk(rf)%f)
  +  case(ascii)
  +    stop 'Not implemented'
  +  case(binary)
  +    close(unit=vtk(rf)%u, iostat=E_IO)
  +  end select
  +  end function
  +
   
     function VTK_FLD_XML_OC(fld_action,cf) result(E_IO)
     !---------------------------------------------------------------------------------------------------------------------------------
  
positive.code:   return
    !---------------------------------------------------------------------------------------------------------------------------------
    endsubroutine vtk_update
  
    ! VTK functions
    function VTK_INI_XML(output_format,filename,mesh_topology,cf,nx1,nx2,ny1,ny2,nz1,nz2) result(E_IO)
  
negative.code: public:: VTK_DAT_XML
  public:: VTK_VAR_XML
  public:: VTK_END_XML
  ! functions for VTK XML READ
  public:: VTK_INI_XML_READ
  public:: VTK_END_XML_READ
  ! functions for VTM XML
  public:: VTM_INI_XML
  public:: VTM_BLK_XML
  