Commit 0838697e authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #1642 Support remote construction of key implicit function types

parent 7ee6a013
......@@ -125,14 +125,27 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="inc\MantidMDAlgorithms\CompositeFunctionBuilder.h" />
<ClInclude Include="inc\MantidMDAlgorithms\CompositeImplicitFunction.h" />
<ClInclude Include="inc\MantidMDAlgorithms\IFunctionBuilder.h" />
<ClInclude Include="inc\MantidMDAlgorithms\IImplicitFunction.h" />
<ClInclude Include="inc\MantidMDAlgorithms\InvalidParameter.h" />
<ClInclude Include="inc\MantidMDAlgorithms\IParameter.h" />
<ClInclude Include="inc\MantidMDAlgorithms\NormalParameter.h" />
<ClInclude Include="inc\MantidMDAlgorithms\OriginParameter.h" />
<ClInclude Include="inc\MantidMDAlgorithms\PlaneFunctionBuilder.h" />
<ClInclude Include="inc\MantidMDAlgorithms\PlaneImplicitFunction.h" />
<ClInclude Include="inc\MantidMDAlgorithms\VectorMathematics.h" />
<ClInclude Include="test\testCPrebinning.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\CompositeFunctionBuilder.cpp" />
<ClCompile Include="src\CompositeImplicitFunction.cpp" />
<ClCompile Include="src\IFunctionBuilder.cpp" />
<ClCompile Include="src\InvalidParameter.cpp" />
<ClCompile Include="src\NormalParameter.cpp" />
<ClCompile Include="src\OriginParameter.cpp" />
<ClCompile Include="src\PlaneFunctionBuilder.cpp" />
<ClCompile Include="src\PlaneImplicitFunction.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
......
......@@ -34,6 +34,27 @@
<ClInclude Include="inc\MantidMDAlgorithms\VectorMathematics.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\IFunctionBuilder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\CompositeFunctionBuilder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\PlaneFunctionBuilder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\IParameter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\NormalParameter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\OriginParameter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="inc\MantidMDAlgorithms\InvalidParameter.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\CompositeImplicitFunction.cpp">
......@@ -42,5 +63,23 @@
<ClCompile Include="src\PlaneImplicitFunction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\PlaneFunctionBuilder.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IFunctionBuilder.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\NormalParameter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\OriginParameter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\InvalidParameter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\CompositeFunctionBuilder.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#ifndef COMPOSITEFUNCTONBUILDER_H_
#define COMPOSITEFUNCTONBUILDER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "MantidMDAlgorithms/IParameter.h"
#include "MantidMDAlgorithms/IImplicitFunction.h"
#include "MantidMDAlgorithms/IFunctionBuilder.h"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
This builder is for constructing composite functions.
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 CompositeFunctionBuilder : public IFunctionBuilder
{
private:
std::vector<boost::shared_ptr<IFunctionBuilder> > m_functionBuilders;
public:
CompositeFunctionBuilder();
void addFunctionBuilder(IFunctionBuilder* funcBuilder);
void addParameter(IParameter& parameter);
std::auto_ptr<IImplicitFunction> create() const;
~CompositeFunctionBuilder();
};
}
}
#endif
\ No newline at end of file
......@@ -51,14 +51,14 @@ namespace Mantid
*/
//TODO. This should be constructed via a factory
class DLLExport CompositeImplicitFunction : IImplicitFunction
class DLLExport CompositeImplicitFunction : public IImplicitFunction
{
public:
CompositeImplicitFunction();
~CompositeImplicitFunction();
void AddFunction(boost::shared_ptr<IImplicitFunction> constituentFunction);
bool Evaluate(MDDataObjects::point3D const * const pPoint3D) const;
void addFunction(boost::shared_ptr<IImplicitFunction> constituentFunction);
bool evaluate(MDDataObjects::point3D const * const pPoint3D) const;
protected:
std::vector<boost::shared_ptr<IImplicitFunction>> m_Functions;
private:
......
#ifndef IFUNCTONBUILDER_H_
#define IFUNCTONBUILDER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "MantidMDAlgorithms/IImplicitFunction.h"
#include "MantidMDAlgorithms/IParameter.h"
using namespace Mantid::Kernel;
using namespace Mantid::API;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
This class is the abstract type for building IImplicitFunctions
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 IFunctionBuilder
{
public:
virtual void addParameter(IParameter& parameter) = 0;
virtual std::auto_ptr<IImplicitFunction> create() const = 0;
virtual ~IFunctionBuilder() = 0;
};
}
}
#endif
\ No newline at end of file
......@@ -7,7 +7,7 @@
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "IImplicitFunction.h"
using namespace Mantid::Kernel;
namespace Mantid
......@@ -52,7 +52,7 @@ namespace Mantid
class DLLExport IImplicitFunction
{
public:
virtual bool Evaluate(MDDataObjects::point3D const * const pPoint3D) const = 0;
virtual bool evaluate(MDDataObjects::point3D const * const pPoint3D) const = 0;
virtual ~IImplicitFunction(){
};
};
......
#ifndef IPARAMETER_H_
#define IPARAMETER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
IProperty abstract property type for use with IImplicitFunctions.
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 IParameter
{
public:
virtual std::string getName() const = 0;
virtual bool isValid() const = 0;
std::auto_ptr<IParameter> clone() const
{
return std::auto_ptr<IParameter>( this->cloneImp() );
}
virtual ~IParameter() = 0
{
};
protected:
virtual IParameter* cloneImp() const = 0;
private:
IParameter& operator=(const IParameter&);
};
}
}
#endif
\ No newline at end of file
#ifndef INVALIDPARAMETER_H
#define INVALIDPARAMETER_H
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "IParameter.h"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
Invalid parameter type. Modelled from Null object pattern.
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 InvalidParameter : public IParameter
{
protected:
InvalidParameter* cloneImp() const;
public:
InvalidParameter();
std::string getName() const;
bool isValid() const;
std::auto_ptr<InvalidParameter> clone() const;
~InvalidParameter();
static std::string parameterName()
{
return "InvalidParameter";
}
};
}
}
#endif
\ No newline at end of file
#ifndef NORMALPARAMETER_H
#define NORMALPARAMETER_H
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "IParameter.h"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
Implementation of a parameter expressing normal vector information.
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 NormalParameter : public IParameter
{
private:
std::vector<double> m_normal;
protected:
NormalParameter* cloneImp() const;
public:
NormalParameter(double n1, double n2, double n3);
NormalParameter::NormalParameter(NormalParameter& other);
std::string getName() const;
bool isValid() const;
NormalParameter reflect();
std::auto_ptr<NormalParameter> clone() const;
~NormalParameter();
double getX() const;
double getY() const;
double getZ() const;
static std::string parameterName()
{
return "NormalParameter";
}
};
}
}
#endif
\ No newline at end of file
#ifndef ORIGINPARAMETER_H_
#define ORIGINPARAMETER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "IParameter.h"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
OriginParameter. Wraps a vector expressing origin location.
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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 OriginParameter :public IParameter
{
private:
std::vector<double> m_origin;
protected:
OriginParameter* cloneImp() const;
public:
OriginParameter(double o1, double o2, double o3);
OriginParameter::OriginParameter(OriginParameter& other);
bool isValid() const;
std::string getName() const;
void asVector(std::vector<double>& origin) const;
std::auto_ptr<OriginParameter> clone() const;
double getX() const;
double getY() const;
double getZ() const;
~OriginParameter();
static std::string parameterName()
{
return "OriginParameter";
}
};
}
}
#endif
\ No newline at end of file
#ifndef PLANEFUNCTONBUILDER_H_
#define PLANEFUNCTONBUILDER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <vector>
#include <memory>
#include "MantidKernel/System.h"
#include "boost/smart_ptr/shared_ptr.hpp"
#include "MantidMDAlgorithms/PlaneImplicitFunction.h"
#include "MantidMDAlgorithms/IFunctionBuilder.h"
#include "MantidMDAlgorithms/IParameter.h"
using namespace Mantid::Kernel;
namespace Mantid
{
namespace MDAlgorithms
{
/** A base class for absorption correction algorithms.
This class is the abstract type for building IImplicitFunctions
@author Owen Arnold, Tessella plc
@date 01/10/2010
Copyright &copy; 2010 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.