vtk_fortran_write_pvts Program

Uses

  • program~~vtk_fortran_write_pvts~~UsesGraph program~vtk_fortran_write_pvts vtk_fortran_write_pvts module~penf~2 penf program~vtk_fortran_write_pvts->module~penf~2 module~vtk_fortran vtk_fortran program~vtk_fortran_write_pvts->module~vtk_fortran module~penf_b_size penf_b_size module~penf~2->module~penf_b_size module~penf_stringify~3 penf_stringify module~penf~2->module~penf_stringify~3 module~penf_global_parameters_variables~2 penf_global_parameters_variables module~penf~2->module~penf_global_parameters_variables~2 module~vtk_fortran->module~penf~2 module~vtk_fortran_vtk_file vtk_fortran_vtk_file module~vtk_fortran->module~vtk_fortran_vtk_file module~vtk_fortran_vtm_file vtk_fortran_vtm_file module~vtk_fortran->module~vtk_fortran_vtm_file module~vtk_fortran_pvtk_file vtk_fortran_pvtk_file module~vtk_fortran->module~vtk_fortran_pvtk_file module~penf_b_size->module~penf_global_parameters_variables~2 module~vtk_fortran_vtk_file->module~penf~2 module~vtk_fortran_vtk_file_xml_writer_abstract vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtk_file->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtk_file_xml_writer_ascii_local vtk_fortran_vtk_file_xml_writer_ascii_local module~vtk_fortran_vtk_file->module~vtk_fortran_vtk_file_xml_writer_ascii_local module~befor64~4 befor64 module~vtk_fortran_vtk_file->module~befor64~4 module~vtk_fortran_vtk_file_xml_writer_appended vtk_fortran_vtk_file_xml_writer_appended module~vtk_fortran_vtk_file->module~vtk_fortran_vtk_file_xml_writer_appended module~stringifor~2 stringifor module~vtk_fortran_vtk_file->module~stringifor~2 module~vtk_fortran_vtk_file_xml_writer_binary_local vtk_fortran_vtk_file_xml_writer_binary_local module~vtk_fortran_vtk_file->module~vtk_fortran_vtk_file_xml_writer_binary_local module~penf_stringify~3->module~penf_b_size module~penf_stringify~3->module~penf_global_parameters_variables~2 iso_fortran_env iso_fortran_env module~penf_stringify~3->iso_fortran_env module~vtk_fortran_vtm_file->module~penf~2 module~vtk_fortran_vtm_file->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtm_file->module~vtk_fortran_vtk_file_xml_writer_ascii_local module~vtk_fortran_vtm_file->module~befor64~4 module~vtk_fortran_vtm_file->module~stringifor~2 module~vtk_fortran_pvtk_file->module~penf~2 module~vtk_fortran_pvtk_file->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_pvtk_file->module~vtk_fortran_vtk_file_xml_writer_ascii_local module~vtk_fortran_pvtk_file->module~befor64~4 module~vtk_fortran_vtk_file_xml_writer_abstract->module~penf~2 module~vtk_fortran_vtk_file_xml_writer_abstract->module~stringifor~2 module~foxy foxy module~vtk_fortran_vtk_file_xml_writer_abstract->module~foxy module~vtk_fortran_parameters vtk_fortran_parameters module~vtk_fortran_vtk_file_xml_writer_abstract->module~vtk_fortran_parameters module~vtk_fortran_vtk_file_xml_writer_ascii_local->module~penf~2 module~vtk_fortran_vtk_file_xml_writer_ascii_local->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtk_file_xml_writer_ascii_local->module~stringifor~2 module~vtk_fortran_dataarray_encoder vtk_fortran_dataarray_encoder module~vtk_fortran_vtk_file_xml_writer_ascii_local->module~vtk_fortran_dataarray_encoder module~befor64~4->module~penf~2 module~befor64_pack_data_m~4 befor64_pack_data_m module~befor64~4->module~befor64_pack_data_m~4 module~vtk_fortran_vtk_file_xml_writer_appended->module~penf~2 module~vtk_fortran_vtk_file_xml_writer_appended->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtk_file_xml_writer_appended->module~stringifor~2 module~vtk_fortran_vtk_file_xml_writer_appended->module~vtk_fortran_dataarray_encoder module~vtk_fortran_vtk_file_xml_writer_appended->module~vtk_fortran_parameters module~stringifor~2->module~penf~2 module~stringifor_string_t stringifor_string_t module~stringifor~2->module~stringifor_string_t module~vtk_fortran_vtk_file_xml_writer_binary_local->module~penf~2 module~vtk_fortran_vtk_file_xml_writer_binary_local->module~vtk_fortran_vtk_file_xml_writer_abstract module~vtk_fortran_vtk_file_xml_writer_binary_local->module~stringifor~2 module~vtk_fortran_vtk_file_xml_writer_binary_local->module~vtk_fortran_dataarray_encoder module~vtk_fortran_dataarray_encoder->module~penf~2 module~vtk_fortran_dataarray_encoder->module~befor64~4 module~stringifor_string_t->module~penf~2 module~stringifor_string_t->module~befor64~4 module~stringifor_string_t->iso_fortran_env module~face face module~stringifor_string_t->module~face module~foxy->module~penf~2 module~foxy_xml_tag foxy_xml_tag module~foxy->module~foxy_xml_tag module~foxy_xml_file foxy_xml_file module~foxy->module~foxy_xml_file module~vtk_fortran_parameters->module~penf~2 module~vtk_fortran_parameters->iso_fortran_env module~befor64_pack_data_m~4->module~penf~2 module~face->iso_fortran_env module~foxy_xml_tag->module~penf~2 module~foxy_xml_tag->module~stringifor~2 module~foxy_xml_file->module~penf~2 module~foxy_xml_file->module~foxy_xml_tag

Calls

program~~vtk_fortran_write_pvts~~CallsGraph program~vtk_fortran_write_pvts vtk_fortran_write_pvts proc~write_vts write_vts program~vtk_fortran_write_pvts->proc~write_vts proc~write_pvts write_pvts program~vtk_fortran_write_pvts->proc~write_pvts

Contents


Variables

TypeAttributesNameInitial
integer(kind=I4P), parameter:: nx1 =0_I4P
integer(kind=I4P), parameter:: nx2 =9_I4P
integer(kind=I4P), parameter:: ny1 =0_I4P
integer(kind=I4P), parameter:: ny2 =5_I4P
integer(kind=I4P), parameter:: nz1 =0_I4P
integer(kind=I4P), parameter:: nz2 =5_I4P
integer(kind=I4P), parameter:: nx1_p(1:2) =[nx1, 4_I4P]
integer(kind=I4P), parameter:: nx2_p(1:2) =[4_I4P, nx2]
integer(kind=I4P), parameter:: nn =(nx2-nx1+1)*(ny2-ny1+1)*(nz2-nz1+1)
integer(kind=I4P), parameter:: nn_p(1:2) =[(nx2_p(1)-nx1+1)*(ny2-ny1+1)*(nz2-nz1+1), (nx2_p(2)-nx2_p(1)+1)*(ny2-ny1+1)*(nz2-nz1+1)]
real(kind=R8P), dimension(nx1:nx2,ny1:ny2,nz1:nz2):: x
real(kind=R8P), dimension(nx1:nx2,ny1:ny2,nz1:nz2):: y
real(kind=R8P), dimension(nx1:nx2,ny1:ny2,nz1:nz2):: z
integer(kind=I4P), dimension(nx1:nx2,ny1:ny2,nz1:nz2):: v
integer(kind=I4P) :: i
integer(kind=I4P) :: j
integer(kind=I4P) :: k

Subroutines

subroutine write_vts(part, filename)

Arguments

TypeIntentOptionalAttributesName
integer(kind=I4P), intent(in) :: part
character, intent(in) :: filename

subroutine write_pvts(filename, parts_filename)

Arguments

TypeIntentOptionalAttributesName
character, intent(in) :: filename
character, intent(in) :: parts_filename(:)

Source Code

program vtk_fortran_write_pvts
!< VTK_Fortran test for Parallel (partioned) Structured Grid.
use penf
use vtk_fortran, only : vtk_file, pvtk_file

implicit none
!< The mesh is a simple prism partitioned into two pieces along x direction at ordinate i=nx2_p(1).
!<```
!< y ^
!<   |               ny2 +-----------------+--------------+
!<   |                   |                 |              |
!<   |                   |                 |              |
!<   |                   |                 |              |
!<   |                   |                 |              |
!<   o-------->      ny1 +-----------------+--------------+
!<            x         nx1               i=nx2_p(1)     nx2
!<```
integer(I4P), parameter :: nx1=0_I4P, nx2=9_I4P, ny1=0_I4P, ny2=5_I4P, nz1=0_I4P, nz2=5_I4P !< Whole extents.
integer(I4P), parameter :: nx1_p(1:2)=[nx1, 4_I4P]                                          !< Lower x extents.
integer(I4P), parameter :: nx2_p(1:2)=[4_I4P, nx2]                                          !< Upper x extents.
integer(I4P), parameter :: nn       = (nx2     -nx1     +1)*(ny2-ny1+1)*(nz2-nz1+1)         !< Whole number of points.
integer(I4P), parameter :: nn_p(1:2)=[(nx2_p(1)-nx1     +1)*(ny2-ny1+1)*(nz2-nz1+1),&
                                      (nx2_p(2)-nx2_p(1)+1)*(ny2-ny1+1)*(nz2-nz1+1)]        !< Partinoned number of points.

real(R8P),    dimension(nx1:nx2,ny1:ny2,nz1:nz2) :: x, y, z !< Mesh coordinates.
integer(I4P), dimension(nx1:nx2,ny1:ny2,nz1:nz2) :: v       !< Noces-centered value.
integer(I4P)                                     :: i       !< Counter.
integer(I4P)                                     :: j       !< Counter.
integer(I4P)                                     :: k       !< Counter.

! inizialize data
do k=nz1, nz2
   do j=ny1, ny2
      do i=nx1, nx2
         x(i, j, k) = i*1._R8P
         y(i, j, k) = j*1._R8P
         z(i, j, k) = k*1._R8P
         v(i, j, k) = i*j*k
      enddo
   enddo
enddo

call write_vts(part=1, filename='vtkfortran_write_pvts_01.vts')
call write_vts(part=2, filename='vtkfortran_write_pvts_02.vts')
call write_pvts(filename='vtkfortran_write_pvts.pvts', parts_filename=['vtkfortran_write_pvts_01.vts', &
                                                                       'vtkfortran_write_pvts_02.vts'])
contains
   subroutine write_vts(part, filename)
   !< Write VTS parts.
   integer(I4P), intent(in) :: part         !< Part to be saved [1,2].
   character(*), intent(in) :: filename     !< Output file name.
   type(vtk_file)           :: a_vtk_file   !< A VTK file.
   integer(I4P)             :: error        !< Status error.

   error = a_vtk_file%initialize(format='binary', filename=filename, mesh_topology='StructuredGrid', &
                                 nx1=nx1_p(part), nx2=nx2_p(part), ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
   error = a_vtk_file%xml_writer%write_piece(nx1=nx1_p(part), nx2=nx2_p(part), ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
   error = a_vtk_file%xml_writer%write_geo(n=nn_p(part), x=x(nx1_p(part):nx2_p(part),:,:), &
                                                         y=y(nx1_p(part):nx2_p(part),:,:), &
                                                         z=z(nx1_p(part):nx2_p(part),:,:))
   error = a_vtk_file%xml_writer%write_dataarray(location='node', action='open')
   error = a_vtk_file%xml_writer%write_dataarray(data_name='int32_scalar', x=v(nx1_p(part):nx2_p(part),:,:), &
                                                 one_component=.true.)
   error = a_vtk_file%xml_writer%write_dataarray(location='node', action='close')
   error = a_vtk_file%xml_writer%write_piece()
   error = a_vtk_file%finalize()
   endsubroutine write_vts

   subroutine write_pvts(filename, parts_filename)
   !< Write PVTS.

   character(*), intent(in) :: filename          !< Output file name.
   character(*), intent(in) :: parts_filename(:) !< Parts file name.
   type(pvtk_file)          :: a_pvtk_file       !< A parallel (partioned) VTK file.
   integer(I4P)             :: error             !< Status error.

   error = a_pvtk_file%initialize(filename=filename, mesh_topology='PStructuredGrid', mesh_kind="Float64", &
                                  nx1=nx1, nx2=nx2, ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
   error = a_pvtk_file%xml_writer%write_dataarray(location='node', action='open')
   error = a_pvtk_file%xml_writer%write_parallel_dataarray(data_name='int32_scalar', &
                                                           data_type='Int32', &
                                                           number_of_components=1)
   error = a_pvtk_file%xml_writer%write_dataarray(location='node', action='close')
   error = a_pvtk_file%xml_writer%write_parallel_geo(source=parts_filename(1), &
                                                     nx1=nx1, nx2=nx2_p(1), ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
   error = a_pvtk_file%xml_writer%write_parallel_geo(source=parts_filename(2), &
                                                     nx1=nx2_p(1), nx2=nx2_p(2), ny1=ny1, ny2=ny2, nz1=nz1, nz2=nz2)
   error = a_pvtk_file%finalize()
   endsubroutine write_pvts
endprogram vtk_fortran_write_pvts