Skip to content

Commit

Permalink
Fix codes due to renaming Bk2BkExpConvPV. Refs #5306.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jul 20, 2012
1 parent f1fdd16 commit b867e3b
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 53 deletions.
12 changes: 9 additions & 3 deletions Code/Mantid/Framework/CurveFitting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ set ( SRC_FILES
src/BackToBackExponential.cpp
src/BackgroundFunction.cpp
src/BivariateNormal.cpp
src/Bk2BkExpConvPV.cpp
src/BoundaryConstraint.cpp
src/Chebyshev.cpp
src/ChebyshevPolynomialBackground.cpp
src/Convolution.cpp
src/CostFuncFitting.cpp
src/CostFuncLeastSquares.cpp
Expand All @@ -31,6 +33,7 @@ set ( SRC_FILES
src/Gaussian.cpp
src/Gaussian1D.cpp
src/GaussianLinearBG1D.cpp
src/HighOrderPolynomialBackground.cpp
src/IDomainCreator.cpp
src/IFuncMinimizer.cpp
src/IkedaCarpenterPV.cpp
Expand Down Expand Up @@ -60,7 +63,6 @@ set ( SRC_FILES
src/SteepestDescentMinimizer.cpp
src/StretchExp.cpp
src/StretchExpMuon.cpp
src/ThermoNeutronBackToBackExpPV.cpp
src/UserFunction.cpp
src/UserFunction1D.cpp
src/UserFunctionMD.cpp
Expand All @@ -76,8 +78,10 @@ set ( INC_FILES
inc/MantidCurveFitting/BackToBackExponential.h
inc/MantidCurveFitting/BackgroundFunction.h
inc/MantidCurveFitting/BivariateNormal.h
inc/MantidCurveFitting/Bk2BkExpConvPV.h
inc/MantidCurveFitting/BoundaryConstraint.h
inc/MantidCurveFitting/Chebyshev.h
inc/MantidCurveFitting/ChebyshevPolynomialBackground.h
inc/MantidCurveFitting/CompositeValues.h
inc/MantidCurveFitting/Convolution.h
inc/MantidCurveFitting/CostFuncFitting.h
Expand Down Expand Up @@ -107,6 +111,7 @@ set ( INC_FILES
inc/MantidCurveFitting/Gaussian.h
inc/MantidCurveFitting/Gaussian1D.h
inc/MantidCurveFitting/GaussianLinearBG1D.h
inc/MantidCurveFitting/HighOrderPolynomialBackground.h
inc/MantidCurveFitting/IDomainCreator.h
inc/MantidCurveFitting/IFuncMinimizer.h
inc/MantidCurveFitting/IkedaCarpenterPV.h
Expand Down Expand Up @@ -137,7 +142,6 @@ set ( INC_FILES
inc/MantidCurveFitting/SteepestDescentMinimizer.h
inc/MantidCurveFitting/StretchExp.h
inc/MantidCurveFitting/StretchExpMuon.h
inc/MantidCurveFitting/ThermoNeutronBackToBackExpPV.h
inc/MantidCurveFitting/UserFunction.h
inc/MantidCurveFitting/UserFunction1D.h
inc/MantidCurveFitting/UserFunctionMD.h
Expand All @@ -148,7 +152,9 @@ set ( TEST_FILES
test/AbragamTest.h
test/BFGSTest.h
test/BivariateNormalTest.h
test/Bk2BkExpConvPVTest.h
test/BoundaryConstraintTest.h
test/ChebyshevPolynomialBackgroundTest.h
test/ChebyshevTest.h
test/CompositeFunctionTest.h
test/ConvolutionTest.h
Expand All @@ -169,6 +175,7 @@ set ( TEST_FILES
test/GausOscTest.h
test/Gaussian1DTest.h
test/GaussianTest.h
test/HighOrderPolynomialBackgroundTest.h
test/IkedaCarpenterPVTest.h
test/LeBailFitTest.h
test/LeBailFunctionTest.h
Expand All @@ -195,7 +202,6 @@ set ( TEST_FILES
test/StaticKuboToyabeTest.h
test/StretchExpMuonTest.h
test/StretchExpTest.h
test/ThermoNeutronBackToBackExpPVTest.h
test/UserFunction1DTest.h
test/UserFunctionTest.h
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MANTID_CURVEFITTING_THERMONEUTRONBACKTOBACKEXPPV_H_
#define MANTID_CURVEFITTING_THERMONEUTRONBACKTOBACKEXPPV_H_
#ifndef MANTID_CURVEFITTING_BK2BKEXPCONVPV_H_
#define MANTID_CURVEFITTING_BK2BKEXPCONVPV_H_

#include "MantidKernel/System.h"
#include "MantidAPI/IPeakFunction.h"
Expand All @@ -12,9 +12,8 @@ namespace Mantid
namespace CurveFitting
{

/** ThermoNeutronBackToBackExpPV : Peak profile as the convolution of back-to-back exponential with pseudo-Voigt.
for thermal neutron.
It is peak profile No. 10 in Fullprof.
/** Bk2BkExpConvPV : Peak profile as tback-to-back exponential convoluted with pseudo-Voigt.
It is peak profile No. 10 in Fullprof.
@date 2012-06-06
Expand All @@ -38,11 +37,11 @@ namespace CurveFitting
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport ThermoNeutronBackToBackExpPV : virtual public API::IPeakFunction, virtual public API::IFunctionMW
class DLLExport Bk2BkExpConvPV : virtual public API::IPeakFunction, virtual public API::IFunctionMW
{
public:
ThermoNeutronBackToBackExpPV();
virtual ~ThermoNeutronBackToBackExpPV();
Bk2BkExpConvPV();
virtual ~Bk2BkExpConvPV();

/// overwrite IPeakFunction base class methods
virtual double centre()const;
Expand All @@ -53,7 +52,7 @@ namespace CurveFitting
virtual void setFwhm(const double w);

/// overwrite IFunction base class methods
std::string name()const{return "ThermoNeutronBackToBackExpPV";}
std::string name()const{return "Bk2BkExpConvPV";}
virtual const std::string category() const { return "Peak";}

/// Set up the range of peak calculation for higher efficiency
Expand Down Expand Up @@ -95,10 +94,10 @@ namespace CurveFitting

// typedef boost::shared_ptr<TableWorkspace> TableWorkspace_sptr;

typedef boost::shared_ptr<ThermoNeutronBackToBackExpPV> ThermoNeutronBackToBackExpPV_sptr;
typedef boost::shared_ptr<Bk2BkExpConvPV> Bk2BkExpConvPV_sptr;


} // namespace CurveFitting
} // namespace Mantid

#endif /* MANTID_CURVEFITTING_THERMONEUTRONBACKTOBACKEXPPV_H_ */
#endif /* MANTID_CURVEFITTING_BK2BKEXPCONVPV_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidCurveFitting/LeBailFunction.h"
#include "MantidCurveFitting/ThermoNeutronBackToBackExpPV.h"
#include "MantidCurveFitting/Bk2BkExpConvPV.h"
#include "MantidDataObjects/Workspace2D.h"

namespace Mantid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "MantidAPI/IFunction1D.h"
#include "MantidAPI/IFunctionMW.h"
#include "MantidAPI/IPeakFunction.h"
#include "MantidCurveFitting/ThermoNeutronBackToBackExpPV.h"
#include "MantidCurveFitting/Bk2BkExpConvPV.h"

namespace Mantid
{
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace CurveFitting
// Functions to input parameters
void addPeaks(std::vector<std::vector<int> > peakhkls, std::vector<double> peakheights);
void setPeakHeights(std::vector<double> inheights);
CurveFitting::ThermoNeutronBackToBackExpPV_sptr getPeak(size_t peakindex);
CurveFitting::Bk2BkExpConvPV_sptr getPeak(size_t peakindex);

void calPeaksParameters();

Expand Down Expand Up @@ -93,7 +93,7 @@ namespace CurveFitting
std::vector<std::vector<int> > mPeakHKLs;

//std::vector<API::IPeakFunction* > mPeaks;
std::vector<ThermoNeutronBackToBackExpPV_sptr> mPeaks;
std::vector<Bk2BkExpConvPV_sptr> mPeaks;

mutable std::vector<std::map<std::string, double> > mPeakParameters; // It is in strict order with dvalues;

Expand Down
38 changes: 19 additions & 19 deletions Code/Mantid/Framework/CurveFitting/src/Bk2BkExpConvPV.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "MantidCurveFitting/ThermoNeutronBackToBackExpPV.h"
#include "MantidCurveFitting/Bk2BkExpConvPV.h"
#include "MantidKernel/System.h"
#include "MantidAPI/FunctionFactory.h"
#include <gsl/gsl_sf_erf.h>
Expand All @@ -13,29 +13,29 @@ namespace Mantid
namespace CurveFitting
{

DECLARE_FUNCTION(ThermoNeutronBackToBackExpPV)
DECLARE_FUNCTION(Bk2BkExpConvPV)

// Get a reference to the logger
Mantid::Kernel::Logger& ThermoNeutronBackToBackExpPV::g_log = Kernel::Logger::get("ThermoNeutronBackToBackExpPV");
Mantid::Kernel::Logger& Bk2BkExpConvPV::g_log = Kernel::Logger::get("Bk2BkExpConvPV");

// ----------------------------
/*
* Constructor and Desctructor
*/
ThermoNeutronBackToBackExpPV::ThermoNeutronBackToBackExpPV() : mFWHM(0.0)
Bk2BkExpConvPV::Bk2BkExpConvPV() : mFWHM(0.0)
{

}

ThermoNeutronBackToBackExpPV::~ThermoNeutronBackToBackExpPV()
Bk2BkExpConvPV::~Bk2BkExpConvPV()
{

}

/*
* Initialize: declare paraemters
*/
void ThermoNeutronBackToBackExpPV::init()
void Bk2BkExpConvPV::init()
{
declareParameter("I", 1.0);
declareParameter("TOF_h", -0.0);
Expand All @@ -48,7 +48,7 @@ namespace CurveFitting
return;
}

double ThermoNeutronBackToBackExpPV::centre()const
double Bk2BkExpConvPV::centre()const
{
double tofh = getParameter("TOF_h");

Expand All @@ -57,20 +57,20 @@ namespace CurveFitting
}


void ThermoNeutronBackToBackExpPV::setHeight(const double h)
void Bk2BkExpConvPV::setHeight(const double h)
{
setParameter("height", h);

return;
};

double ThermoNeutronBackToBackExpPV::height() const
double Bk2BkExpConvPV::height() const
{
double height = this->getParameter("height");
return height;
};

double ThermoNeutronBackToBackExpPV::fwhm() const
double Bk2BkExpConvPV::fwhm() const
{
if (fabs(mFWHM) < 1.0E-8)
{
Expand All @@ -83,21 +83,21 @@ namespace CurveFitting
return mFWHM;
};

void ThermoNeutronBackToBackExpPV::setFwhm(const double w)
void Bk2BkExpConvPV::setFwhm(const double w)
{
UNUSED_ARG(w);
throw std::invalid_argument("Unable to set FWHM");
};

void ThermoNeutronBackToBackExpPV::setCentre(const double c)
void Bk2BkExpConvPV::setCentre(const double c)
{
setParameter("TOF_h",c);
};

/*
* Implement the peak calculating formula
*/
void ThermoNeutronBackToBackExpPV::functionLocal(double* out, const double* xValues, const size_t nData) const
void Bk2BkExpConvPV::functionLocal(double* out, const double* xValues, const size_t nData) const
{
// 1. Prepare constants
const double alpha = this->getParameter("Alpha");
Expand Down Expand Up @@ -129,20 +129,20 @@ namespace CurveFitting
return;
}

void ThermoNeutronBackToBackExpPV::functionDerivLocal(API::Jacobian* , const double* , const size_t )
void Bk2BkExpConvPV::functionDerivLocal(API::Jacobian* , const double* , const size_t )
{
throw Mantid::Kernel::Exception::NotImplementedError("functionDerivLocal is not implemented for IkedaCarpenterPV.");
}

void ThermoNeutronBackToBackExpPV::functionDeriv(const API::FunctionDomain& domain, API::Jacobian& jacobian)
void Bk2BkExpConvPV::functionDeriv(const API::FunctionDomain& domain, API::Jacobian& jacobian)
{
calNumericalDeriv(domain, jacobian);
}

/*
* Calculate Omega(x) = ... ...
*/
double ThermoNeutronBackToBackExpPV::calOmega(double x, double eta, double N, double alpha, double beta, double H,
double Bk2BkExpConvPV::calOmega(double x, double eta, double N, double alpha, double beta, double H,
double sigma2, double invert_sqrt2sigma) const
{
// 1. Prepare
Expand Down Expand Up @@ -174,19 +174,19 @@ namespace CurveFitting
/*
* Implementation of complex integral E_1
*/
std::complex<double> ThermoNeutronBackToBackExpPV::E1(std::complex<double> z) const
std::complex<double> Bk2BkExpConvPV::E1(std::complex<double> z) const
{
return z;
}

void ThermoNeutronBackToBackExpPV::geneatePeak(double* out, const double* xValues, const size_t nData)
void Bk2BkExpConvPV::geneatePeak(double* out, const double* xValues, const size_t nData)
{
this->functionLocal(out, xValues, nData);

return;
}

void ThermoNeutronBackToBackExpPV::calHandEta(double sigma2, double gamma, double& H, double& eta) const
void Bk2BkExpConvPV::calHandEta(double sigma2, double gamma, double& H, double& eta) const
{
// 1. Calculate H
double H_G = sqrt(8.0 * sigma2 * log(2.0));
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ namespace CurveFitting

for (size_t i = 0; i < peaks.size(); ++i)
{
CurveFitting::ThermoNeutronBackToBackExpPV_sptr ipeak = mLeBail->getPeak(peaks[i]);
CurveFitting::Bk2BkExpConvPV_sptr ipeak = mLeBail->getPeak(peaks[i]);
ipeak->function1D(tempout, xvalues, ndata);
for (size_t j = 0; j < ndata; ++j)
{
Expand All @@ -457,7 +457,7 @@ namespace CurveFitting
for (size_t i = 0; i < peaks.size(); ++i)
{
double intensity = 0.0;
CurveFitting::ThermoNeutronBackToBackExpPV_sptr ipeak = mLeBail->getPeak(peaks[i]);
CurveFitting::Bk2BkExpConvPV_sptr ipeak = mLeBail->getPeak(peaks[i]);
ipeak->function1D(tempout, xvalues, ndata);
for (size_t j = 0; j < ndata; ++j)
{
Expand Down
12 changes: 6 additions & 6 deletions Code/Mantid/Framework/CurveFitting/src/LeBailFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ namespace CurveFitting
dvalues.push_back(dh);
heights.push_back(height);

// API::IPeakFunction* tpeak = new CurveFitting::ThermoNeutronBackToBackExpPV();
CurveFitting::ThermoNeutronBackToBackExpPV* peakptr = new CurveFitting::ThermoNeutronBackToBackExpPV();
CurveFitting::ThermoNeutronBackToBackExpPV_sptr tpeak(peakptr);
// API::IPeakFunction* tpeak = new CurveFitting::Bk2BkExpConvPV();
CurveFitting::Bk2BkExpConvPV* peakptr = new CurveFitting::Bk2BkExpConvPV();
CurveFitting::Bk2BkExpConvPV_sptr tpeak(peakptr);
tpeak->setPeakRadius(8);

tpeak->initialize();
Expand Down Expand Up @@ -337,15 +337,15 @@ namespace CurveFitting
}


CurveFitting::ThermoNeutronBackToBackExpPV_sptr LeBailFunction::getPeak(size_t peakindex)
CurveFitting::Bk2BkExpConvPV_sptr LeBailFunction::getPeak(size_t peakindex)
{
if (peakindex >= mPeaks.size())
{
g_log.error() << "Try to access peak " << peakindex << " out of range [0, " << mPeaks.size() << ")." << std::endl;
throw std::invalid_argument("getPeak() out of boundary");
}

CurveFitting::ThermoNeutronBackToBackExpPV_sptr rpeak = mPeaks[peakindex];
CurveFitting::Bk2BkExpConvPV_sptr rpeak = mPeaks[peakindex];

return rpeak;
}
Expand Down Expand Up @@ -384,7 +384,7 @@ namespace CurveFitting
throw std::runtime_error("Index out of range");
}

CurveFitting::ThermoNeutronBackToBackExpPV_sptr peak = mPeaks[index];
CurveFitting::Bk2BkExpConvPV_sptr peak = mPeaks[index];

double value = peak->getParameter(parname);

Expand Down

0 comments on commit b867e3b

Please sign in to comment.