randaniso.cpp
Go to the documentation of this file.00001 #include <iostream>
00002 #include <string>
00003 #include "C1DAnisoMTSynthData.h"
00004 #include "UniformRNG.h"
00005 #include "convert.h"
00006 #include <iterator>
00007
00008 using namespace std;
00009 using namespace gplib;
00010
00011 int main(void)
00012 {
00013 string version = "$Id: randaniso.cpp 1844 2010-04-12 11:34:25Z mmoorkamp $";
00014 cout << endl << endl;
00015 cout << "Program " << version << endl;
00016 cout
00017 << "Generates completely random anisotropic models and writes their response "
00018 << endl;
00019
00020 C1DAnisoMTSynthData Synthetic;
00021 UniformRNG Random;
00022
00023 try
00024 {
00025 const unsigned int nlayers = 15;
00026 const unsigned int nmodels = 100;
00027 const double minres = -1;
00028 const double maxres = 3;
00029 const double minthick = 10;
00030 const double maxthick = 30;
00031 const double minangle = 0;
00032 const double maxangle = 90;
00033 trealdata currthick(nlayers);
00034 trealdata currrho1(nlayers);
00035 trealdata currrho2(nlayers);
00036 trealdata currstrike(nlayers);
00037 trealdata zeros(nlayers);
00038 for (unsigned int i = 0; i < nlayers; ++i)
00039 zeros.at(i) = 0.0;
00040 Synthetic.SetDips(zeros);
00041 Synthetic.SetSlants(zeros);
00042 string mttfilename = "out";
00043 const float ten = 10.0;
00044
00045 for (unsigned int i = 0; i < nmodels; ++i)
00046 {
00047 for (unsigned int j = 0; j < nlayers; ++j)
00048 {
00049 currthick.at(j) = Random.GetNumber(minthick, maxthick);
00050 currrho1.at(j) = std::pow(ten, Random.GetNumber(minres, maxres));
00051 currrho2.at(j) = std::pow(ten, Random.GetNumber(minres, maxres));
00052 currstrike.at(j) = Random.GetNumber(minangle, maxangle);
00053 }
00054 Synthetic.SetRho1(currrho1);
00055 Synthetic.SetRho2(currrho2);
00056 Synthetic.SetRho3(currrho2);
00057 Synthetic.SetStrikes(currstrike);
00058 Synthetic.SetThicknesses(currthick);
00059 Synthetic.GetData();
00060 Synthetic.WriteAsMtt(mttfilename + stringify(i));
00061 }
00062 } catch (FatalException &e)
00063 {
00064 cerr << e.what() << endl;
00065 return -1;
00066 }
00067 }