28 using namespace gplib;
30 int main(
int argc,
char *argv[])
33 "$Id: cag++.cpp 20 2005-11-11 12:57:01 +0100 (Fr, 11 Nov 2005) max $";
35 cout <<
"Program " << version << endl;
36 cout <<
"Calculates 1D MT Responses from input models " << endl;
38 <<
"Based on Cagniard algorithm, with stability enhancements taken from A. Avdeeva "
44 double samplerate, freqstep;
46 const double eps = 1e-5;
47 string modelfilename, mttfilename;
53 modelfilename = argv[1];
54 mttfilename = modelfilename;
59 modelfilename = AskFilename(
"Model filename: ");
61 cout <<
"Output Format is .mtt ! Do not append ending. " << endl;
62 mttfilename = AskFilename(
"Output filename: ");
65 <<
"Use Mode = 0 for standard calculation with fixed frequencies (long period) "
68 <<
"Use Mode = 1 if you want frequencies to be calculated from sample rate and window length."
71 <<
"Use Mode = 2 if you want to specify the frequency range and sampling."
81 cout <<
"Sampling rate in Hz: ";
83 cout <<
"Length for continuous sample (number of samples): ";
85 freqstep = samplerate / samplelength;
87 frequency.push_back(eps);
88 for (
int i = 1; i < samplelength / 2; ++i)
90 frequency.push_back(freqstep * i);
98 cout <<
"Minimum frequency in Hz: ";
100 double maxfreq = 0.0;
101 cout <<
"Maximum frequency in Hz: ";
103 double sampling = 0.0;
104 cout <<
"Frequencies per decade: ";
106 if (maxfreq < minfreq)
108 std::cerr <<
"Maximum frequency less than minimum freuqency !"
114 std::cerr <<
"Sampling step is not positive !" << std::endl;
117 minfreq = log10(minfreq);
118 maxfreq = log10(maxfreq);
119 double step = 1.0 / sampling;
121 for (
double currfreq = minfreq; currfreq < maxfreq; currfreq
124 frequency.push_back(std::pow(10.0, currfreq));
135 cerr << e.what() << endl;
void ReadModel(std::string filename)
Read the model from a file.
int main(int argc, char *argv[])
virtual void CalcSynthetic()
Calculate the synthetic data given the previously set parameters.
void WriteAsMtt(const std::string filename)
Write data in goettingen .mtt format.
Calculate synthetic MT data for a 1D model using Cagniard's algorithm.
void SetFrequencies(const trealdata &freqs)
Set the frequencies of the tensor elements, invalidates the previously stored impedance data...
The basic exception class for all errors that arise in gplib.