Functions
gpmt/main.cpp File Reference
#include "MagnetoTelluricReader.h"
#include "gpmtVersion.h"
#include "gpmtInstallPath.h"

Functions

ApplicationHelphelp ()
int main (int argc, char **argv)
 PACKAGE_INFO (gpmt, GPMT)

Function Documentation

int main ( int  argc,
char **  argv 
)

References QGpCoreWave::MagnetoTelluricFactory::calculate(), QGpCoreTools::endl(), help(), QGpCoreWave::MagnetoTelluricFactory::linkX(), QGpCoreTools::ArgumentStdinReader::read(), QGpCoreWave::Profile::resize(), QGpCoreTools::Curve< pointType >::resize(), QGpCoreWave::MagnetoTelluricFactory::setAngularFrequency(), QGpCoreWave::Profile::setDepth(), MagnetoTelluricReader::setOptions(), QGpCoreWave::Profile::setValue(), QGpCoreWave::MagnetoTelluricFactory::setX(), QGpCoreWave::MagnetoTelluricFactory::toStream(), and QGpCoreTools::tr().

{
  CoreApplication a(argc, argv, help);

  // Options
  MagnetoTelluricReader reader;
  if(reader.setOptions(argc, argv) && reader.read(argc, argv) ) {
    return 0;
  } else {
    return 2;
  }
  // Code used only for initial testing and comparison with Max code
#if 0
  CoreApplication a(argc, argv, help);

  // Options
  //<your option variable>
  // Check arguments
  int i, j=1;
  for(i=1; i<argc; i++) {
    QByteArray arg=argv[i];
    if(arg[0]=='-') {
      if(arg=="<long option>" || arg=="<short option>") {
        CoreApplication::checkOptionArg(i, argc, argv);
        //<your option variable>=argv[i];
      } else {
        App::stream() << tr("gpmt: bad option %1, see -help").arg(argv[i]) << endl;
        return 2;
      }
    } else {
      argv[j++]=argv[i];
    }
  }
  if(j < argc) {
    argv[j]=0;
    argc=j;
  }

  gplib::C1DMTSynthData m;
  std::vector<double> r, h, f;
  r.push_back(100);
  r.push_back(10);
  r.push_back(200);
  m.SetResistivities(r);
  h.push_back(0.020);
  h.push_back(0.010);
  h.push_back(0.0);
  m.SetThicknesses(h);
  double f0=1000.0;
  double af=pow(0.01,1.0/16.0);
  for(int i=0; i<16; i++) {
    f.push_back(f0);
    f0/=af;
    //App::stream() << 1/f0 << endl;
  }
  m.SetFrequencies(f);
  m.GetData();
  m.WriteAsMtt("toto");
  for(int i=0; i<16; i++) {
    App::stream() << m.GetFrequencies().at(i) << " " <<
                     m.at(i).GetRhoxy() << " " <<
                     m.at(i).GetPhixy() << endl;
  }
  MagnetoTelluricCurve c;
  c.resize(16);
  f0=1000.0;
  for(int i=0; i<16; i++) {
    c[i].setX(f0);
    f0/=af;
  }
  MagnetoTelluricFactory fac;
  fac.setX(c);
  fac.linkX(c);
  fac.setAngularFrequency();
  Profile resistivies;
  resistivies.resize(3);
  resistivies.setDepth(0, 20);
  resistivies.setDepth(1, 30);
  resistivies.setDepth(2, 1e99);
  resistivies.setValue(0, 100);
  resistivies.setValue(1, 10);
  resistivies.setValue(2, 200);
  fac.calculate(resistivies);
  MagnetoTelluricPointOptions co(MagnetoTelluricPointOptions::ApparentResistivity);
  QTextStream sout(stdout);
  fac.toStream(sout, co);
#endif
}
PACKAGE_INFO ( gpmt  ,
GPMT   
)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines