VTK_VAR_XML_SCAL_R4 Function

private function VTK_VAR_XML_SCAL_R4(NC_NN, varname, var) result(E_IO)

Function for saving scalar variable (R4P).

Arguments

Type IntentOptional AttributesName
integer(kind=I4P), intent(in) :: NC_NN
character(len=*), intent(in) :: varname
real(kind=R4P), intent(in) :: var(1:NC_NN)

Return Value integer(kind=I4P)


Calls

proc~~vtk_var_xml_scal_r4~~CallsGraph proc~vtk_var_xml_scal_r4 VTK_VAR_XML_SCAL_R4 interface~str str proc~vtk_var_xml_scal_r4->interface~str proc~str_i8p str_I8P interface~str->proc~str_i8p proc~str_r8p str_R8P interface~str->proc~str_r8p proc~str_i1p str_I1P interface~str->proc~str_i1p proc~str_i4p str_I4P interface~str->proc~str_i4p proc~str_r16p str_R16P interface~str->proc~str_r16p proc~str_i2p str_I2P interface~str->proc~str_i2p proc~str_r4p str_R4P interface~str->proc~str_r4p

Called by

proc~~vtk_var_xml_scal_r4~~CalledByGraph proc~vtk_var_xml_scal_r4 VTK_VAR_XML_SCAL_R4 interface~vtk_var_xml VTK_VAR_XML interface~vtk_var_xml->proc~vtk_var_xml_scal_r4

Contents

Source Code


Source Code

  function VTK_VAR_XML_SCAL_R4(NC_NN,varname,var) result(E_IO)
  !---------------------------------------------------------------------------------------------------------------------------------
  !! Function for saving scalar variable (R4P).
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  integer(I4P), intent(IN):: NC_NN        ! number of cells or nodes
  character(*), intent(IN):: varname      ! variable name
  real(R4P),    intent(IN):: var(1:NC_NN) ! variable to be saved
  integer(I4P)::             E_IO         ! Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done
  integer(I4P)::             n1           ! counter
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  select case(f_out)
  case(f_out_ascii)
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)repeat(' ',indent)//                 &
                                              '<DataArray type="Float32" Name="'// &
                                              trim(varname)//                      &
                                              '" NumberOfComponents="1" format="ascii">'
    write(unit=Unit_VTK,fmt=FR4P,iostat=E_IO)var
    write(unit=Unit_VTK,fmt='(A)',iostat=E_IO)repeat(' ',indent)//'</DataArray>'
  case(f_out_binary)
    write(unit=Unit_VTK,iostat=E_IO)repeat(' ',indent)//                                   &
                                    '<DataArray type="Float32" Name="'//                   &
                                    trim(varname)//                                        &
                                    '" NumberOfComponents="1" format="appended" offset="', &
                                    trim(str(.true.,ioffset)),                             &
                                    '">'//                                                 &
                                    end_rec
    N_Byte  = NC_NN*sizeof(Tipo_R4)
    ioffset = ioffset + sizeof(Tipo_I4) + N_Byte
    write(unit=Unit_VTK_Append,iostat=E_IO)N_Byte,'R4',NC_NN
    write(unit=Unit_VTK_Append,iostat=E_IO)(var(n1),n1=1,NC_NN)
    write(unit=Unit_VTK,iostat=E_IO)repeat(' ',indent)//'</DataArray>'//end_rec
  endselect
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction VTK_VAR_XML_SCAL_R4