[Paraview] Parallel IO with paraview

Ryan Crocker rcrocker at uvm.edu
Thu Mar 28 03:23:20 EDT 2013


My flow solver uses parallel MPI writes to make ensight gold formatted files. These work in paraview, no problem.  What i'd like to do is take the raw ensight data files, read them, and spit back out ascii arrays.  If i could do this painlessly with something written in fortran, or C without using MPI it would be best.  I can read in the geometry files and the case files without difficulty but the variable data files are proving to be a bit of a problem.  I know paraview can read these, i'm curious how it does it. 

code snippet:

  if (irank.eq.iroot) call CREATE_FOLDER(trim(ensight_file) //'/'// trim(adjustl(name)))
  file = trim(mpiiofs) // trim(ensight_file) //'/'// trim(adjustl(name)) // "/" // trim(adjustl(name)) // "."
  write(file(len_trim(file)+1:len_trim(file)+6),'(i6.6)') nout_time
  
  ! Open the file
  inquire(file=file,exist=file_is_there)
  if (file_is_there .and. irank.eq.iroot) call MPI_FILE_DELETE(file,mpi_info,ierr)
  call MPI_FILE_OPEN(comm,file,IOR(MPI_MODE_WRONLY,MPI_MODE_CREATE),mpi_info,iunit,ierr)
  
  ! Write header (only root)
  if (irank.eq.iroot) then
     buffer = trim(adjustl(name))
     size = 80
     call MPI_FILE_WRITE(iunit,buffer,size,MPI_CHARACTER,status,ierr)
     buffer = 'part'
     size = 80
     call MPI_FILE_WRITE(iunit,buffer,size,MPI_CHARACTER,status,ierr)
     ibuffer = 1
     size = 1
     call MPI_FILE_WRITE(iunit,ibuffer,size,MPI_INTEGER,status,ierr)
     buffer = 'hexa8'
     size = 80
     call MPI_FILE_WRITE(iunit,buffer,size,MPI_CHARACTER,status,ierr)
  end if
  
  ! Write the data
  disp = 3*80+4+0*ncells_hexa*4
  call MPI_FILE_SET_VIEW(iunit,disp,MPI_REAL_SP,fileview_hexa,"native",mpi_info,ierr)
  call MPI_FILE_WRITE_ALL(iunit,buffer3_hexa(:,1),ncells_hexa_,MPI_REAL_SP,status,ierr)
  disp = 3*80+4+1*ncells_hexa*4
  call MPI_FILE_SET_VIEW(iunit,disp,MPI_REAL_SP,fileview_hexa,"native",mpi_info,ierr)
  call MPI_FILE_WRITE_ALL(iunit,buffer3_hexa(:,2),ncells_hexa_,MPI_REAL_SP,status,ierr)
  disp = 3*80+4+2*ncells_hexa*4
  call MPI_FILE_SET_VIEW(iunit,disp,MPI_REAL_SP,fileview_hexa,"native",mpi_info,ierr)
  call MPI_FILE_WRITE_ALL(iunit,buffer3_hexa(:,3),ncells_hexa_,MPI_REAL_SP,status,ierr)

  ! Close the file
  call MPI_FILE_CLOSE(iunit,ierr)

Ryan Crocker
University of Vermont, School of Engineering
Mechanical Engineering Department
rcrocker at uvm.edu
315-212-7331

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130328/17264ee0/attachment-0001.htm>


More information about the ParaView mailing list