Public Member Functions | Protected Member Functions
EC8Reader Class Reference

Brief description of class still missing. More...

#include <EC8Reader.h>

Inheritance diagram for EC8Reader:
QGpCoreTools::ArgumentStdinReader

List of all members.

Public Member Functions

 EC8Reader ()
bool setOptions (int &argc, char **argv)

Protected Member Functions

virtual bool parse (QTextStream &s)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing


Member Function Documentation

bool EC8Reader::parse ( QTextStream &  s) [protected, virtual]

Implements QGpCoreTools::ArgumentStdinReader.

References QGpCoreWave::Profile::average(), QGpCoreTools::endl(), QGpCoreWave::Seismic1DModel::fromStream(), QGpCoreWave::Profile::inverse(), QGpCoreWave::Seismic1DModel::layerCount(), QGpCoreWave::Profile::resample(), QGpCoreWave::Profile::setSamples(), sOut(), TRACE, QGpCoreWave::Profile::values(), QGpCoreWave::Seismic1DModel::vsAt(), and QGpCoreWave::Seismic1DModel::vsProfile().

{
  TRACE;
  QTextStream sOut(stdout);
  Seismic1DModel m;
  QString comments;
  if(!m.fromStream(s, &comments)) {
    return false;
  }
  if(m.layerCount()>0) {
    sOut << comments;
    // Get Vs averaged over the first 30 m
    QVector<double> sampling;
    sampling << 5.0;
    sampling << 30.0;
    Profile p=m.vsProfile();
    p.inverse();
    p.resample(sampling);
    p.average();
    p.setSamples(sampling);
    p.inverse();
    double vs5=p.values()[0];
    double vs30=p.values()[1];
    sOut << "Vs30 " << vs30;

    // Test for class S1: at least 10 m with a velocity <= 100 m/s over the first 30 m
    double startLvzDepth=-1.0;
    for(double d=0.0; d<30.0; d+=0.5) {
      if(m.vsAt(d)<=100.0) {
        if(startLvzDepth<0) startLvzDepth=0;
      } else if(startLvzDepth>=0) {
        if(d-startLvzDepth>=10.0) {
          if(vs30<=100.0) {
            sOut << " Class S1\n";
          } else {
            sOut << " Class S1?\n";
          }
          return true;
        }
        startLvzDepth=-1.0;
      }
    }

    // Test for class E: thickness of 5-20 m with a velocity < 360 and next velocity > 800 m/s
    startLvzDepth=-1.0;
    for(double d=0.0; d<30.0; d+=0.5) {
      if(m.vsAt(d)<=360.0) {
        if(startLvzDepth<0) startLvzDepth=0;
      } else if(startLvzDepth>=0.0 && m.vsAt(d)>=800.0){
        double h=d-startLvzDepth;
        if(h>=5.0 && h<=20.0) {
          sOut << " Class E\n" << endl;
          return true;
        } else {
          break;
        }
      } else {
        startLvzDepth=-1.0;
      }
    }

    // Other class identification
    if(vs30>=800.0 && vs5>=360.0) { // max thickness of weaker materials=5m
      sOut << " Class A\n";
    } else if(vs30>360.0) {
      sOut << " Class B\n";
    } else if(vs30>=180.0) {
      sOut << " Class C\n";
    } else if(vs30<=100.0) {
      sOut << " Class S1\n";
    } else {
      sOut << " Class D\n";
    }
  }
  return true;
}
bool EC8Reader::setOptions ( int &  argc,
char **  argv 
)

References QGpCoreTools::endl(), QGpCoreTools::tr(), and TRACE.

Referenced by main().

{
  TRACE;
  // Check arguments
  int i, j=1;
  for(i=1; i<argc; i++) {
    QByteArray arg=argv[i];
    if(arg[0]=='-') {
      App::stream() << tr("gpec8: bad option %1, see -help").arg(argv[i]) << endl;
      return false;
    } else {
      argv[j++]=argv[i];
    }
  }
  if(j < argc) {
    argv[j]=0;
    argc=j;
  }
  return true;
}

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