Skip to content

Commit

Permalink
Refs #9992. Extract interface of PawleyFunction into API
Browse files Browse the repository at this point in the history
This is currently required so the function can be used in the SINQ module. When the POLDI algorithms are in CurveFitting/Algorithms, this interface can be deleted again.
  • Loading branch information
Michael Wedel committed Mar 27, 2015
1 parent 3964efd commit 8173c34
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Code/Mantid/Framework/API/CMakeLists.txt
Expand Up @@ -40,7 +40,7 @@ set ( SRC_FILES
src/FunctionDomain1D.cpp
src/FunctionDomainMD.cpp
src/FunctionFactory.cpp
src/FunctionParameterDecorator.cpp
src/FunctionParameterDecorator.cpp
src/FunctionProperty.cpp
src/FunctionValues.cpp
src/GridDomain.cpp
Expand All @@ -61,6 +61,7 @@ set ( SRC_FILES
src/IMDHistoWorkspace.cpp
src/IMDIterator.cpp
src/IMDWorkspace.cpp
src/IPawleyFunction.cpp
src/IPeak.cpp
src/IPeakFunction.cpp
src/IPeaksWorkspace.cpp
Expand Down Expand Up @@ -184,7 +185,7 @@ set ( INC_FILES
inc/MantidAPI/FunctionDomain1D.h
inc/MantidAPI/FunctionDomainMD.h
inc/MantidAPI/FunctionFactory.h
inc/MantidAPI/FunctionParameterDecorator.h
inc/MantidAPI/FunctionParameterDecorator.h
inc/MantidAPI/FunctionProperty.h
inc/MantidAPI/FunctionValues.h
inc/MantidAPI/GridDomain.h
Expand Down Expand Up @@ -217,6 +218,7 @@ set ( INC_FILES
inc/MantidAPI/IMDNode.h
inc/MantidAPI/IMDWorkspace.h
inc/MantidAPI/IMaskWorkspace.h
inc/MantidAPI/IPawleyFunction.h
inc/MantidAPI/IPeak.h
inc/MantidAPI/IPeakFunction.h
inc/MantidAPI/IPeaksWorkspace.h
Expand Down Expand Up @@ -325,8 +327,8 @@ set ( TEST_FILES
FuncMinimizerFactoryTest.h
FunctionAttributeTest.h
FunctionDomainTest.h
FunctionParameterDecoratorTest.h
FunctionFactoryTest.h
FunctionParameterDecoratorTest.h
FunctionPropertyTest.h
FunctionTest.h
FunctionValuesTest.h
Expand Down
80 changes: 80 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPawleyFunction.h
@@ -0,0 +1,80 @@
#ifndef MANTID_API_IPAWLEYFUNCTION_H_
#define MANTID_API_IPAWLEYFUNCTION_H_

#include "MantidAPI/DllConfig.h"
#include "MantidAPI/FunctionParameterDecorator.h"
#include "MantidAPI/IPeakFunction.h"

namespace Mantid {
namespace API {

/** IPawleyFunction
This abstract class defines the interface of a PawleyFunction. An
implementation can be found in CurveFitting/PawleyFunction. This interface
exists so that the function can be used in modules outside CurveFitting.
@author Michael Wedel, Paul Scherrer Institut - SINQ
@date 11/03/2015
Copyright © 2015 PSI-NXMM
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 MANTID_API_DLL IPawleyFunction : public FunctionParameterDecorator {
public:
IPawleyFunction();
/// Virtual destructor.
virtual ~IPawleyFunction() {}

/// A string that names the crystal system.
virtual void setCrystalSystem(const std::string &crystalSystem) = 0;

/// Sets the name of the profile function used for the reflections.
virtual void setProfileFunction(const std::string &profileFunction) = 0;

/// Set the function parameters according to the supplied unit cell.
virtual void setUnitCell(const std::string &unitCellString) = 0;

/// Assign several peaks with the same fwhm/height parameters.
virtual void setPeaks(const std::vector<Kernel::V3D> &hkls, double fwhm,
double height) = 0;

/// Removes all peaks from the function.
virtual void clearPeaks() = 0;

/// Add a peak with the given parameters.
virtual void addPeak(const Kernel::V3D &hkl, double fwhm, double height) = 0;

/// Returns the number of peaks in the function
virtual size_t getPeakCount() const = 0;

/// Returns the profile function stored for the i-th peak.
virtual IPeakFunction_sptr getPeakFunction(size_t i) const = 0;

/// Returns the Miller indices stored for the i-th peak.
virtual Kernel::V3D getPeakHKL(size_t i) const = 0;
};

typedef boost::shared_ptr<IPawleyFunction> IPawleyFunction_sptr;

} // namespace API
} // namespace Mantid

#endif /* MANTID_API_IPAWLEYFUNCTION_H_ */
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/API/src/IPawleyFunction.cpp
@@ -0,0 +1,9 @@
#include "MantidAPI/IPawleyFunction.h"

namespace Mantid {
namespace API {
/// Default constructor
IPawleyFunction::IPawleyFunction() : FunctionParameterDecorator() {}

} // namespace API
} // namespace Mantid
Expand Up @@ -3,7 +3,7 @@

#include "MantidKernel/System.h"
#include "MantidAPI/CompositeFunction.h"
#include "MantidAPI/FunctionParameterDecorator.h"
#include "MantidAPI/IPawleyFunction.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/IPeakFunction.h"
#include "MantidAPI/ParamFunction.h"
Expand Down Expand Up @@ -106,7 +106,7 @@ typedef boost::shared_ptr<PawleyParameterFunction> PawleyParameterFunction_sptr;
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport PawleyFunction : public API::FunctionParameterDecorator {
class DLLExport PawleyFunction : public API::IPawleyFunction {
public:
PawleyFunction();
virtual ~PawleyFunction() {}
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp
Expand Up @@ -267,7 +267,7 @@ DECLARE_FUNCTION(PawleyFunction)

/// Constructor
PawleyFunction::PawleyFunction()
: FunctionParameterDecorator(), m_compositeFunction(),
: IPawleyFunction(), m_compositeFunction(),
m_pawleyParameterFunction(), m_peakProfileComposite(), m_hkls(),
m_dUnit(), m_wsUnit() {}

Expand Down

0 comments on commit 8173c34

Please sign in to comment.