All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Protected Attributes
DinverDCCore::ModalStorageReader Class Reference

#include <ModalStorageReader.h>

List of all members.

Public Member Functions

 ModalStorageReader (QDataStream &s)
int nModes ()
bool seek (QDataStream &s, int iMode)
void setBetaReleaseOffsets (QDataStream &s, bool rayleigh)
void toPlot (QDataStream &s, Point2D *points) const
void toStream (QDataStream &s, QTextStream &sOut) const
void toStream (QDataStream &s, QDataStream &sOut) const

Protected Attributes

int _nModes
QList< qint64 > _offsets

Constructor & Destructor Documentation

References _nModes, _offsets, and TRACE.

{
  TRACE;
  s >> _nModes;
  _offsets.append(s.device()->pos());
}

Member Function Documentation

bool DinverDCCore::ModalStorageReader::seek ( QDataStream &  s,
int  iMode 
)

References _nModes, _offsets, and TRACE.

Referenced by outputDCModel(), and setBetaReleaseOffsets().

{
  TRACE;
  if(iMode>=_nModes) return false;
  QIODevice& f=*s.device();
  if(iMode>=_offsets.count()) {
    f.seek(_offsets.last());
    int nf;
    while(_offsets.count()<=iMode) {
      s >> nf;
      qint64 o=_offsets.last()+4+nf*16;
      f.seek(o);
      _offsets.append(o);
    }
  } else {
    f.seek(_offsets.at(iMode));
  }
  return true;
}
void DinverDCCore::ModalStorageReader::setBetaReleaseOffsets ( QDataStream &  s,
bool  rayleigh 
)

Compatibility with older reports: for Beta Release 2.0.0 from June 2006. If rayleigh is true only Rayleigh modes are considered, else only Love

References _nModes, _offsets, seek(), and TRACE.

Referenced by outputDCModel().

{
  TRACE;
  ASSERT(_offsets.count()==1); // only the first offset from the constructor must be there
  int nR;
  s >> nR; // number of Rayleigh modes
  if(nR<0) nR=0;
  _offsets.last()+=4; // Correct for nR
  if(rayleigh) {
    _nModes=nR; // Reduce the number of modes to Rayleigh only
  } else {
    // Skip all rayleigh modes
    seek(s, nR);
    // Remove all offsets except the last one (the first Love)
    qint64 o=_offsets.last();
    _offsets.clear();
    _offsets.append(o);
    _nModes -= nR; // Reduce the number of modes to Love only
  }
}
void DinverDCCore::ModalStorageReader::toPlot ( QDataStream &  s,
Point2D points 
) const

pos() of data stream must point to the beginning of a curve

References QGpCoreTools::Point2D::setX(), QGpCoreTools::Point2D::setY(), and TRACE.

Referenced by DinverDCGui::AutocorrViewer::report2plot().

{
  TRACE;
  int nf;
  s >> nf;
  //qDebug ("%i",nf);
  double freq,value;
  for(int i=0;i<nf;i++) {
    s >> freq;
    s >> value;
    Point2D& p=points[i];
    //qDebug ("%lg %lg",freq, value);
    p.setX(freq);
    p.setY(value);
  }
}
void DinverDCCore::ModalStorageReader::toStream ( QDataStream &  s,
QTextStream &  sOut 
) const

References QGpCoreTools::flush(), and TRACE.

Referenced by outputDCModel().

{
  TRACE;
  int nf;
  s >> nf;
  double freq,value;
  static const QString fmt("%1 %2\n");
  for(int i=0;i<nf;i++) {
    s >> freq >> value;
    sOut << fmt.arg(freq, 20, 'g', 15).arg(value, 20, 'g', 15);
  }
  sOut << flush;
}
void DinverDCCore::ModalStorageReader::toStream ( QDataStream &  s,
QDataStream &  sOut 
) const

References TRACE.

{
  TRACE;
  int nf;
  s >> nf;
  sOut << nf;
  double freq,value;
  for(int i=0;i<nf;i++) {
    s >> freq >> value;
    sOut << freq << value;
  }
}

Member Data Documentation

QList<qint64> DinverDCCore::ModalStorageReader::_offsets [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines