Skip to content

Commit

Permalink
Small fixes to help build. Refs #5397
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Jul 30, 2012
1 parent 2fe8708 commit 5884478
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Mantid

protected:
/// Returns the number of iterations that should be performed
virtual unsigned int niterations() const;
virtual int niterations() const;
/// Returns the name of the max iterations property
std::string maxIterationsPropertyName() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Mantid
void declareParameters();

/// Name for the function
std::string name() const { return "CrossSectionResolutionConvolution"; }
std::string name() const { return "ResolutionConvolvedCrossSection"; }
/// Set a value to a named attribute. Ensures additional parameters are set when foreground is set
void setAttribute(const std::string& name, const API::IFunction::Attribute & value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Mantid
virtual void initDocs();

/// Returns the number of iterations that should be performed
virtual unsigned int niterations() const;
virtual int niterations() const;

void init();
};
Expand Down
5 changes: 0 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,6 @@ void ConvertToMD::exec()
void ConvertToMD::storeHistogramBoundaries(API::IMDEventWorkspace_sptr mdEventWS) const
{
const MantidVec & binBoundaries = m_InWS2D->readX(0);
for(auto i = (size_t)0; i < binBoundaries.size(); ++i)
{
std::cerr << binBoundaries[i] << " ";
}
std::cerr << "\n";

uint16_t nexpts = mdEventWS->getNumExperimentInfo();
for(uint16_t i = 0; i < nexpts; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ namespace Mantid
//----------------------------------------------------------------------------------------------

/// Returns the number of iterations that should be performed
unsigned int FitResolutionConvolvedModel::niterations() const
int FitResolutionConvolvedModel::niterations() const
{
const unsigned int maxIter = getProperty(MAX_ITER_NAME);
int maxIter = getProperty(MAX_ITER_NAME);
return maxIter;
}

Expand Down Expand Up @@ -105,7 +105,7 @@ namespace Mantid
fit->setProperty("InputWorkspace", getPropertyValue(INPUT_WS_NAME));

// Maximum number of allowed iterations
const unsigned int maxIter = niterations();
const int maxIter = niterations();
fit->setProperty("MaxIterations", maxIter);

try
Expand Down Expand Up @@ -140,7 +140,7 @@ namespace Mantid
const char seperator(',');
stringBuilder << "name=" << ResolutionConvolvedCrossSection().name() << seperator
<< "ResolutionFunction=" << this->getPropertyValue(RESOLUTION_NAME) << seperator
<< "ForegroundModel=" << this->getPropertyValue(FOREGROUND_NAME)
<< "ForegroundModel=" << this->getPropertyValue(FOREGROUND_NAME) << seperator
<< this->getPropertyValue("Parameters");
return stringBuilder.str();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Mantid
{
namespace MDAlgorithms
{
DECLARE_FUNCTION(ResolutionConvolvedCrossSection);

namespace
{
// Attribute names
Expand Down Expand Up @@ -81,13 +83,13 @@ namespace Mantid
const API::FunctionDomainMD* mdDomain = dynamic_cast<const API::FunctionDomainMD*>(&domain);
if(!mdDomain)
{
throw std::invalid_argument("CrossSectionResolutionConvolution can only be used with MD domains");
throw std::invalid_argument("ResolutionConvolvedCrossSection can only be used with MD domains");
}

m_workspace = boost::dynamic_pointer_cast<const API::IMDEventWorkspace>(mdDomain->getWorkspace());
if(!m_workspace)
{
throw std::invalid_argument("CrossSectionResolutionConvolution can only be used with MD event workspaces");
throw std::invalid_argument("ResolutionConvolvedCrossSection can only be used with MD event workspaces");
}
IFunctionMD::evaluateFunction(*mdDomain, values); // Calls functionMD repeatedly
}
Expand All @@ -105,7 +107,7 @@ namespace Mantid
{
if(!m_convolution)
{
throw std::runtime_error("CrossSectionResolutionConvolution::functionMD - Setup incomplete, no convolution type has been created");
throw std::runtime_error("ResolutionConvolvedCrossSection::functionMD - Setup incomplete, no convolution type has been created");
}

double signal(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Mantid
* Returns the number of iterations that should be performed
* @returns 1 for the simulation
*/
unsigned int SimulateResolutionConvolvedModel::niterations() const
int SimulateResolutionConvolvedModel::niterations() const
{
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "MantidAPI/IFunctionMD.h"
#include "MantidAPI/ParamFunction.h"

using Mantid::API::IFunction;

class FakeForegroundModel : public Mantid::MDAlgorithms::ForegroundModel
{
Expand All @@ -22,7 +23,6 @@ class FakeForegroundModel : public Mantid::MDAlgorithms::ForegroundModel
declareParameter("FgA0", start1, "Parameter 1");
declareParameter("FgA1", start2, "Parameter 2");

using Mantid::API::IFunction;
declareAttribute("FgAtt0", IFunction::Attribute(att0));
declareAttribute("FgAtt1", IFunction::Attribute(att1));
}
Expand Down Expand Up @@ -97,15 +97,13 @@ class FakeMDResolutionConvolution : public Mantid::MDAlgorithms::MDResolutionCon

void declareAttributes()
{
using Mantid::API::IFunction;
declareAttribute("ConvAtt0", IFunction::Attribute(initialAtt0));
declareAttribute("ConvAtt1", IFunction::Attribute(initialAtt1));
}

double signal(const Mantid::API::IMDIterator & , const size_t ,
Mantid::API::ExperimentInfo_const_sptr ) const
{
using Mantid::API::IFunction;
IFunction::Attribute att0 = getAttribute("ConvAtt0");
if(att0.asDouble() == initialAtt0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ class ResolutionConvolvedCrossSectionTest : public CxxTest::TestSuite
}
};

#endif /* CROSSSECTIONRESOLUTIONCONVOLUTIONTEST_H_ */
#endif /* RESOLUTIONCONVOLVEDCROSSSECTIONTEST */

0 comments on commit 5884478

Please sign in to comment.