src/Matrix/row_vector.cc
/**
 * ReadSVS - Read in and process a complete SVS file
 * @fin - file stream of the open pulse file
 */
Read in and process a complete SVS file
@fin - file stream of the open pulse file
Read in and process a complete SVS file @fin - file stream of the open pulse file
row_vector row_vector::ReadSVS (ifstream& fin)
{
  int pos, numpts = 0, in_data = 0;
  string line, cooked;
  double apt;
  vector<double> pts;
  vector<string> field;
  vector<double> amps, phases;
  const char* SIEM_HDR = "Num_Points:";
  const char* SIEM_VAL = "Entry_Values:";
  while (getline (fin, line)) {
    cooked = row_vector::trim_all (line);
    cooked = row_vector::squeeze (line);
    if (cooked.find ("End_Entry:") < cooked.length()) {
      in_data = 0;
      break;
    }
    if (cooked.find (SIEM_HDR) < cooked.length()) {
      pos = row_vector::split (cooked, ' ', field);
      string snum = field[1];
      const char* cptr = snum.data();
      numpts = atoi (cptr);
    }
    if (cooked.find (SIEM_VAL) < cooked.length()) {
      pos = row_vector::split (cooked, ' ', field);
      pos = cooked.find_first_of (" ");
      cooked = cooked.substr (pos + 1);
      field.clear();
      in_data = 1;
    }
    if (in_data) {
      while (fin >> apt) {
	pts.push_back (apt);
      }
    }
  }
  row_vector rvec ( numpts );
  for (unsigned int i = 0; i < pts.size()/2; i++) {
    rvec.put (complex(pts[i], 0.0), i);
  }
  return rvec;
}
row_vector row_vector :: ReadSVS ( ifstream & fin ) { int pos , numpts = 0 , in_data = 0 ; string line , cooked ; double apt ; vector < double > pts ; vector < string > field ; vector < double > amps , phases ; const char * SIEM_HDR = " " ; const char * SIEM_VAL = " " ; while ( getline ( fin , line ) ) { cooked = row_vector :: trim_all ( line ) ; cooked = row_vector :: squeeze ( line ) ; if ( cooked . find ( " " ) < cooked . length ( ) ) { in_data = 0 ; break ; } if ( cooked . find ( SIEM_HDR ) < cooked . length ( ) ) { pos = row_vector :: split ( cooked , ' ' , field ) ; string snum = field [ 1 ] ; const char * cptr = snum . data ( ) ; numpts = atoi ( cptr ) ; } if ( cooked . find ( SIEM_VAL ) < cooked . length ( ) ) { pos = row_vector :: split ( cooked , ' ' , field ) ; pos = cooked . find_first_of ( " " ) ; cooked = cooked . substr ( pos + 1 ) ; field . clear ( ) ; in_data = 1 ; } if ( in_data ) { while ( fin >> apt ) { pts . push_back ( apt ) ; } } } row_vector rvec ( numpts ) ; for ( unsigned int i = 0 ; i < pts . size ( ) / 2 ; i ++ ) { rvec . put ( complex ( pts [ i ] , 0.0 ) , i ) ; } return rvec ; }
ReadSVS - Read in and process a complete SVS file
 @fin - file stream of the open pulse file
ReadSVS - Read in and process a complete SVS file @fin - file stream of the open pulse file
/* Extract number of points in file  */ /* Excise SIEM_VAL from cooked string.  */ /* Now erase the contents of field, or else they accumulate.  */