Skip to content

Commit

Permalink
Refs #4036: All binary operations MD
Browse files Browse the repository at this point in the history
No MDEvent - MDEvent operation for now, will add if needed.
  • Loading branch information
Janik Zikovsky committed Nov 7, 2011
1 parent dfcf3f8 commit 678ddee
Show file tree
Hide file tree
Showing 19 changed files with 885 additions and 93 deletions.
2 changes: 0 additions & 2 deletions Code/Mantid/Build/class_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,13 @@ def write_source(subproject, classname, filename, args):
*/
%s::%s()
{
// TODO Auto-generated constructor stub
}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
%s::~%s()
{
// TODO Auto-generated destructor stub
}
%s
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ set ( SRC_FILES
src/CompositeImplicitFunctionParser.cpp
src/ConvertToQ3DdE.cpp
src/ConvertToQNDany.cpp
src/DivideMD.cpp
src/IDynamicRebinning.cpp
src/InvalidParameter.cpp
src/InvalidParameterParser.cpp
src/MinusMD.cpp
src/MultiplyMD.cpp
src/NullImplicitFunction.cpp
src/PlusMD.cpp
src/QuadEnBackground.cpp
Expand All @@ -34,9 +37,12 @@ set ( INC_FILES
inc/MantidMDAlgorithms/CompositeImplicitFunctionParser.h
inc/MantidMDAlgorithms/ConvertToQ3DdE.h
inc/MantidMDAlgorithms/ConvertToQNDany.h
inc/MantidMDAlgorithms/DivideMD.h
inc/MantidMDAlgorithms/IDynamicRebinning.h
inc/MantidMDAlgorithms/InvalidParameter.h
inc/MantidMDAlgorithms/InvalidParameterParser.h
inc/MantidMDAlgorithms/MinusMD.h
inc/MantidMDAlgorithms/MultiplyMD.h
inc/MantidMDAlgorithms/NullImplicitFunction.h
inc/MantidMDAlgorithms/PlusMD.h
inc/MantidMDAlgorithms/QuadEnBackground.h
Expand All @@ -57,8 +63,11 @@ set ( TEST_FILES
#test/QuadEnBackgroundTest.h
test/ConvertToQ3DdETest.h
test/ConvertToQNDanyTest.h
test/DivideMDTest.h
test/InvalidParameterParserTest.h
test/InvalidParameterTest.h
test/MinusMDTest.h
test/MultiplyMDTest.h
test/PlusMDTest.h
test/RunParamTest.h
test/SimulateMDDTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ namespace MDAlgorithms
/// Is the operation commutative?
virtual bool commutative() const = 0;

/// The name of the first input workspace property
virtual std::string inputPropName1() const { return "LHSWorkspace";}
/// The name of the second input workspace property
virtual std::string inputPropName2() const { return "RHSWorkspace";}
/// The name of the output workspace property
virtual std::string outputPropName() const { return "OutputWorkspace";}

protected:
void init();
virtual void exec();

/// Check the inputs and throw if the algorithm cannot be run
virtual void checkInputs() = 0;

Expand All @@ -81,6 +70,16 @@ namespace MDAlgorithms
/// Run the algorithm with a MDHisotWorkspace as output, scalar and operand
virtual void execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) = 0;

/// The name of the first input workspace property
virtual std::string inputPropName1() const { return "LHSWorkspace";}
/// The name of the second input workspace property
virtual std::string inputPropName2() const { return "RHSWorkspace";}
/// The name of the output workspace property
virtual std::string outputPropName() const { return "OutputWorkspace";}

void init();
virtual void exec();

/// LHS workspace
Mantid::API::IMDWorkspace_sptr m_lhs;
/// RHS workspace
Expand All @@ -93,6 +92,8 @@ namespace MDAlgorithms
Mantid::API::IMDEventWorkspace_sptr m_rhs_event;
Mantid::MDEvents::MDHistoWorkspace_sptr m_lhs_histo;
Mantid::MDEvents::MDHistoWorkspace_sptr m_rhs_histo;
Mantid::DataObjects::WorkspaceSingleValue_sptr m_lhs_scalar;
Mantid::DataObjects::WorkspaceSingleValue_sptr m_rhs_scalar;

/// Operand MDEventWorkspace
Mantid::API::IMDEventWorkspace_sptr m_operand_event;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#ifndef MANTID_MDALGORITHMS_DIVIDEMD_H_
#define MANTID_MDALGORITHMS_DIVIDEMD_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidMDAlgorithms/BinaryOperationMD.h"

namespace Mantid
{
namespace MDAlgorithms
{

/** DivideMD : divide operation for MDWorkspaces
@date 2011-11-07
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport DivideMD : public BinaryOperationMD
{
public:
DivideMD();
~DivideMD();

virtual const std::string name() const;
virtual int version() const;

private:
virtual void initDocs();

/// Is the operation commutative?
bool commutative() const;

/// Check the inputs and throw if the algorithm cannot be run
void checkInputs();

/// Run the algorithm with an MDEventWorkspace as output
void execEvent();

/// Run the algorithm with a MDHisotWorkspace as output and operand
void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::MDEvents::MDHistoWorkspace_const_sptr operand);

/// Run the algorithm with a MDHisotWorkspace as output, scalar and operand
void execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar);



};


} // namespace MDAlgorithms
} // namespace Mantid

#endif /* MANTID_MDALGORITHMS_DIVIDEMD_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef MANTID_MDALGORITHMS_MINUSMD_H_
#define MANTID_MDALGORITHMS_MINUSMD_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidMDAlgorithms/BinaryOperationMD.h"

namespace Mantid
{
namespace MDAlgorithms
{

/** MinusMD : minus operation for MDWorkspaces
@date 2011-11-07
Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport MinusMD : public BinaryOperationMD
{
public:
MinusMD();
~MinusMD();

virtual const std::string name() const;
virtual int version() const;

private:
virtual void initDocs();

/// Is the operation commutative?
bool commutative() const;

/// Check the inputs and throw if the algorithm cannot be run
void checkInputs();

/// Run the algorithm with an MDEventWorkspace as output
void execEvent();

/// Run the algorithm with a MDHisotWorkspace as output and operand
void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::MDEvents::MDHistoWorkspace_const_sptr operand);

/// Run the algorithm with a MDHisotWorkspace as output, scalar and operand
void execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar);

};


} // namespace MDAlgorithms
} // namespace Mantid

#endif /* MANTID_MDALGORITHMS_MINUSMD_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#ifndef MANTID_MDALGORITHMS_MULTIPLYMD_H_
#define MANTID_MDALGORITHMS_MULTIPLYMD_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidMDAlgorithms/BinaryOperationMD.h"

namespace Mantid
{
namespace MDAlgorithms
{

/** MultiplyMD : multiplication operation for MDWorkspaces
@date 2011-11-07
Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport MultiplyMD : public BinaryOperationMD
{
public:
MultiplyMD();
~MultiplyMD();

virtual const std::string name() const;
virtual int version() const;

private:
virtual void initDocs();

/// Is the operation commutative?
bool commutative() const;

/// Check the inputs and throw if the algorithm cannot be run
void checkInputs();

/// Run the algorithm with an MDEventWorkspace as output
void execEvent();

/// Run the algorithm with a MDHisotWorkspace as output and operand
void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::MDEvents::MDHistoWorkspace_const_sptr operand);

/// Run the algorithm with a MDHisotWorkspace as output, scalar and operand
void execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar);


};


} // namespace MDAlgorithms
} // namespace Mantid

#endif /* MANTID_MDALGORITHMS_MULTIPLYMD_H_ */
27 changes: 18 additions & 9 deletions Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/PlusMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidMDEvents/MDEventWorkspace.h"
#include "MantidMDAlgorithms/BinaryOperationMD.h"

namespace Mantid
{
namespace MDAlgorithms
{

/** Sum to MDWorkspaces together.
/** Sum two MDWorkspaces together.
@author Janik Zikovsky
@date 2011-08-12
Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand All @@ -36,7 +36,7 @@ namespace MDAlgorithms
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport PlusMD : public API::Algorithm
class DLLExport PlusMD : public BinaryOperationMD
{
public:
PlusMD();
Expand All @@ -46,16 +46,25 @@ namespace MDAlgorithms
virtual const std::string name() const { return "PlusMD";};
/// Algorithm's version for identification
virtual int version() const { return 1;};
/// Algorithm's category for identification
virtual const std::string category() const { return "Arithmetic";}

private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
/// Initialise the properties
void init();
/// Run the algorithm
void exec();

/// Is the operation commutative?
bool commutative() const;

/// Check the inputs and throw if the algorithm cannot be run
void checkInputs();

/// Run the algorithm with an MDEventWorkspace as output
void execEvent();

/// Run the algorithm with a MDHisotWorkspace as output and operand
void execHistoHisto(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::MDEvents::MDHistoWorkspace_const_sptr operand);

/// Run the algorithm with a MDHisotWorkspace as output, scalar and operand
void execHistoScalar(Mantid::MDEvents::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar);

template<typename MDE, size_t nd>
void doPlus(typename Mantid::MDEvents::MDEventWorkspace<MDE, nd>::sptr ws);
Expand Down

0 comments on commit 678ddee

Please sign in to comment.