Skip to content

Commit

Permalink
Re #11650 Check if eps changed, if so, we need to re-do calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Apr 29, 2015
1 parent c9c7024 commit 17ec5e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Expand Up @@ -77,6 +77,10 @@ namespace Mantid
virtual void setActiveParameter(size_t i, double value);

private:

// Evaluate DKT function for a given t, G, F, v and eps
double getDKT (double t, double G, double F, double v, double eps) const;

/// Bin width
double m_eps;
double m_minEps;
Expand Down
13 changes: 8 additions & 5 deletions Code/Mantid/Framework/CurveFitting/src/DynamicKuboToyabe.cpp
Expand Up @@ -175,17 +175,18 @@ double HKT (const double x, const double G, const double F) {
}

// Dynamic Kubo-Toyabe
double getDKT (double t, double G, double F, double v, double eps){
double DynamicKuboToyabe::getDKT (double t, double G, double F, double v, double eps) const {

const int tsmax = static_cast<int>(std::ceil(32.768/eps));

static double oldG=-1., oldV=-1., oldF=-1.;
static std::vector<double> gStat(tsmax), gDyn(tsmax);
static double oldG=-1., oldV=-1., oldF=-1., oldEps=-1.;

const int maxTsmax = static_cast<int>(std::ceil(32.768/m_minEps));
static std::vector<double> gStat(maxTsmax), gDyn(maxTsmax);

if ( (G != oldG) || (v != oldV) || (F != oldF) ){
if ( (G != oldG) || (v != oldV) || (F != oldF) || (eps != oldEps)){

// If G or v or F have changed with respect to the
// If G or v or F or eps have changed with respect to the
// previous call, we need to re-do the computations


Expand All @@ -212,6 +213,8 @@ double getDKT (double t, double G, double F, double v, double eps){

// Store new v value
oldV =v;
// Store new eps value
oldEps =eps;

double hop = v*eps;

Expand Down

0 comments on commit 17ec5e8

Please sign in to comment.