5 #include <boost/bind.hpp>
13 void Multi1DRecObjective::SetTimeWindow(
const double start,
16 for_each(Objectives.begin(), Objectives.end(), boost::bind(
17 &C1DRecObjective::SetTimeWindow, _1, start, end));
20 void Multi1DRecObjective::SetPoisson(
const double ratio)
22 for_each(Objectives.begin(), Objectives.end(), boost::bind(
23 &C1DRecObjective::SetPoisson, _1, ratio));
26 void Multi1DRecObjective::AddRecFunction(boost::shared_ptr<
28 double mysigma,
double myc,
double myslowness,
33 myshift, mysigma, myc, myslowness, method, normalized, InWave));
34 Obj->SetErrorLevel(errorlevel);
35 Objectives.push_back(Obj);
39 void Multi1DRecObjective::AddAbsVelFunction(boost::shared_ptr<
41 const int myshift,
const double mysigma,
const double myc,
43 const double errorlevel,
const bool normalized,
44 const double absvelweight,
const double recweight)
47 TheRecData, AbsVel, myshift, mysigma, myc, myslowness, method,
49 Obj->SetErrorLevel(errorlevel);
50 Obj->SetAbsVelWeight(absvelweight);
51 Obj->SetRecWeight(recweight);
52 Objectives.push_back(Obj);
57 if (Objectives.empty())
59 "In Multi1DRecObjective: No Objective functions set !");
60 const size_t nobjs = Objectives.size();
61 for (
size_t i = 0; i < nobjs; ++i)
63 Objectives.at(i)->SetParallelID(GetParallelID() + stringify(i));
66 for_each(Objectives.begin(), Objectives.end(), boost::bind(
67 &C1DRecObjective::PreParallel, _1, member));
69 double Multi1DRecObjective::PostParallel(
const ttranscribed &member)
72 std::vector<double> values;
73 const size_t nobjs = Objectives.size();
74 for (
size_t i = 0; i < nobjs; ++i)
76 Objectives.at(i)->SetParallelID(GetParallelID() + stringify(i));
79 transform(Objectives.begin(), Objectives.end(), back_inserter(values),
80 boost::bind(&C1DRecObjective::PostParallel, _1, member));
81 double sumsquares = inner_product(values.begin(), values.end(),
85 return sqrt(sumsquares / values.size());
89 const size_t nobjs = Objectives.size();
90 for (
size_t i = 0; i < nobjs; ++i)
92 Objectives.at(i)->SetParallelID(GetParallelID() + stringify(i));
95 for_each(Objectives.begin(), Objectives.end(), boost::bind(
96 &C1DRecObjective::SafeParallel, _1, member));
99 void Multi1DRecObjective::WriteData(
const std::string &filename)
101 const size_t nobjs = Objectives.size();
102 for (
size_t i = 0; i < nobjs; ++i)
104 Objectives.at(i)->WriteData(filename + stringify(i));
111 void Multi1DRecObjective::WriteModel(
const std::string &filename)
113 Objectives.front()->WriteModel(filename);
116 void Multi1DRecObjective::WritePlot(
const std::string &filename)
118 Objectives.front()->WritePlot(filename);
121 Multi1DRecObjective::Multi1DRecObjective()
125 Multi1DRecObjective::~Multi1DRecObjective()
131 const size_t nobjs = Old.Objectives.size();
133 for (
size_t i = 0; i < nobjs; ++i)
135 boost::shared_ptr<C1DRecObjective> Obj(
136 Old.Objectives.at(i)->clone());
137 Objectives.push_back(Obj);
146 const size_t nobjs = source.Objectives.size();
148 for (
size_t i = 0; i < nobjs; ++i)
150 boost::shared_ptr<C1DRecObjective> Obj(
151 source.Objectives.at(i)->clone());
152 Objectives.push_back(Obj);
trfmethod
There are several ways to calculate receiver functions.
ublas::vector< double > ttranscribed
This class is used to model several receiver functions simultaneously.
A class to read, write and store fundamental mode surface wave dispersion data.
This objective function calculates the weighted misfit for a receiver function and the corresponding ...
Calculate the misfit between observed receiver function for a given 1D model by calculating a synthet...
The basic exception class for all errors that arise in gplib.