src/GamIO/nrpt/Felix.cc
// ____________________________________________________________________________
// iii                 Felix Serial I/O Base Input Functions
// ____________________________________________________________________________
iii                 Felix Serial I/O Base Input Functions
iii Felix Serial I / O Base Input Functions
row_vector ReadFelixBlk(fstream& fp, int rc, int FOR)
  {
  float fr, fi;
  int cmplx = 0;
  int reals = 0;
  int i = 0;
  if(FOR) fp.read((char*)&i, sizeof(int));		
  fp.read ((char*)&cmplx, sizeof(int));		
  if(!rc) reals = 2*cmplx; 			
  else reals = cmplx; 				
  row_vector data(reals);			
  if(!rc)					
    for(int j=0; j<reals; j++)			
      { 
      fp.read((char*)&fr, sizeof(float));
      data.put(fr,j);
      } 
  else						
    for(int j=0; j<cmplx; j++)			
      { 
      fp.read((char*)&fr, sizeof(float));
      fp.read((char*)&fi, sizeof(float));
      data.put(complex(fr, fi), j);
      } 
  if(FOR) fp.read((char*)&i, sizeof(int));		
  return data;
  }
row_vector ReadFelixBlk ( fstream & fp , int rc , int FOR ) { float fr , fi ; int cmplx = 0 ; int reals = 0 ; int i = 0 ; if ( FOR ) fp . read ( ( char * ) & i , sizeof ( int ) ) ; fp . read ( ( char * ) & cmplx , sizeof ( int ) ) ; if ( ! rc ) reals = 2 * cmplx ; else reals = cmplx ; row_vector data ( reals ) ; if ( ! rc ) for ( int j = 0 ; j < reals ; j ++ ) { fp . read ( ( char * ) & fr , sizeof ( float ) ) ; data . put ( fr , j ) ; } else for ( int j = 0 ; j < cmplx ; j ++ ) { fp . read ( ( char * ) & fr , sizeof ( float ) ) ; fp . read ( ( char * ) & fi , sizeof ( float ) ) ; data . put ( complex ( fr , fi ) , j ) ; } if ( FOR ) fp . read ( ( char * ) & i , sizeof ( int ) ) ; return data ; }
____________________________________________________________________________
iii                 Felix Serial I/O Base Input Functions
____________________________________________________________________________
____________________________________________________________________________ iii Felix Serial I / O Base Input Functions ____________________________________________________________________________
// Input		fp	: Pointer to an open file // 			rc      : Flag for real vs. complex data //			FOR	: Flag for reading 2 FORTRAN integers // Output		BLK	: 1D-data block is returned filled //				  from data in the file fp //				  presumed in Felix ".dat" format // Note				: Assumes there is no header present // Note				: Reads the FORTRAN integers at the //				  start and end of the block // Storage taken (for FORTRAN) // Read # of complex points // Set the number of reals // Double if reals, not complex // Declare data for output // Do this if reading reals // Reals in 1 at a time // Do this if reading complex // Points read in Re, Im // Storage taken (for FORTRAN)