Skip to content

Commit

Permalink
Re #7026. Split DiffSphere into three files so wikitools can find it.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Jun 3, 2013
1 parent 04eb2d4 commit a212b39
Show file tree
Hide file tree
Showing 7 changed files with 479 additions and 329 deletions.
4 changes: 4 additions & 0 deletions Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set ( SRC_FILES
src/DeltaFunction.cpp
src/DerivMinimizer.cpp
src/DiffSphere.cpp
src/ElasticDiffSphere.cpp
src/EndErfc.cpp
src/ExpDecay.cpp
src/ExpDecayMuon.cpp
Expand All @@ -38,6 +39,7 @@ set ( SRC_FILES
src/Gaussian1D2.cpp
src/GramCharlierComptonProfile.cpp
src/IkedaCarpenterPV.cpp
src/InelasticDiffSphere.cpp
src/LeBailFit.cpp
src/LeBailFunction.cpp
src/LevenbergMarquardtMDMinimizer.cpp
Expand Down Expand Up @@ -104,6 +106,7 @@ set ( INC_FILES
inc/MantidCurveFitting/DerivMinimizer.h
inc/MantidCurveFitting/DiffSphere.h
inc/MantidCurveFitting/DllConfig.h
inc/MantidCurveFitting/ElasticDiffSphere.h
inc/MantidCurveFitting/EmptyValues.h
inc/MantidCurveFitting/EndErfc.h
inc/MantidCurveFitting/ExpDecay.h
Expand All @@ -127,6 +130,7 @@ set ( INC_FILES
inc/MantidCurveFitting/Gaussian1D2.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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#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 @@ -40,89 +42,6 @@ namespace CurveFitting
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

/// 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 DLLExport ElasticDiffSphere : public DeltaFunction
{
public:

/// Constructor
ElasticDiffSphere();

/// Destructor
virtual ~ElasticDiffSphere() {};

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

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

};

/* 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 "QuasiElastic";}

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
{
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef MANTID_ELASTICDIFFSPHERE_H_
#define MANTID_ELASTICDIFFSPHERE_H_

//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/ParamFunction.h"
#include "MantidAPI/IFunction1D.h"
#include "MantidAPI/FunctionDomain.h"
#include "MantidAPI/Jacobian.h"
#include "MantidAPI/ImmutableCompositeFunction.h"
#include "DeltaFunction.h"

namespace Mantid
{
namespace CurveFitting
{
/**
@author Jose Borreguero, NScD
@date 11/14/2011
Copyright &copy; 2007-8 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

class DLLExport ElasticDiffSphere : public DeltaFunction
{
public:

/// Constructor
ElasticDiffSphere();

/// Destructor
virtual ~ElasticDiffSphere() {};

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

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

};

} // namespace CurveFitting
} // namespace Mantid

#endif /*MANTID_ELASTICDIFFSPHERE_H_*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#ifndef MANTID_INELASTICDIFFSPHERE_H_
#define MANTID_INELASTICDIFFSPHERE_H_

//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/ParamFunction.h"
#include "MantidAPI/IFunction1D.h"
#include "MantidAPI/FunctionDomain.h"
#include "MantidAPI/Jacobian.h"
#include "MantidAPI/ImmutableCompositeFunction.h"
#include "DeltaFunction.h"

namespace Mantid
{
namespace CurveFitting
{
/**
@author Jose Borreguero, NScD
@date 11/14/2011
Copyright &copy; 2007-8 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

/// 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 "QuasiElastic";}

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

} // namespace CurveFitting
} // namespace Mantid

#endif /*MANTID_INELASTICDIFFSPHERE_H_*/

0 comments on commit a212b39

Please sign in to comment.