Skip to content

Commit

Permalink
Refs #9445. Added Poldi2DFunction.
Browse files Browse the repository at this point in the history
This function inherits from CompositeFunction to accumulate multiple functions and from IFunction1DSpectrum, so the correct domain creator is used in Fit.
  • Loading branch information
Michael Wedel committed Jun 12, 2014
1 parent 44076a4 commit 92564e7
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/SINQ/CMakeLists.txt
Expand Up @@ -14,6 +14,7 @@ set ( SRC_FILES
src/PoldiRemoveDeadWires.cpp
src/PoldiUtilities/MillerIndices.cpp
src/PoldiUtilities/PeakFunctionIntegrator.cpp
src/PoldiUtilities/Poldi2DFunction.cpp
src/PoldiUtilities/PoldiAutoCorrelationCore.cpp
src/PoldiUtilities/PoldiBasicChopper.cpp
src/PoldiUtilities/PoldiChopperFactory.cpp
Expand Down Expand Up @@ -54,6 +55,7 @@ set ( INC_FILES
inc/MantidSINQ/PoldiUtilities/MillerIndices.h
inc/MantidSINQ/PoldiUtilities/MillerIndicesIO.h
inc/MantidSINQ/PoldiUtilities/PeakFunctionIntegrator.h
inc/MantidSINQ/PoldiUtilities/Poldi2DFunction.h
inc/MantidSINQ/PoldiUtilities/PoldiAbstractChopper.h
inc/MantidSINQ/PoldiUtilities/PoldiAbstractDetector.h
inc/MantidSINQ/PoldiUtilities/PoldiAutoCorrelationCore.h
Expand Down Expand Up @@ -86,6 +88,7 @@ set ( TEST_FILES
MillerIndicesIOTest.h
MillerIndicesTest.h
PeakFunctionIntegratorTest.h
Poldi2DFunctionTest.h
PoldiAutoCorrelationCoreTest.h
PoldiBasicChopperTest.h
PoldiChopperFactoryTest.h
Expand Down
@@ -0,0 +1,57 @@
#ifndef MANTID_SINQ_POLDI2DFUNCTION_H_
#define MANTID_SINQ_POLDI2DFUNCTION_H_

#include "MantidKernel/System.h"
#include "MantidSINQ/DllConfig.h"
#include "MantidAPI/CompositeFunction.h"
#include "MantidAPI/IFunction1DSpectrum.h"

namespace Mantid
{
namespace Poldi
{

/** Poldi2DFunction :
Function for POLDI 2D spectrum.
@author Michael Wedel, Paul Scherrer Institut - SINQ
@date 13/06/2014
Copyright © 2014 PSI-MSS
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_SINQ_DLL Poldi2DFunction : virtual public API::IFunction1DSpectrum, virtual public API::CompositeFunction
{
public:
Poldi2DFunction();
virtual ~Poldi2DFunction() {}

virtual void function(const API::FunctionDomain &domain, API::FunctionValues &values) const;
virtual void functionDeriv(const API::FunctionDomain &domain, API::Jacobian &jacobian);

virtual void function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const;
};


} // namespace SINQ
} // namespace Mantid

#endif /* MANTID_SINQ_POLDI2DFUNCTION_H_ */
37 changes: 37 additions & 0 deletions Code/Mantid/Framework/SINQ/src/PoldiUtilities/Poldi2DFunction.cpp
@@ -0,0 +1,37 @@
#include "MantidSINQ/PoldiUtilities/Poldi2DFunction.h"

namespace Mantid
{
namespace Poldi
{
using namespace API;

//----------------------------------------------------------------------------------------------
/** Constructor
*/
Poldi2DFunction::Poldi2DFunction() :
IFunction1DSpectrum(),
CompositeFunction()
{
}

void Poldi2DFunction::function(const FunctionDomain &domain, FunctionValues &values) const
{
CompositeFunction::function(domain, values);
}

void Poldi2DFunction::functionDeriv(const FunctionDomain &domain, Jacobian &jacobian)
{
CompositeFunction::functionDeriv(domain, jacobian);
}

void Poldi2DFunction::function1DSpectrum(const API::FunctionDomain1DSpectrum &domain, API::FunctionValues &values) const
{
UNUSED_ARG(domain);
UNUSED_ARG(values);
}



} // namespace SINQ
} // namespace Mantid
29 changes: 29 additions & 0 deletions Code/Mantid/Framework/SINQ/test/Poldi2DFunctionTest.h
@@ -0,0 +1,29 @@
#ifndef MANTID_SINQ_POLDI2DFUNCTIONTEST_H_
#define MANTID_SINQ_POLDI2DFUNCTIONTEST_H_

#include <cxxtest/TestSuite.h>

#include "MantidSINQ/PoldiUtilities/Poldi2DFunction.h"

using Mantid::SINQ::Poldi2DFunction;
using namespace Mantid::API;

class Poldi2DFunctionTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static Poldi2DFunctionTest *createSuite() { return new Poldi2DFunctionTest(); }
static void destroySuite( Poldi2DFunctionTest *suite ) { delete suite; }


void test_Something()
{
TSM_ASSERT( "You forgot to write a test!", 0);
}


};


#endif /* MANTID_SINQ_POLDI2DFUNCTIONTEST_H_ */

0 comments on commit 92564e7

Please sign in to comment.