VTK_INI Function

public function VTK_INI(output_format, filename, title, mesh_topology) result(E_IO)

The VTK_INI function is used for initializing file. This function must be the first to be called.

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: output_format
character(len=*), intent(in) :: filename
character(len=*), intent(in) :: title
character(len=*), intent(in) :: mesh_topology

Return Value integer(kind=I4P)

The VTK_INI variables have the following meaning:

The following is an example of VTK_INI calling:

\noindent Note that the \virgo{.vtk} extension is necessary in the file name.


Calls

proc~~vtk_ini~~CallsGraph proc~vtk_ini VTK_INI proc~upper_case Upper_Case proc~vtk_ini->proc~upper_case proc~getunit GetUnit proc~vtk_ini->proc~getunit

Called by

proc~~vtk_ini~~CalledByGraph proc~vtk_ini VTK_INI proc~save_fe_f_vtk save_fe_f_vtk proc~save_fe_f_vtk->proc~vtk_ini

Contents

Source Code


Source Code

  function VTK_INI(output_format,filename,title,mesh_topology) result(E_IO)
  !---------------------------------------------------------------------------------------------------------------------------------
  !!The VTK\_INI function is used for initializing file. This function must be the first to be called.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  character(*), intent(IN):: output_format ! output format: ASCII or BINARY
  character(*), intent(IN):: filename      ! name of file
  character(*), intent(IN):: title         ! title
  character(*), intent(IN):: mesh_topology ! mesh topology
  integer(I4P)::             E_IO          ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
  !!The VTK\_INI variables have the following meaning:
  !!
  !!\begin{description}
  !! \item[{\color{RoyalBlue}output\_format}] indicates the \virgo{format} of output file. It can assume the following values:
  !! \begin{enumerateABlu}
  !!  \item \emph{ascii} (it is case insensitive) $\rightarrow$ creating an ascii output file.
  !!  \item \emph{binary} (it is case insensitive) $\rightarrow$ creating a binary (big\_endian encoding) output file.
  !! \end{enumerateABlu}
  !! \item[{\color{RoyalBlue}filename}] contains the name (with its path) of the output file.
  !! \item[{\color{RoyalBlue}title}] contains the title of the VTK dataset.
  !! \item[{\color{RoyalBlue}topology}] indicates the topology of the mesh and can assume the following values:
  !! \begin{enumerateABlu}
  !!  \item \emph{STRUCTURED\_POINTS}.
  !!  \item \emph{STRUCTURED\_GRID}.
  !!  \item \emph{UNSTRUCTURED\_GRID}.
  !!  \item \emph{RECTILINEAR\_GRID}.
  !! \end{enumerateABlu}
  !! \item[{\color{RoyalBlue}E\_IO}] contains the inquiring integer flag for error handling.
  !!\end{description}
  !!
  !!The following is an example of VTK\_INI calling:
  !!
  !!\begin{boxred}{VTK\_INI Calling}
  !!\begin{verbatim}
  !!...
  !!E_IO = VTK_INI('Binary','example.vtk','VTK legacy file','UNSTRUCTURED_GRID')
  !!...
  !!\end{verbatim}
  !!\end{boxred}
  !!\noindent Note that the \virgo{.vtk} extension is necessary in the file name.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  topology = trim(mesh_topology)
  Unit_VTK=GetUnit()
  select case(trim(Upper_Case(output_format)))
  case('ASCII')
    f_out = f_out_ascii
    open(unit     = Unit_VTK,       &
         file     = trim(filename), &
         form     = 'FORMATTED',    &
         access   = 'SEQUENTIAL',   &
         action   = 'WRITE',        &
         iostat   = E_IO)
    ! writing header of file
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)'# vtk DataFile Version 3.0'
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)trim(title)
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)trim(Upper_Case(output_format))
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)'DATASET '//trim(topology)
  case('BINARY')
    f_out = f_out_binary
    open(unit       = Unit_VTK,       &
         file       = trim(filename), &
         form       = 'UNFORMATTED',  &
         access     = 'STREAM',       &
         action     = 'WRITE',        &
         convert    = 'BIG_ENDIAN',   &
         iostat     = E_IO)
    ! writing header of file
    write(unit=Unit_VTK,iostat=E_IO)'# vtk DataFile Version 3.0'//end_rec
    write(unit=Unit_VTK,iostat=E_IO)trim(title)//end_rec
    write(unit=Unit_VTK,iostat=E_IO)trim(Upper_Case(output_format))//end_rec
    write(unit=Unit_VTK,iostat=E_IO)'DATASET '//trim(topology)//end_rec
  endselect
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction VTK_INI