write_block_scratch Function

private function write_block_scratch(self, scratch, action, filename, name) result(error)

Arguments

TypeIntentOptionalAttributesName
class(vtm_file), intent(inout) :: self
integer(kind=I4P), intent(in) :: scratch
character, intent(in) :: action
character, intent(in), optional :: filename
character, intent(in), optional :: name

Return Value integer(kind=I4P)


Contents

Source Code


Source Code

   function write_block_scratch(self, scratch, action, filename, name) result(error)
   !< Write one block dataset on scratch files.
   class(vtm_file), intent(inout)        :: self     !< VTM file.
   integer(I4P),    intent(in)           :: scratch  !< Scratch unit.
   character(*),    intent(in)           :: action   !< Action: [open, write].
   character(*),    intent(in), optional :: filename !< File name of VTK file grouped into current block.
   character(*),    intent(in), optional :: name     !< Block name
   integer(I4P)                          :: error    !< Error status.
   type(string)                          :: action_  !< Action string.
   type(string)                          :: name_    !< Block name, local variable

   action_ = trim(adjustl(action)) ; action_ = action_%upper()
   select case(action_%chars())
   case('OPEN')
     open(newunit=self%scratch_unit(scratch), &
          form='FORMATTED',                   &
          action='READWRITE',                 &
          status='SCRATCH',                   &
          iostat=error)
      name_ = '' ; if (present(name)) name_ = trim(adjustl(name))
      write(self%scratch_unit(scratch), iostat=error, fmt='(A)') name_%chars()
   case('WRITE')
      if (present(filename)) write(self%scratch_unit(scratch), iostat=error, fmt='(A)') trim(filename)
   endselect
   endfunction write_block_scratch