write_parallel_block_files_string Function

private function write_parallel_block_files_string(self, filenames, names, delimiter) result(error)

Arguments

TypeIntentOptionalAttributesName
class(xml_writer_abstract), intent(inout) :: self
character, intent(in) :: filenames
character, intent(in), optional :: names
character, intent(in), optional :: delimiter

Return Value integer(kind=I4P)


Calls

proc~~write_parallel_block_files_string~~CallsGraph proc~write_parallel_block_files_string write_parallel_block_files_string interface~str str proc~write_parallel_block_files_string->interface~str proc~str_i8p str_I8P interface~str->proc~str_i8p proc~str_a_r8p str_a_R8P interface~str->proc~str_a_r8p proc~str_r8p str_R8P interface~str->proc~str_r8p proc~str_a_i4p str_a_I4P interface~str->proc~str_a_i4p proc~strf_i2p strf_I2P interface~str->proc~strf_i2p proc~str_r4p str_R4P interface~str->proc~str_r4p proc~str_i1p str_I1P interface~str->proc~str_i1p proc~strf_i4p strf_I4P interface~str->proc~strf_i4p proc~str_a_r4p str_a_R4P interface~str->proc~str_a_r4p proc~strf_r4p strf_R4P interface~str->proc~strf_r4p proc~str_i2p str_I2P interface~str->proc~str_i2p proc~str_a_i2p str_a_I2P interface~str->proc~str_a_i2p proc~strf_i8p strf_I8P interface~str->proc~strf_i8p proc~str_bol str_bol interface~str->proc~str_bol proc~strf_r8p strf_R8P interface~str->proc~strf_r8p proc~str_i4p str_I4P interface~str->proc~str_i4p proc~str_a_i8p str_a_I8P interface~str->proc~str_a_i8p proc~strf_i1p strf_I1P interface~str->proc~strf_i1p proc~str_a_i1p str_a_I1P interface~str->proc~str_a_i1p proc~str_a_r8p->proc~str_r8p proc~compact_real_string compact_real_string proc~str_r8p->proc~compact_real_string proc~str_a_i4p->proc~str_i4p proc~str_r4p->proc~compact_real_string proc~str_a_r4p->proc~str_r4p proc~str_a_i2p->proc~str_i2p proc~str_a_i8p->proc~str_i8p proc~str_a_i1p->proc~str_i1p

Contents


Source Code

   function write_parallel_block_files_string(self, filenames, names, delimiter) result(error)
   !< Write list of files that belong to the current block (list passed as single string).
   !<
   !<#### Example of usage: 3 files blocks
   !<```fortran
   !< error = vtm%write_files_list_of_block(filenames='file_1.vts file_2.vts file_3.vtu')
   !<```
   !<
   !<#### Example of usage: 3 files blocks with custom name
   !<```fortran
   !< error = vtm%write_files_list_of_block(filenames='file_1.vts file_2.vts file_3.vtu',&
   !<                                       names='block-bar block-foo block-baz')
   !<```
   class(xml_writer_abstract), intent(inout)        :: self          !< Writer.
   character(*),               intent(in)           :: filenames     !< List of VTK-XML wrapped file names.
   character(*),               intent(in), optional :: names         !< List names attributed to wrapped files.
   character(*),               intent(in), optional :: delimiter     !< Delimiter character.
   integer(I4P)                                     :: error         !< Error status.
   type(string), allocatable                        :: filenames_(:) !< List of VTK-XML wrapped file names.
   type(string), allocatable                        :: names_(:)     !< List names attributed to wrapped files.
   type(string)                                     :: delimiter_    !< Delimiter character.
   type(string)                                     :: buffer        !< A string buffer.
   integer(I4P)                                     :: f             !< File counter.

   delimiter_ = ' ' ; if (present(delimiter)) delimiter_ = delimiter
   buffer = filenames
   call buffer%split(tokens=filenames_, sep=delimiter_%chars())
   if (present(names)) then
      buffer = names
      call buffer%split(tokens=names_, sep=delimiter_%chars())
      if (size(names_, dim=1)==size(filenames_, dim=1)) then
         do f=1, size(filenames_, dim=1)
            call self%write_self_closing_tag(name='DataSet',                                      &
                                             attributes='index="'//trim(str(f-1, .true.))//       &
                                                       '" file="'//trim(adjustl(filenames_(f)))// &
                                                       '" name="'//trim(adjustl(names_(f)))//'"')
         enddo
      endif
   else
      do f=1,size(filenames_, dim=1)
         call self%write_self_closing_tag(name='DataSet',                               &
                                          attributes='index="'//trim(str(f-1,.true.))// &
                                                    '" file="'//trim(adjustl(filenames_(f)))//'"')
      enddo
   endif
   error = self%error
   endfunction write_parallel_block_files_string