diff --git a/Code/Mantid/Framework/API/CMakeLists.txt b/Code/Mantid/Framework/API/CMakeLists.txt index 1380797cf9153864b405b01c92cef538858b4fdb..4520823c4829c4cf05ee7e4f112b97c821ac1dae 100644 --- a/Code/Mantid/Framework/API/CMakeLists.txt +++ b/Code/Mantid/Framework/API/CMakeLists.txt @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IPawleyFunction.h b/Code/Mantid/Framework/API/inc/MantidAPI/IPawleyFunction.h new file mode 100644 index 0000000000000000000000000000000000000000..f560667902f0fcfd7acb7e3269363875c7e66791 --- /dev/null +++ b/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_ */ diff --git a/Code/Mantid/Framework/API/src/IPawleyFunction.cpp b/Code/Mantid/Framework/API/src/IPawleyFunction.cpp new file mode 100644 index 0000000000000000000000000000000000000000..caeae3cf971ea985f2ac294af5c778c749e345e5 --- /dev/null +++ b/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 diff --git a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h index cb0e9fb7acae149213d0e76acb2d45c81e135a4a..441ea1ff7b0366ca45f88dfa8259eb3f139fbf3b 100644 --- a/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h +++ b/Code/Mantid/Framework/CurveFitting/inc/MantidCurveFitting/PawleyFunction.h @@ -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" @@ -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() {} diff --git a/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp b/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp index 58f597657779b5a42010fba68d7f23a0acfd4a13..b54db9de6e7ba28d3e7084d05b49d98d24f0f134 100644 --- a/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/PawleyFunction.cpp @@ -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() {}