GPLIB++
CombinedRoughness.cpp
Go to the documentation of this file.
1 #include "CombinedRoughness.h"
2 #include <iostream>
3 
4 using namespace std;
5 
6 namespace gplib
7  {
8  CombinedRoughness::CombinedRoughness() :
9  refcond(2.0), refvel(2.0)
10  {
11  }
12 
14  {
15  }
16 
17  //! Calculate the roughness of the model given by the parameter member
19  {
20  const unsigned int length = member.size() / 3; //we have 3 parameters in the model, so size/3 layers
21  double roughness = 0; // init returnvalue
22  const int fitexp = GetFitExponent();
23 
24  for (unsigned int i = 1; i < length; ++i) // for all layers except the top
25  {
26  roughness += pow((member(i) - member(i - 1)) / refcond,
27  fitexp); // add the squared difference of the values divided by reference
28  roughness += pow((member(i + 2 * length) - member(i - 1 + 2
29  * length)) / refvel, fitexp);
30  }
31  SetRMS(roughness);
32  }
33 
35  {
36  return GetRMS();
37  }
38 
39  //! We have to copy the base class and the local data
41  GeneralObjective(Old), refcond(Old.refcond), refvel(Old.refvel)
42  {
43  }
44 
45  //! We have to copy the base class and the local data
47  const CombinedRoughness& source)
48  {
49  if (this == &source)
50  return *this;
52  refcond = source.refcond;
53  refvel = source.refvel;
54  return *this;
55  }
56  }
ublas::vector< double > ttranscribed
Definition: gentypes.h:21
CombinedRoughness & operator=(const CombinedRoughness &source)
We have to copy the base class and the local data.
GeneralObjective & operator=(const GeneralObjective &source)
CombinedRoughness calculates the roughness of a joint MT- receiver functions model without considerat...
int GetFitExponent()
Get the Fit exponent.
virtual double PostParallel(const ttranscribed &member)
Some operations cannot be done in parallel, these are done after, returns the misfit value...
double GetRMS()
Get the current RMS.
virtual void SafeParallel(const ttranscribed &member)
Calculate the roughness of the model given by the parameter member.
The basic object for any objective function, mainly an interface class and some storage.
void SetRMS(const double x)