00001 #include "MTAnisoRoughness.h" 00002 #include <gsl/gsl_math.h> 00003 00004 namespace gplib 00005 { 00006 00007 MTAnisoRoughness::MTAnisoRoughness() : 00008 conddiffweight(1.0), anisotropyweight(1.0), strikediffweight(1.0) 00009 { 00010 } 00011 00012 MTAnisoRoughness::~MTAnisoRoughness() 00013 { 00014 } 00015 00016 void MTAnisoRoughness::SafeParallel(const ttranscribed &member) 00017 { 00018 const unsigned int length = member.size() / 4; //we have 4 parameters in the model, so size/4 layers 00019 double roughness = fabs(member(2 * length)); // the loop starts at 1, so we skip this value in the 2nd summation 00020 const int fitexp = GetFitExponent(); 00021 const double anglescale = 45.; 00022 for (unsigned int i = 1; i < length; ++i) // for all layers except the top 00023 { 00024 roughness += conddiffweight * gsl_pow_int((member(i) 00025 - member(i - 1)), fitexp); //minimize difference in conductivity between layers 00026 roughness += anisotropyweight * gsl_pow_int(fabs(member(i + 2 00027 * length)), fitexp); //minimize anisotropy factor in each layer 00028 roughness += strikediffweight * gsl_pow_int((member(i + 3 * length) 00029 - member(i - 1 + 3 * length)) / anglescale, fitexp); //minimize difference in angle between layers 00030 } 00031 SetRMS(pow(roughness, 1. / fitexp)); 00032 } 00033 00034 double MTAnisoRoughness::PostParallel(const ttranscribed &member) 00035 { 00036 return GetRMS(); 00037 } 00038 00039 MTAnisoRoughness::MTAnisoRoughness(const MTAnisoRoughness &Old): 00040 GeneralObjective(Old), conddiffweight(Old.conddiffweight), 00041 anisotropyweight(Old.anisotropyweight), strikediffweight( 00042 Old.strikediffweight) 00043 { 00044 00045 } 00046 MTAnisoRoughness& MTAnisoRoughness::operator=( 00047 const MTAnisoRoughness& source) 00048 { 00049 if (this == &source) 00050 return *this; 00051 GeneralObjective::operator=(source); 00052 conddiffweight = source.conddiffweight; 00053 anisotropyweight = source.anisotropyweight; 00054 strikediffweight = source.strikediffweight; 00055 return *this; 00056 } 00057 }
1.5.8