anisomt.cpp
Go to the documentation of this file.00001 #include <iostream>
00002 #include <string>
00003 #include "Util.h"
00004 #include "C1DAnisoMTSynthData.h"
00005 #include "MTStation.h"
00006 #include "PTensorMTStation.h"
00007 #include <iterator>
00008
00009 using namespace std;
00010 using namespace gplib;
00011
00012 int main(int argc, char *argv[])
00013 {
00014 try
00015 {
00016 if (argc == 1)
00017
00018 {
00019 string version =
00020 "$Id: anisomt.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
00021 cout << endl << endl;
00022 cout << "Program " << version << endl;
00023 cout
00024 << "Calculates 1D MT Responses with Anisotropy from input models "
00025 << endl;
00026 cout << "Based on Pek and Santos code. " << endl;
00027 cout << "You can give up to 3 command line parameters: " << endl;
00028 cout << " anisomt modelfilename outfilebase masterfile " << endl
00029 << endl;
00030 cout
00031 << " Modelfilename: The name of the file containing the model"
00032 << endl << endl;
00033 cout
00034 << " Outfilebase: The name of the outputfiles without ending,"
00035 << endl;
00036 cout
00037 << " the code will produce 2 files with additional endings .mtt and .ptensor"
00038 << endl << endl;
00039 cout
00040 << " Masterfile: A regular MT data file, the frequencies in this files "
00041 << endl;
00042 cout
00043 << " will be used as the frequencies for the forward calculation "
00044 << endl << endl;
00045 cout
00046 << "If not command line parameters are given the program will ask for the first two parameters"
00047 << endl;
00048 cout << "and use a standard set of frequencies. " << endl << endl;
00049 }
00050
00051 C1DAnisoMTSynthData Synthetic;
00052
00053 string modelfilename, mttfilename;
00054
00055 if (argc > 1)
00056
00057 {
00058 modelfilename = argv[1];
00059 }
00060 else
00061
00062 {
00063 modelfilename = AskFilename("Model filename: ");
00064 }
00065
00066 Synthetic.ReadModel(modelfilename);
00067 if (argc > 2)
00068
00069 {
00070 mttfilename = argv[2];
00071 }
00072 else
00073 {
00074 cout << "Output Format is .mtt ! Do not append ending. " << endl;
00075 mttfilename = AskFilename("Output Filename: ");
00076 }
00077 if (argc > 3)
00078
00079 {
00080 MTStation Masterfile(argv[3]);
00081 Synthetic.SetFrequencies(Masterfile.GetFrequencies());
00082 }
00083 Synthetic.GetData();
00084 Synthetic.WriteAsMtt(mttfilename);
00085 PTensorMTStation Tensor;
00086 Tensor = Synthetic;
00087 Tensor.WriteData(mttfilename);
00088 } catch (FatalException &e)
00089 {
00090 cerr << e.what() << endl;
00091 return -1;
00092 } catch (...)
00093 {
00094 cerr << "Fatal Error, aborting !" << endl;
00095 return 100;
00096 }
00097 }