jtest.cpp

Go to the documentation of this file.
00001 #include <fstream>
00002 #include <iostream>
00003 #include <iomanip>
00004 #include "CMTStation.h"
00005 
00006 using namespace std;
00007 int main()
00008 {
00009         
00010         CMTStation       InStation;
00011         string infilename,outfilename;
00012         string stationname;     
00013         int startfreq, endfreq, nfreq, currfreq, currindex;
00014                 
00015         cout << "Input Filename: ";
00016         cin >> infilename;
00017         InStation.GetData(infilename.c_str());
00018         cout << "Output Filename: ";
00019         cin >> outfilename;
00020         cout << "Available Frequencies: " << endl;
00021         for (int i = 0; i < InStation.frequency.size(); ++i)
00022                 cout << setw(3) << i << " " << 1/InStation.frequency.at(i) << endl;
00023         cout << "Select first frequency index: ";
00024         cin >> startfreq;
00025         cout << "Select last frequency index: ";
00026         cin >> endfreq;
00027         currfreq = endfreq -startfreq+1;
00028         cout << "You have selected " << currfreq << " frequencies. " << endl;
00029         cout << "How many do you want to keep : ";
00030         cin >> nfreq;
00031         for (int i = 0; i < startfreq; ++i)
00032                 InStation.frequency.at(i) = 0;
00033         for (int i = endfreq+1; i < InStation.frequency.size(); ++i)
00034                 InStation.frequency.at(i) = 0;
00035         if (nfreq < currfreq)
00036         {
00037                 currindex = startfreq+1;
00038                 while ((nfreq < currfreq) && (currindex < InStation.frequency.size()))
00039                 {
00040                         InStation.frequency.at(currindex) = 0;
00041                         currindex += 2;
00042                         currfreq--;
00043                 }
00044                 
00045         }
00046         InStation.WriteAsJ(outfilename.c_str());
00047         
00048 }
00049 

Generated on Mon Sep 15 12:54:34 2008 for GPLIB++ by  doxygen 1.5.5