Brief description of class still missing. More...
#include <MagnetoTelluricReader.h>
Public Member Functions | |
| MagnetoTelluricReader () | |
| bool | setOptions (int &argc, char **argv) |
Protected Member Functions | |
| virtual bool | parse (QTextStream &s) |
Brief description of class still missing.
Full description of class still missing
Description of constructor still missing
References QGpCoreTools::LogScale, and TRACE.
: ArgumentStdinReader() { TRACE; _samplingType=LogScale; _nSamples=10; _minRange=1000; _maxRange=100000; _outputMode=MagnetoTelluricPointOptions::ApparentResistivity; }
| bool MagnetoTelluricReader::parse | ( | QTextStream & | s | ) | [protected, virtual] |
Implements QGpCoreTools::ArgumentStdinReader.
References QGpCoreWave::MagnetoTelluricFactory::calculate(), QGpCoreWave::Resistivity1DModel::fromStream(), QGpCoreTools::Function, QGpCoreWave::Resistivity1DModel::layerCount(), QGpCoreTools::Curve< pointType >::line(), QGpCoreTools::Curve< pointType >::resample(), QGpCoreWave::MagnetoTelluricFactory::setAngularFrequency(), QGpCoreWave::MagnetoTelluricFactory::setX(), sOut(), QGpCoreWave::MagnetoTelluricFactory::toStream(), TRACE, and QGpCoreTools::Curve< pointType >::xVector().
{
TRACE;
QTextStream sOut(stdout);
Resistivity1DModel m;
QString comments;
if(!m.fromStream(s, &comments)) {
return false;
}
if(m.layerCount()>0) {
Curve<Point1D> c;
c.line(_minRange, _maxRange);
c.resample(_nSamples, _minRange, _maxRange, _samplingType | Function);
MagnetoTelluricFactory fac;
fac.setX(c.xVector());
fac.setAngularFrequency();
fac.calculate(m);
MagnetoTelluricPointOptions co(_outputMode);
QTextStream sout(stdout);
fac.toStream(sout, co);
}
return true;
}
| bool MagnetoTelluricReader::setOptions | ( | int & | argc, |
| char ** | argv | ||
| ) |
References QGpCoreTools::endl(), QGpCoreTools::InversedScale, QGpCoreTools::LinearScale, QGpCoreTools::LogScale, 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]=='-') {
if(arg=="-s") {
CoreApplication::checkOptionArg(i, argc, argv);
if(strcmp(argv[i],"period")==0) {
_samplingType=InversedScale;
} else if(strcmp(argv[i],"frequency")==0) {
_samplingType=LinearScale;
} else {
_samplingType=LogScale;
}
} else if(arg=="-min") {
CoreApplication::checkOptionArg(i, argc, argv);
_minRange=atof(argv[i]);
if(_minRange<=0) {
App::stream() << tr("gpmt: negative or null value for -min") << endl;
return false;
}
} else if(arg=="-max") {
CoreApplication::checkOptionArg(i, argc, argv);
_maxRange=atof(argv[i]);
if(_maxRange<=0) {
App::stream() << tr("gpmt: negative or null value for -max") << endl;
return false;
}
} else if(arg=="-n") {
CoreApplication::checkOptionArg(i, argc, argv);
_nSamples=atoi(argv[i]);
if(_nSamples<=0) {
App::stream() << tr("gpmt: negative or null number of samples (option -n)") << endl;
return false;
}
} else if(arg=="-apparent-resistivity") {
_outputMode=MagnetoTelluricPointOptions::ApparentResistivity;
} else if(arg=="-phase" || arg=="-phase-degrees") {
_outputMode=MagnetoTelluricPointOptions::PhaseDegrees;
} else if(arg=="-phase-radians") {
_outputMode=MagnetoTelluricPointOptions::PhaseDegrees;
} else if(arg=="-abs") {
_outputMode=MagnetoTelluricPointOptions::AbsoluteValue;
} else if(arg=="-real") {
_outputMode=MagnetoTelluricPointOptions::Real;
} else if(arg=="-imaginary") {
_outputMode=MagnetoTelluricPointOptions::Imaginary;
} else {
App::stream() << tr("gpmt: 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;
}