GPLIB++
swapphase.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <iterator>
3 #include "MTStationList.h"
4 #include "Util.h"
5 
6 using namespace std;
7 using namespace gplib;
8 
9 /*!
10  * \addtogroup UtilProgs Utility Programs
11  *@{
12  * \file
13  * Swap the phase of the impedance by 180 degrees. This is useful
14  * when the responses assume a different time dependeny for the harmonic
15  * fields.
16  */
17 
18 int main()
19  {
20  MTStationList MTSites;
21 
22  cout << " Swap all phases by 180 degrees." << endl;
23  string infilename = AskFilename("Input Filename: ");
24  MTSites.GetData(infilename);
25  for (unsigned int i = 0; i < MTSites.GetList().size(); ++i)
26  {
27  cout << "Working on site " << MTSites.GetList().at(i).GetName();
28  for (unsigned int j = 0; j < MTSites.GetList().at(i).GetMTData().size(); ++j)
29  {
30  MTSites.GetList().at(i).SetMTData().at(j).SetZxx() *= -1.0;
31  MTSites.GetList().at(i).SetMTData().at(j).SetZxy() *= -1.0;
32  MTSites.GetList().at(i).SetMTData().at(j).SetZyx() *= -1.0;
33  MTSites.GetList().at(i).SetMTData().at(j).SetZyy() *= -1.0;
34  }
35  MTSites.at(i).WriteAsJ(MTSites.GetList().at(i).GetName());
36  cout << " ... done" << endl;
37  }
38  }
39 /*@}*/
MTStation & at(int loc)
Get a reference to a site at a given index.
void WriteAsJ(const std::string filename)
Write data to j-file.
Definition: MTStation.cpp:714
MTStationList holds a number of MTSites, usually associated with a single project, line, etc.
Definition: MTStationList.h:16
int main()
Definition: angleavg.cpp:12
tStationList & GetList()
Access to the complete vector of Stations.
Definition: MTStationList.h:31
void GetData(const std::string filename)
Read a list of filenames and the associated data in those files to fill the list. ...