Changeset 3755 for palm


Ignore:
Timestamp:
Feb 19, 2019 5:03:19 PM (3 years ago)
Author:
suehring
Message:

Change format descriptor in VTK postprocessor for surface output; switch back to non-standard Fortran functions since standard-conform C-functions lead to unexpected segmentation faults for some unknown reason

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/surface_output_processing/surface_output_to_vtk.f90

    r3523 r3755  
    2525! -----------------
    2626! $Id$
     27! - Change format description to avoid *** for larger domains
     28! - switch back from to non-standard Fortran ftell and fseek since posix
     29!   interface do not work any more for some unknown reason
     30!
     31! 3523 2018-11-13 16:09:31Z suehring
    2732! Implement interface for posix conform C-systemcalls in order to replace
    2833! non-standard FORTRAN functions ftell and fseek.
     
    151156    CHARACTER(LEN=30)  ::  myid_char              !< combined string indicating binary file
    152157   
     158
    153159    CHARACTER(LEN=100) ::  path                   !< path to the binary data
    154160    CHARACTER(LEN=100) ::  run                    !< name of the run
    155161    CHARACTER(LEN=100) ::  variable_name          !< name of the processed output variable   
     162
     163    INTEGER(4)   ::  ftell                      !< intrinsic function, get current position in file
     164    INTEGER(4)   ::  ndum                       !< return parameter of intrinsic function fseek   
    156165       
    157166    INTEGER, PARAMETER ::  iwp = 4                !< integer precision
    158167    INTEGER, PARAMETER ::  wp  = 8                !< float precision
    159168    INTEGER, PARAMETER ::  OFFSET_KIND = C_SIZE_T !< unsigned integer for the C-interface
    160    
     169
    161170    INTEGER(iwp) ::  cycle_number                 !< cycle number
    162171    INTEGER(iwp) ::  f                            !< running index over all binary files
     
    169178    INTEGER(iwp) ::  ns_total                     !< total number of polygons
    170179    INTEGER(iwp) ::  num_pe                       !< number of processors of the run
    171    
    172     INTEGER(OFFSET_KIND),DIMENSION(:), ALLOCATABLE ::  filepos !< current fileposition in binary file
     180
     181!     INTEGER(OFFSET_KIND),DIMENSION(:), ALLOCATABLE ::  filepos !< current fileposition in binary file
     182    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  filepos !< current fileposition in binary file
    173183   
    174184    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  npoints !< number of points/vertices in a binaray file
     
    193203!-- Allocate array which contains the file position in each output file,
    194204!-- in order to skip some reading.
    195     ALLOCATE( eof( 0:num_pe-1 )     )
    196     ALLOCATE( filepos( 0:num_pe-1 ) )
    197     ALLOCATE( npoints( 0:num_pe-1 ) )
    198     ALLOCATE( ns( 0:num_pe-1 )      )
     205    ALLOCATE( eof(0:num_pe-1)     )
     206    ALLOCATE( filepos(0:num_pe-1) )
     207    ALLOCATE( npoints(0:num_pe-1) )
     208    ALLOCATE( ns(0:num_pe-1)      )
    199209!
    200210!-- Initialize file position.
     
    242252!
    243253!--    Obtain current file position. Will be stored for next file opening.
    244        CALL posix_ftell( file_id_in, filepos(f) )
     254!        CALL posix_ftell( file_id_in, filepos(f) )
     255       filepos(f) = ftell( file_id_in )
    245256!
    246257!--    Write header information. Only one time required.
     
    256267!--    Write the vertex data into header file.
    257268       DO  n = 1, npoints(f)
    258           WRITE( file_id_out_header, '(8F10.1)' )  points(1:3,n)
     269          WRITE( file_id_out_header, '(8F15.1)' )  points(1:3,n)
    259270       ENDDO
    260271!
     
    276287!
    277288!--    Move to last postion.
    278        CALL posix_lseek( file_id_in, filepos(f) )
     289!        CALL posix_lseek( file_id_in, filepos(f) )
     290       CALL FSEEK( file_id_in, filepos(f), 0, ndum )
    279291!
    280292!--    Allocate array for polygon data
     
    286298!--    Obtain current file position after reading the local polygon data.
    287299!--    Will be used for next file opening.
    288        CALL posix_ftell( file_id_in, filepos(f) )
     300!        CALL posix_ftell( file_id_in, filepos(f) )
     301       filepos(f) = ftell( file_id_in )
    289302!
    290303!--    Write further header information. Only one time required.
    291304       IF ( f == 0 )                                                           &
    292           WRITE ( file_id_out_header, '(A,8I10)') "POLYGONS ",                 &
     305          WRITE ( file_id_out_header, '(A,2I10)') "POLYGONS ",                 &
    293306                                                  ns_total, 5 * ns_total
    294307!
     
    297310!--    surface element.
    298311       DO n = 1, ns(f)
    299           WRITE ( file_id_out_header, '(8I10)' )  INT( polygons(1:5,n) )
     312          WRITE ( file_id_out_header, '(5I18)' )  INT( polygons(1:5,n) )
    300313       ENDDO
    301314!
     
    344357!
    345358!--       Move to last postion.
    346 !           ndum = fseek( file_id_in, filepos(f), 0 )
    347           CALL posix_lseek( file_id_in, filepos(f) )
    348 !           CALL FSEEK( file_id_in, filepos(f), 0, ndum )
     359!           CALL posix_lseek( file_id_in, filepos(f) )
     360          CALL FSEEK( file_id_in, filepos(f), 0, ndum )
    349361!
    350362!--       Read string length and string indicating the output time step.
     
    409421!
    410422!--       Remember file position in binary file and close it.
    411           CALL posix_ftell( file_id_in, filepos(f) )
     423!           CALL posix_ftell( file_id_in, filepos(f) )
     424          filepos(f) = ftell( file_id_in )
    412425       
    413426          CLOSE ( file_id_in )
Note: See TracChangeset for help on using the changeset viewer.