15#include <gsl/gsl_errno.h>
16#include <gsl/gsl_fft_halfcomplex.h>
17#include <gsl/gsl_fft_real.h>
26using namespace Kernel;
28using namespace DataObjects;
29using namespace Geometry;
30using namespace Functions;
32void ConvolveWorkspaces::init() {
34 "The name of the resolution workspace");
36 "The name of the data workspace.");
39 "The name of the output workspace.");
42void ConvolveWorkspaces::exec() {
49 const size_t numHists = ws1->getNumberHistograms();
53 if (numHists != ws2->getNumberHistograms()) {
54 throw std::runtime_error(
"Size mismatch");
57 m_progress = std::make_unique<Progress>(
this, 0.0, 1.0, numHists);
60 for (
int i = 0; i < static_cast<int>(numHists); ++i) {
63 outputWS->setSharedX(i, ws2->sharedX(i));
64 auto &Yout = outputWS->mutableY(i);
67 auto res = std::make_shared<TabulatedFunction>();
68 res->setAttributeValue(
"Workspace", ws1name);
69 res->setAttributeValue(
"WorkspaceIndex", i);
73 auto fun = std::make_shared<TabulatedFunction>();
74 fun->setAttributeValue(
"Workspace", ws2name);
75 fun->setAttributeValue(
"WorkspaceIndex", i);
78 size_t N = Yout.size();
79 size_t Nx = outputWS->mutableX(i).size();
80 const double *firstX = &outputWS->mutableX(i)[0];
85 for (
size_t j = 0; j < N; j++) {
#define DECLARE_ALGORITHM(classname)
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
1D domain - a wrapper around an array of doubles.
A class to store values calculated by a function.
double getCalculated(size_t i) const
Get i-th calculated value.
A property class for workspaces.
std::unique_ptr< API::Progress > m_progress
Performes convolution of two functions.
size_t addFunction(API::IFunction_sptr f) override
Add a function.
void function(const API::FunctionDomain &domain, API::FunctionValues &values) const override
Function you want to fit to.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
@ Input
An input workspace.
@ Output
An output workspace.