00001 #include "MTRoughness.h" 00002 #include <gsl/gsl_math.h> 00003 00004 namespace gplib 00005 { 00006 MTRoughness::MTRoughness() 00007 { 00008 } 00009 00010 MTRoughness::~MTRoughness() 00011 { 00012 } 00013 00014 void MTRoughness::SafeParallel(const ttranscribed &member) 00015 { 00016 const unsigned int length = member.size() / 3; //we have 3 parameters in the model, so size/3 layers 00017 double roughness = 0; // init returnvalue 00018 const int fitexp = GetFitExponent(); 00019 00020 for (unsigned int i = 1; i < length; ++i) // for all layers except the top 00021 { 00022 roughness += gsl_pow_int((member(i) - member(i - 1)), fitexp); // add the squared difference of the values divided by reference 00023 } 00024 SetRMS(roughness); 00025 } 00026 00027 double MTRoughness::PostParallel(const ttranscribed &member) 00028 { 00029 return GetRMS(); 00030 } 00031 00032 MTRoughness::MTRoughness(const MTRoughness &Old) : 00033 GeneralObjective(Old) 00034 { 00035 00036 } 00037 MTRoughness& MTRoughness::operator=(const MTRoughness& source) 00038 { 00039 if (this == &source) 00040 return *this; 00041 GeneralObjective::operator=(source); 00042 return *this; 00043 } 00044 }
1.5.8