Skip to content

Commit

Permalink
Refs #4394 Moved inelastic part under DiffSphere files
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Dec 20, 2013
1 parent a1c3b36 commit 4d5d49c
Show file tree
Hide file tree
Showing 5 changed files with 320 additions and 379 deletions.
4 changes: 0 additions & 4 deletions Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Expand Up @@ -25,7 +25,6 @@ set ( SRC_FILES
src/DerivMinimizer.cpp
src/DiffRotDiscreteCircle.cpp
src/DiffSphere.cpp
src/ElasticDiffSphere.cpp
src/EndErfc.cpp
src/ExpDecay.cpp
src/ExpDecayMuon.cpp
Expand All @@ -45,7 +44,6 @@ set ( SRC_FILES
src/GaussianComptonProfile.cpp
src/GramCharlierComptonProfile.cpp
src/IkedaCarpenterPV.cpp
src/InelasticDiffSphere.cpp
src/LeBailFit.cpp
src/LeBailFunction.cpp
src/LevenbergMarquardtMDMinimizer.cpp
Expand Down Expand Up @@ -124,7 +122,6 @@ set ( INC_FILES
inc/MantidCurveFitting/DiffSphere.h
inc/MantidCurveFitting/DiffRotDiscreteCircle.h
inc/MantidCurveFitting/DllConfig.h
inc/MantidCurveFitting/ElasticDiffSphere.h
inc/MantidCurveFitting/EmptyValues.h
inc/MantidCurveFitting/EndErfc.h
inc/MantidCurveFitting/ExpDecay.h
Expand All @@ -147,7 +144,6 @@ set ( INC_FILES
inc/MantidCurveFitting/GaussianComptonProfile.h
inc/MantidCurveFitting/GramCharlierComptonProfile.h
inc/MantidCurveFitting/IkedaCarpenterPV.h
inc/MantidCurveFitting/InelasticDiffSphere.h
inc/MantidCurveFitting/Jacobian.h
inc/MantidCurveFitting/LeBailFit.h
inc/MantidCurveFitting/LeBailFunction.h
Expand Down
Expand Up @@ -11,8 +11,6 @@
#include "MantidAPI/Jacobian.h"
#include "MantidAPI/ImmutableCompositeFunction.h"
#include "DeltaFunction.h"
#include "MantidCurveFitting/ElasticDiffSphere.h"
#include "MantidCurveFitting/InelasticDiffSphere.h"

namespace Mantid
{
Expand Down Expand Up @@ -54,13 +52,85 @@ class DLLExport ElasticDiffSphere : public DeltaFunction
virtual ~ElasticDiffSphere() {};

/// overwrite IFunction base class methods
virtual std::string name()const{return "ElasticDiffSphere";}
virtual std::string name() const { return "ElasticDiffSphere"; }

virtual const std::string category() const { return "QENS"; }

/// A rescaling of the peak intensity
double HeightPrefactor() const;

/// overwrite IFunction base class method, which declare function parameters
virtual void init();
};


/// structure to hold info on Volino's coefficients
struct xnlc {
double x;
unsigned int l;
unsigned int n;
};

/// simple structure to hold a linear interpolation of factor J around its numerical divergence point
struct linearJ {
double slope;
double intercept;
};

/* Class representing the inelastic portion of the DiffSphere algorithm.
* Contains the 98 Lorentzians.
*/
class DLLExport InelasticDiffSphere : public API::ParamFunction, public API::IFunction1D
{
public:

InelasticDiffSphere();
virtual ~InelasticDiffSphere() {}

virtual std::string name()const{return "InelasticDiffSphere"; }

virtual const std::string category() const { return "QENS"; }

void calNumericalDeriv2( const API::FunctionDomain& domain, API::Jacobian& out );

protected:
virtual void function1D( double* out, const double* xValues, const size_t nData ) const;
virtual void functionDeriv1D( API::Jacobian* out, const double* xValues, const size_t nData );
virtual void functionDeriv( const API::FunctionDomain& domain, API::Jacobian& jacobian );
std::vector< double > LorentzianCoefficients( double a ) const;

private:

/// initialize the Xnl coefficients
void initXnlCoeff();

/// initialize the alpha coefficients
void initAlphaCoeff();

/// initialize the list of Linearized J values
void initLinJlist();

/// xnl coefficients
std::vector< xnlc > xnl;

/// certain coefficients invariant during fitting
std::vector< double > alpha;

/// maximum value of l in xnlist
unsigned int lmax;

/// number of coefficients
unsigned int ncoeff;

/// linear interpolation zone around the numerical divergence of factor J
double m_divZone;

/// list of linearized J values
std::vector< linearJ > linearJlist;

}; // end of class InelasticDiffSphere


class DLLExport DiffSphere : public API::ImmutableCompositeFunction
{

Expand Down

This file was deleted.

0 comments on commit 4d5d49c

Please sign in to comment.