write_block_string Function

private function write_block_string(self, action, filenames, names, name) result(error)

Arguments

TypeIntentOptionalAttributesName
class(vtm_file), intent(inout) :: self
character, intent(in), optional :: action
character, intent(in), optional :: filenames
character, intent(in), optional :: names
character, intent(in), optional :: name

Return Value integer(kind=I4P)


Contents

Source Code


Source Code

   function write_block_string(self, action, filenames, names, name) result(error)
   !< Write one block dataset (string input).
   !<
   !<#### Example of usage: 3 files blocks
   !<```fortran
   !< error = vtm%write_block(filenames='file_1.vts file_2.vts file_3.vtu', name='my_block')
   !<```
   !<
   !<#### Example of usage: 3 files blocks with custom name
   !<```fortran
   !< error = vtm%write_block(filenames='file_1.vts file_2.vts file_3.vtu', names='block-bar block-foo block-baz', name='my_block')
   !<```
   class(vtm_file), intent(inout)        :: self      !< VTM file.
   character(*),    intent(in), optional :: action    !< Action: [open, close, write].
   character(*),    intent(in), optional :: filenames !< File names of VTK files grouped into current block.
   character(*),    intent(in), optional :: names     !< Auxiliary names attributed to each files.
   character(*),    intent(in), optional :: name      !< Block name
   integer(I4P)                          :: error     !< Error status.
   type(string)                          :: action_   !< Action string.

   if (present(action)) then
      action_ = trim(adjustl(action)) ; action_ = action_%upper()
      select case(action_%chars())
      case('OPEN')
         error = self%xml_writer%write_parallel_open_block(name=name)
      case('CLOSE')
         error = self%xml_writer%write_parallel_close_block()
      case('WRITE')
         if (present(filenames)) error = self%xml_writer%write_parallel_block_files(filenames=filenames, names=names)
      endselect
   else
      error = self%xml_writer%write_parallel_open_block(name=name)
      error = self%xml_writer%write_parallel_block_files(filenames=filenames, names=names)
      error = self%xml_writer%write_parallel_close_block()
   endif
   endfunction write_block_string