3 #include <boost/bind.hpp>
11 AnisoSurfaceWaveObjective::AnisoSurfaceWaveObjective(
13 const double pois,
const double err) :
32 MeasuredData = source.MeasuredData;
33 SynthData = source.SynthData;
34 Synthetic = source.Synthetic;
35 errorlevel = source.errorlevel;
36 poisson = source.poisson;
37 avelratio = source.avelratio;
44 Old.SynthData), Synthetic(Old.Synthetic)
46 errorlevel = Old.errorlevel;
47 poisson = Old.poisson;
48 avelratio = Old.avelratio;
53 const unsigned int nfulllayers = member.size() / 6;
54 boost::shared_ptr<AnisoSurfaceWaveModel> Model(
56 ttranscribed thickness(nfulllayers), velocity(nfulllayers), angle(
57 nfulllayers), deltaangle(nfulllayers), anisotropy1(nfulllayers),
58 anisotropy2(nfulllayers);
59 copy(member.begin(), member.begin() + nfulllayers, thickness.begin());
60 copy(member.begin() + nfulllayers, member.begin() + 2 * nfulllayers,
62 transform(member.begin() + 2 * nfulllayers, member.begin() + 3
63 * nfulllayers, angle.begin(), boost::bind(std::minus<double>(), _1,
65 copy(member.begin() + 3 * nfulllayers,
66 member.begin() + 4 * nfulllayers, deltaangle.begin());
67 copy(member.begin() + 4 * nfulllayers,
68 member.begin() + 5 * nfulllayers, anisotropy1.begin());
69 copy(member.begin() + 5 * nfulllayers,
70 member.begin() + 6 * nfulllayers, anisotropy2.begin());
73 copy(thickness.begin(), thickness.end(), back_inserter(
74 Model->SetThicknesses()));
75 copy(velocity.begin(), velocity.end(), back_inserter(Model->SetVs()));
77 copy(anisotropy2.begin(), anisotropy2.end(), back_inserter(
91 transform(angle.begin(), angle.end(), deltaangle.begin(),
92 back_inserter(Model->SetPhi()), std::plus<double>());
94 transform(Model->GetPhi().begin(), Model->GetPhi().end(),
95 back_inserter(Model->SetAngle1()),
CalcAngle1());
97 transform(Model->GetB().begin(), Model->GetB().end(),
98 Model->GetAngle1().begin(), back_inserter(Model->SetAnisoS()),
99 std::multiplies<double>());
101 transform(Model->GetVs().begin(), Model->GetVs().end(),
102 Model->GetAnisoS().begin(), back_inserter(Model->SetVsapp()),
103 std::plus<double>());
105 transform(Model->GetVsapp().begin(), Model->GetVsapp().end(),
106 back_inserter(Model->SetDensities()),
CalcDensity());
107 transform(Model->GetVsapp().begin(), Model->GetVsapp().end(),
108 back_inserter(Model->SetVp()), boost::bind(multiplies<double> (),
123 assert(errorlevel> 1e-4);
129 double returnvalue = 0.0;
130 for (
unsigned int i = 0; i < ndata; ++i)
A class to store information about anisotropic surface wave models.
ublas::vector< double > ttranscribed
AnisoSurfaceWaveObjective & operator=(const AnisoSurfaceWaveObjective &source)
Calculate density from a given S-velocity, the formula is taken from Owen et al. JGR 89...
This only adds a few plotting functions to GeneralObjective to define a common interface.
const trealdata & GetPhaseVelocities() const
Read-only access to the vector of phase velocities.
void SetModel(const boost::shared_ptr< AnisoSurfaceWaveModel > m)
virtual ~AnisoSurfaceWaveObjective()
int GetFitExponent()
Get the Fit exponent.
double CalcMisfit(const double measured, const double predicted, const double measerror, const double errorlevel, const int index)
This class calculates the misfit for anisotropic surface wave dispersion data.
ParkSurfaceWaveData SafeParallel(const std::string &filename)
const std::string & GetParallelID()
Derived classes need to read the ParallelId for their forward calculations.
double GetRMS()
Get the current RMS.
void PreParallel(const std::string &filename)
tdata & SetSynthData()
Only derived classes can write access the Synthetic data.
tmisfit & SetMisfit()
Only derived classes can write access the Misfit.
virtual void PreParallel(const ttranscribed &member)
Some operations cannot be done in parallel, these are done before.
AnisoSurfaceWaveObjective(const AnisoSurfaceWaveObjective &Old)
PlottableObjective & operator=(const PlottableObjective &source)
virtual double PostParallel(const ttranscribed &member)
Some operations cannot be done in parallel, these are done after, returns the misfit value...
virtual void SafeParallel(const ttranscribed &member)
The core performance calculation, has to be safe to be done in parallel.
void SetRMS(const double x)