testaniso.cpp

Go to the documentation of this file.
00001 #include "C1DAnisoMTSynthData.h"
00002 #include "C1DMTSynthData.h"
00003 #include <iostream>
00004 #include <fstream>
00005 #include <cassert>
00006 #include "UniformRNG.h"
00007 int main()
00008 {
00009         C1DAnisoMTSynthData Aniso;
00010         C1DMTSynthData Iso;
00011         UniformRNG Random;
00012         
00013         const unsigned int nlayers = 5;
00014         trealdata rho1(nlayers,0);
00015         trealdata rho2(nlayers,0);
00016         trealdata rho3(nlayers,0);
00017         trealdata strike(nlayers,0);
00018         trealdata slant(nlayers,0);
00019         trealdata dip(nlayers,0);
00020         trealdata thickness(nlayers,10);
00021         
00022         for (unsigned int i = 0; i < nlayers; ++i)
00023         {
00024                 rho1.at(i) = Random.GetNumber(1.,1000.0);
00025                 rho2.at(i) = Random.GetNumber(1.,1000.0);
00026                 rho3.at(i) = Random.GetNumber(1.,1000.0);
00027                 strike.at(i) = Random.GetNumber(0,90.0);
00028                 slant.at(i) = Random.GetNumber(0,90.0);
00029                 dip.at(i) = Random.GetNumber(0,90.0);
00030         }
00031         std::ofstream pekmod;
00032         pekmod.open("an.dat");
00033         pekmod << nlayers << std::endl;
00034         for (unsigned int i = 0; i < nlayers; ++i)
00035         {
00036                 pekmod << thickness.at(i)  << " " << rho1.at(i) << " " << rho2.at(i) << " " << rho3.at(i) << " ";
00037                 pekmod << strike.at(i) << " " << dip.at(i) << " " << slant.at(i) << std::endl;
00038         }
00039         pekmod.close();
00040         system("z1adr");
00041         MTStation PekData("an.pek");
00042         Aniso.SetRho1(rho1);
00043         Aniso.SetRho2(rho2);
00044         Aniso.SetRho3(rho3);
00045         Aniso.SetStrikes(strike);
00046         Aniso.SetSlants(slant);
00047         Aniso.SetDips(dip);
00048         Aniso.SetThicknesses(thickness);
00049         Aniso.SetFrequencies(PekData.GetFrequencies());
00050         Aniso.GetData();
00051         
00052         Iso.SetResistivities(rho1);
00053         Iso.SetThicknesses(thickness);
00054         //Iso.SetFrequencies(freq);
00055         Iso.GetData();
00056         assert(PekData.GetMTData().size() == Aniso.GetMTData().size());
00057         std::ofstream rhocomp("rhocomp.out");
00058         for (int i = 0; i < Aniso.GetMTData().size(); ++i)
00059         {
00060                 rhocomp << Aniso.GetMTData().at(i).GetFrequency() << " ";
00061                 rhocomp << Aniso.GetMTData().at(i).GetRhoxx() << " " << PekData.GetMTData().at(i).GetRhoxx() << "    ";
00062                 rhocomp << Aniso.GetMTData().at(i).GetRhoxy() << " " << PekData.GetMTData().at(i).GetRhoxy()<< "    ";
00063                 rhocomp << Aniso.GetMTData().at(i).GetRhoyx() << " " << PekData.GetMTData().at(i).GetRhoyx()<< "    ";
00064                 rhocomp << Aniso.GetMTData().at(i).GetRhoyy() << " " << PekData.GetMTData().at(i).GetRhoyy() << std::endl;
00065         }
00066         std::ofstream phicomp("phicomp.out");
00067         for (int i = 0; i < Aniso.GetMTData().size(); ++i)
00068         {
00069                         phicomp << Aniso.GetMTData().at(i).GetFrequency() << " ";
00070                         phicomp << Aniso.GetMTData().at(i).GetPhixx() << " " << PekData.GetMTData().at(i).GetPhixx() << "    ";
00071                         phicomp << Aniso.GetMTData().at(i).GetPhixy() << " " << PekData.GetMTData().at(i).GetPhixy()<< "    ";
00072                         phicomp << Aniso.GetMTData().at(i).GetPhiyx() << " " << PekData.GetMTData().at(i).GetPhiyx()<< "    ";
00073                         phicomp << Aniso.GetMTData().at(i).GetPhiyy() << " " << PekData.GetMTData().at(i).GetPhiyy() << std::endl;
00074         }
00075         Aniso.WriteAsMtt("aniso.mtt");
00076 }

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