Newer
Older
Dickon Champion
committed
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Russell Taylor
committed
#include "MantidAPI/WorkspaceIterator.h"
using namespace Mantid::API;
using namespace Mantid::Kernel;
namespace Mantid
{
namespace Algorithms
{
Russell Taylor
committed
// Register the class into the algorithm factory
DECLARE_ALGORITHM(Plus)
// Get a reference to the logger
Logger& Plus::g_log = Logger::get("Plus");
Roman Tolchenov
committed
/** Performs the plus operation using Iterators and the std::tranform function.
* @param it_in1 The const iterator to the lhs data item
* @param it_in2 The const iterator to the rhs data item
* @param it_out The output iterator to the new workspace
Roman Tolchenov
committed
void Plus::performBinaryOperation(API::MatrixWorkspace::const_iterator it_in1, API::MatrixWorkspace::const_iterator it_in2,
API::MatrixWorkspace::iterator it_out)
std::transform(it_in1.begin(),it_in1.end(),it_in2.begin(),it_out.begin(),Plus_fn(this,it_in1.end() - it_in1.begin()));
}
/** Performs the addition with Gaussian errors within the transform function
* @param a The LocatedData ref of the first workspace data item
* @param b The LocatedData ref of the second workspace data item
* @returns A LocatedData ref of the result with Gaussian errors
Russell Taylor
committed
Plus::Plus_fn::operator() (const ILocatedData& a,const ILocatedData& b)
{
//copy the values from lhs
result = a;
//use the error helper to correct the changed values in result
Russell Taylor
committed
a.ErrorHelper()->plus(a,b,result);
//if (m_progress++ % m_progress_step == 0) report_progress();