Commit b78b2bb6 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Refs #3008.

parent 1d604843
......@@ -331,7 +331,7 @@ private:
Algorithm& operator=(const Algorithm&);
void store();
void fillHistory(Mantid::Kernel::DateAndTime, double,unsigned int);
void fillHistory(Mantid::Kernel::DateAndTime, double,std::size_t);
void findWorkspaceProperties(std::vector<Workspace_sptr>& inputWorkspaces,
std::vector<Workspace_sptr>& outputWorkspaces) const;
void algorithm_info() const;
......
......@@ -49,7 +49,7 @@ public:
explicit AlgorithmHistory(const Algorithm* const alg,
const Mantid::Kernel::DateAndTime& start = Mantid::Kernel::DateAndTime::defaultTime(),
const double& duration = -1,unsigned int uexeccount=0);
const double& duration = -1,std::size_t uexeccount=0);
virtual ~AlgorithmHistory();
AlgorithmHistory& operator=(const AlgorithmHistory&);
AlgorithmHistory(const AlgorithmHistory&);
......@@ -69,7 +69,7 @@ public:
/// get execution date
Mantid::Kernel::DateAndTime executionDate() const {return m_executionDate;}
///get the execution count
const int& execCount() const {return m_execCount;}
const std::size_t& execCount() const {return m_execCount;}
/// get parameter list of algorithm in history const
const std::vector<Kernel::PropertyHistory>& getProperties() const {return m_properties;}
/// print contents of object
......@@ -96,7 +96,7 @@ private:
/// The PropertyHistory's defined for the algorithm
std::vector<Kernel::PropertyHistory> m_properties;
///count keeps track of execution order of an algorithm
int m_execCount;
std::size_t m_execCount;
};
DLLExport std::ostream& operator<<(std::ostream&, const AlgorithmHistory&);
......
......@@ -73,22 +73,22 @@ public:
/// Returns the value at a specified index
/// @param index :: the index
/// @param verticalIndex :: The verticalIndex
virtual double operator()(const int& index, const int& verticalIndex = 0) const = 0;
virtual double operator()(const std::size_t& index, const std::size_t& verticalIndex = 0) const = 0;
/// Sets the value at the specified index
/// @param index :: The index
/// @param value :: The new value
virtual void setValue(const int& index, const double& value) = 0;
virtual const int& spectraNo(const int& index) const;
virtual int& spectraNo(const int& index);
virtual void setValue(const std::size_t& index, const double& value) = 0;
virtual const int64_t& spectraNo(const std::size_t& index) const;
virtual int64_t& spectraNo(const std::size_t& index);
/// Get the length of the axis
virtual int length() const = 0;
virtual std::size_t length() const = 0;
/// Check whether two axis are the same, i.e same length and same spectra_values for all elements in the axis
virtual bool operator==(const Axis&) const = 0;
/// Returns a text label of for a value
virtual std::string label(const int& index)const = 0;
virtual std::string label(const std::size_t& index)const = 0;
protected:
Axis(const Axis& right);
......
......@@ -4,6 +4,7 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/System.h"
#include "MantidAPI/IFitFunction.h"
#include <boost/shared_array.hpp>
......@@ -55,26 +56,26 @@ public:
std::string asString()const;
/// Set i-th parameter
void setParameter(int, const double& value, bool explicitlySet = true);
void setParameter(size_t, const double& value, bool explicitlySet = true);
/// Get i-th parameter
double getParameter(int i)const;
double getParameter(size_t i)const;
/// Set parameter by name.
void setParameter(const std::string& name, const double& value, bool explicitlySet = true);
/// Get parameter by name.
double getParameter(const std::string& name)const;
/// Total number of parameters
int nParams()const;
std::size_t nParams()const;
/// Returns the index of parameter name
int parameterIndex(const std::string& name)const;
std::size_t parameterIndex(const std::string& name)const;
/// Returns the index of a parameter
//int parameterIndex(const double* p)const;
/// Returns the name of parameter i
std::string parameterName(int i)const;
std::string parameterName(std::size_t i)const;
/// Checks if a parameter has been set explicitly
bool isExplicitlySet(int i)const;
bool isExplicitlySet(std::size_t i)const;
/// Number of active (in terms of fitting) parameters
int nActive()const;
std::size_t nActive()const;
/// Value of i-th active parameter. Override this method to make fitted parameters different from the declared
double activeParameter(int i)const;
/// Set new value of i-th active parameter. Override this method to make fitted parameters different from the declared
......@@ -82,21 +83,21 @@ public:
/// Update parameters after a fitting iteration
void updateActive(const double* in);
/// Returns "global" index of active parameter i
int indexOfActive(int i)const;
std::size_t indexOfActive(std::size_t i)const;
/// Returns the name of active parameter i
std::string nameOfActive(int i)const;
std::string nameOfActive(std::size_t i)const;
/// Check if a parameter is active
bool isActive(int i)const;
bool isActive(std::size_t i)const;
/// Get active index for a declared parameter i
int activeIndex(int i)const;
int64_t activeIndex(std::size_t i)const;
/// Removes a parameter from the list of active
void removeActive(int i);
void removeActive(std::size_t i);
/// Restores a declared parameter i to the active status
void restoreActive(int i);
void restoreActive(std::size_t i);
/// Return parameter index from a parameter reference.
int getParameterIndex(const ParameterReference& ref)const;
int64_t getParameterIndex(const ParameterReference& ref)const;
/// Get the containing function
IFitFunction* getContainingFunction(const ParameterReference& ref)const;
/// Get the containing function
......@@ -107,14 +108,14 @@ public:
/// Remove all ties
void clearTies();
/// Removes i-th parameter's tie
bool removeTie(int i);
bool removeTie(std::size_t i);
/// Get the tie of i-th parameter
ParameterTie* getTie(int i)const;
ParameterTie* getTie(std::size_t i)const;
/// Overwrite IFitFunction methods
void addConstraint(IConstraint* ic);
/// Get constraint of i-th parameter
virtual IConstraint* getConstraint(int i)const;
virtual IConstraint* getConstraint(std::size_t i)const;
void setParametersToSatisfyConstraints();
/// Remove a constraint
void removeConstraint(const std::string& parName);
......@@ -123,25 +124,25 @@ public:
/* CompositeFunction own methods */
/// Add a function at the back of the internal function list
virtual int addFunction(IFitFunction* f);
virtual std::size_t addFunction(IFitFunction* f);
/// Returns the pointer to i-th function
IFitFunction* getFunction(int i)const;
IFitFunction* getFunction(std::size_t i)const;
/// Number of functions
int nFunctions()const{return static_cast<int>(m_functions.size());}
std::size_t nFunctions()const{return m_functions.size();}
/// Remove a function
void removeFunction(int i, bool del=true);
void removeFunction(std::size_t i, bool del=true);
/// Replace a function
void replaceFunction(int i,IFitFunction* f);
void replaceFunction(std::size_t i,IFitFunction* f);
/// Replace a function
void replaceFunction(const IFitFunction* f_old,IFitFunction* f_new);
/// Get the function index
int functionIndex(int i)const;
std::size_t functionIndex(std::size_t i)const;
/// Get the function index
int functionIndexActive(int i)const;
std::size_t functionIndexActive(std::size_t i)const;
/// Returns the index of parameter i as it declared in its function
int parameterLocalIndex(int i)const;
std::size_t parameterLocalIndex(std::size_t i)const;
/// Returns the name of parameter i as it declared in its function
std::string parameterLocalName(int i)const;
std::string parameterLocalName(std::size_t i)const;
/// Check the function.
void checkFunction();
......@@ -153,32 +154,32 @@ protected:
/// Add a new tie
virtual void addTie(ParameterTie* tie);
int paramOffset(int i)const{return m_paramOffsets[i];}
int activeOffset(int i)const{return m_activeOffsets[i];}
std::size_t paramOffset(std::size_t i)const{return m_paramOffsets[i];}
int64_t activeOffset(std::size_t i)const{return m_activeOffsets[i];}
private:
/// Extract function index and parameter name from a variable name
static void parseName(const std::string& varName,int& index, std::string& name);
static void parseName(const std::string& varName,std::size_t& index, std::string& name);
/// Pointers to the included funtions
std::vector<IFitFunction*> m_functions;
/// Individual function parameter offsets (function index in m_functions)
/// e.g. m_functions[i]->activeParameter(m_activeOffsets[i]+1) gives second active parameter of i-th function
std::vector<int> m_activeOffsets;
std::vector<int64_t> m_activeOffsets;
/// Individual function parameter offsets (function index in m_functions)
/// e.g. m_functions[i]->parameter(m_paramOffsets[i]+1) gives second declared parameter of i-th function
std::vector<int> m_paramOffsets;
std::vector<std::size_t> m_paramOffsets;
/// Keeps the function index for each declared parameter (parameter declared index)
std::vector<int> m_IFitFunction;
std::vector<std::size_t> m_IFitFunction;
/// Keeps the function index for each active parameter (parameter active index)
std::vector<int> m_IFitFunctionActive;
std::vector<std::size_t> m_IFitFunctionActive;
/// Number of active parameters
int m_nActive;
std::size_t m_nActive;
/// Total number of parameters
int m_nParams;
std::size_t m_nParams;
/// Function counter to be used in nextConstraint
mutable int m_iConstraintFunction;
mutable std::size_t m_iConstraintFunction;
};
......@@ -187,15 +188,15 @@ private:
class PartialJacobian: public Jacobian
{
Jacobian* m_J; ///< pointer to the overall Jacobian
int m_iP0; ///< offset in the overall Jacobian for a particular function
int m_iaP0; ///< offset in the active Jacobian for a particular function
std::size_t m_iP0; ///< offset in the overall Jacobian for a particular function
int64_t m_iaP0; ///< offset in the active Jacobian for a particular function
public:
/** Constructor
* @param J :: A pointer to the overall Jacobian
* @param iP0 :: The parameter index (declared) offset for a particular function
* @param iap0 :: The active parameter index (declared) offset for a particular function
*/
PartialJacobian(Jacobian* J,int iP0, int iap0):m_J(J),m_iP0(iP0),m_iaP0(iap0)
PartialJacobian(Jacobian* J,std::size_t iP0, int64_t iap0):m_J(J),m_iP0(iP0),m_iaP0(iap0)
{}
/**
* Overridden Jacobian::set(...).
......@@ -203,7 +204,7 @@ public:
* @param iP :: The parameter index of an individual function.
* @param value :: The derivative value
*/
void set(int iY, int iP, double value)
void set(std::size_t iY, std::size_t iP, double value)
{
m_J->set(iY,m_iP0 + iP,value);
}
......@@ -212,7 +213,7 @@ public:
* @param iY :: The index of the data point
* @param iP :: The parameter index of an individual function.
*/
double get(int iY, int iP)
double get(std::size_t iY, std::size_t iP)
{
return m_J->get(iY,m_iP0 + iP);
}
......
......@@ -127,16 +127,16 @@ namespace Mantid
* between j and k contains the operator connecting the next token to this one.
* @param p :: The precedence of the connecting operator.
*/
Token(unsigned int i,unsigned int j,unsigned int k,size_t p)
Token(size_t i, size_t j, size_t k,size_t p)
:is(i),ie(j),is1(k),prec(p){}
/**
* The copy constructor.
*/
Token(const Token& t)
:is(t.is),ie(t.ie),is1(t.is1),prec(t.prec){}
unsigned int is; ///< The index of the first symbol of the token.
unsigned int ie; ///< The index of the last symbol of the token.
unsigned int is1; ///< The index of the first symbol of the next token.
size_t is; ///< The index of the first symbol of the token.
size_t ie; ///< The index of the last symbol of the token.
size_t is1; ///< The index of the first symbol of the next token.
size_t prec; ///< The precedence of the connecting operator.
};
/// The container type
......
......@@ -23,8 +23,8 @@ namespace API
public:
virtual Mantid::API::EventType getEventType() const = 0;
virtual void switchTo(Mantid::API::EventType newType) = 0;
virtual void addDetectorID(const int detID) = 0;
virtual bool hasDetectorID(const int detID) const = 0;
virtual void addDetectorID(const int64_t detID) = 0;
virtual bool hasDetectorID(const int64_t detID) const = 0;
virtual void clear(const bool removeDetIDs) = 0;
virtual void reserve(size_t num) = 0;
virtual bool isSortedByTof() const = 0;
......
......@@ -44,7 +44,7 @@ namespace API
virtual double getTofMin() const = 0;
virtual double getTofMax() const = 0;
virtual EventType getEventType() const = 0;
virtual IEventList * getEventListPtr(const int workspace_index) = 0;
virtual IEventList * getEventListPtr(const std::size_t workspace_index) = 0;
virtual void clearMRU() const = 0;
};
......
......@@ -239,7 +239,7 @@ public:
virtual void initialize(){this->init();}
/// Returns the size of the fitted data (number of double values returned by the function getData())
virtual int dataSize()const = 0;
virtual size_t dataSize()const = 0;
/// Returns a reference to the fitted data. These data are taken from the workspace set by setWorkspace() method.
virtual const double* getData()const = 0;
virtual const double* getWeights()const = 0;
......@@ -250,46 +250,46 @@ public:
virtual void functionDeriv(Jacobian* out);
/// Set i-th parameter
virtual void setParameter(int, const double& value, bool explicitlySet = true) = 0;
virtual void setParameter(std::size_t, const double& value, bool explicitlySet = true) = 0;
/// Get i-th parameter
virtual double getParameter(int i)const = 0;
virtual double getParameter(std::size_t i)const = 0;
/// Set parameter by name.
virtual void setParameter(const std::string& name, const double& value, bool explicitlySet = true) = 0;
/// Get parameter by name.
virtual double getParameter(const std::string& name)const = 0;
/// Total number of parameters
virtual int nParams()const = 0;
virtual std::size_t nParams()const = 0;
/// Returns the index of parameter name
virtual int parameterIndex(const std::string& name)const = 0;
virtual std::size_t parameterIndex(const std::string& name)const = 0;
/// Returns the name of parameter i
virtual std::string parameterName(int i)const = 0;
virtual std::string parameterName(std::size_t i)const = 0;
/// Checks if a parameter has been set explicitly
virtual bool isExplicitlySet(int i)const = 0;
virtual bool isExplicitlySet(std::size_t i)const = 0;
/// Number of active (in terms of fitting) parameters
virtual int nActive()const = 0;
virtual std::size_t nActive()const = 0;
/// Value of i-th active parameter. Override this method to make fitted parameters different from the declared
virtual double activeParameter(int i)const;
virtual double activeParameter(std::size_t i)const;
/// Set new value of i-th active parameter. Override this method to make fitted parameters different from the declared
virtual void setActiveParameter(int i, double value);
virtual void setActiveParameter(std::size_t i, double value);
/// Update parameters after a fitting iteration
virtual void updateActive(const double* in);
/// Returns "global" index of active parameter i
virtual int indexOfActive(int i)const = 0;
virtual std::size_t indexOfActive(std::size_t i)const = 0;
/// Returns the name of active parameter i
virtual std::string nameOfActive(int i)const = 0;
virtual std::string nameOfActive(std::size_t i)const = 0;
/// Check if a declared parameter i is active
virtual bool isActive(int i)const = 0;
virtual bool isActive(std::size_t i)const = 0;
/// Get active index for a declared parameter i
virtual int activeIndex(int i)const = 0;
virtual int64_t activeIndex(std::size_t i)const = 0;
/// Removes a declared parameter i from the list of active
virtual void removeActive(int i) = 0;
virtual void removeActive(std::size_t i) = 0;
/// Restores a declared parameter i to the active status
virtual void restoreActive(int i) = 0;
virtual void restoreActive(std::size_t i) = 0;
/// Return parameter index from a parameter reference. Usefull for constraints and ties in composite functions
virtual int getParameterIndex(const ParameterReference& ref)const = 0;
virtual int64_t getParameterIndex(const ParameterReference& ref)const = 0;
/// Get a function containing the parameter refered to by the reference. In case of a simple function
/// it will be the same as ParameterReference::getFunction(). In case of a CompositeFunction it returns
/// a top-level function that contains the parameter. The return function itself can be a CompositeFunction
......@@ -308,14 +308,14 @@ public:
/// Remove all ties
virtual void clearTies() = 0;
/// Removes i-th parameter's tie
virtual bool removeTie(int i) = 0;
virtual bool removeTie(std::size_t i) = 0;
/// Get the tie of i-th parameter
virtual ParameterTie* getTie(int i)const = 0;
virtual ParameterTie* getTie(std::size_t i)const = 0;
/// Add a constraint to function
virtual void addConstraint(IConstraint* ic) = 0;
/// Get constraint of i-th parameter
virtual IConstraint* getConstraint(int i)const = 0;
virtual IConstraint* getConstraint(std::size_t i)const = 0;
/// Remove a constraint
virtual void removeConstraint(const std::string& parName) = 0;
/// Add a penalty to the output if some parameters do not satisfy constraints.
......@@ -385,19 +385,19 @@ public:
* @param iP :: The index of a declared parameter.
* @param value :: The derivative value.
*/
virtual void set(int iY, int iP, double value) = 0;
virtual void set(std::size_t iY, std::size_t iP, double value) = 0;
/** Get the value to a Jacobian matrix element.
* @param iY :: The index of a data point.
* @param iP :: The index of a declared parameter.
*/
virtual double get(int iY, int iP) = 0;
virtual double get(std::size_t iY, std::size_t iP) = 0;
///@cond do not document
/** Add number to all iY (data) Jacobian elements for a given iP (parameter)
* @param value :: Value to add
*/
virtual void addNumberToColumn(const double& value, const int& iActiveP)
virtual void addNumberToColumn(const double& value, const int64_t& iActiveP)
{
(void)value; (void)iActiveP; // Avoid compiler warning
throw Kernel::Exception::NotImplementedError("No addNumberToColumn() method of Jacobian provided");
......
......@@ -126,7 +126,7 @@ public:
virtual boost::shared_ptr<const Workspace> getWorkspace()const;
/// Returns the size of the fitted data (number of double values returned by the function)
virtual int dataSize()const;
virtual std::size_t dataSize()const;
/// Returns a reference to the fitted data. These data are taken from the workspace set by setWorkspace() method.
virtual const double* getData()const;
/// Returns a reference to the fitting weights.
......@@ -151,7 +151,7 @@ protected:
/// Shared pointer to the workspace
boost::shared_ptr<const API::IMDWorkspace> m_workspace;
/// Size of the fitted data
int m_dataSize;
std::size_t m_dataSize;
/// Pointer to the fitted data
boost::shared_array<double> m_data;
/// Pointer to the fitting weights
......@@ -160,7 +160,7 @@ protected:
// fields supporting IMDWorkspace iteration
/// maps dimension id to its index in m_dimensions
std::map<std::string,int> m_dimensionIndexMap;
std::map<std::string,size_t> m_dimensionIndexMap;
/// dimensions used in this function in the expected order
std::vector< boost::shared_ptr<const Mantid::Geometry::IMDDimension> > m_dimensions;
......
......@@ -130,7 +130,7 @@ public:
virtual boost::shared_ptr<const API::Workspace> getWorkspace()const;
/// Returns the size of the fitted data (number of double values returned by the function)
virtual int dataSize()const;
virtual std::size_t dataSize()const;
/// Returns a reference to the fitted data. These data are taken from the workspace set by setWorkspace() method.
virtual const double* getData()const;
virtual const double* getWeights()const;
......@@ -186,7 +186,7 @@ protected:
/// Upper bin index
int m_xMaxIndex;
/// Size of the fitted data
int m_dataSize;
std::size_t m_dataSize;
/// Pointer to the fitted data
const double* m_data;
/// Pointer to the fitting weights
......
......@@ -49,7 +49,7 @@ class IMDWorkspace;
/// Get the size of the data
virtual size_t getDataSize()const = 0;
/// Get the i-th coordinate of the current cell
virtual double getCoordinate(int i)const = 0;
virtual double getCoordinate(std::size_t i)const = 0;
/// Advance to the next cell. If the current cell is the last one in the workspace
/// do nothing and return false.
virtual bool next() = 0;
......
......@@ -36,10 +36,10 @@ namespace Mantid
/** Map from one type of index (e.g. workspace index) to another type (e.g. spectrum # or detector id #).
* Used by MatrixWorkspace to return maps.
*/
typedef std::map<int, int> IndexToIndexMap;
typedef std::map<int64_t, int64_t> IndexToIndexMap;
// Map for associating indexes to generated MDPoints.
typedef std::map<int, Mantid::Geometry::MDPoint> MatrixMDPointMap;
typedef std::map<int64_t, Mantid::Geometry::MDPoint> MatrixMDPointMap;
//----------------------------------------------------------------------
// Forward Declaration
......@@ -84,7 +84,7 @@ namespace Mantid
/// Typedef for the const workspace_iterator to use with a Workspace
typedef workspace_iterator<const LocatedDataRef, const MatrixWorkspace> const_iterator;
void initialize(const int &NVectors, const int &XLength, const int &YLength);
void initialize(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength);
virtual ~MatrixWorkspace();
void setInstrument(const Geometry::IInstrument_sptr&);
......@@ -100,7 +100,7 @@ namespace Mantid
IndexToIndexMap * getSpectrumToWorkspaceIndexMap() const;
IndexToIndexMap * getWorkspaceIndexToDetectorIDMap() const;
IndexToIndexMap * getDetectorIDToWorkspaceIndexMap( bool throwIfMultipleDets ) const;
void getIndicesFromSpectra(const std::vector<int>& spectraList, std::vector<int>& indexList) const;
void getIndicesFromSpectra(const std::vector<int64_t>& spectraList, std::vector<int64_t>& indexList) const;
/// Sample accessors
const Sample& sample() const;
......@@ -112,7 +112,7 @@ namespace Mantid
Run& mutableRun();
/// Get a detector object (Detector or DetectorGroup) for the given spectrum index
Geometry::IDetector_sptr getDetector(const int index) const;
Geometry::IDetector_sptr getDetector(const int64_t index) const;
double detectorTwoTheta(Geometry::IDetector_const_sptr det) const;
/// Calculates the drop of a neutron coming from the sample, there isn't currently a Mantid convention for which axis is vertical
double gravitationalDrop(Geometry::IDetector_const_sptr det, const double waveLength) const;
......@@ -131,11 +131,11 @@ namespace Mantid
// Section required for iteration
/// Returns the number of single indexable items in the workspace
virtual int size() const = 0;
virtual std::size_t size() const = 0;
/// Returns the size of each block of data returned by the dataY accessors
virtual int blocksize() const = 0;
virtual std::size_t blocksize() const = 0;
/// Returns the number of histograms in the workspace
virtual int getNumberHistograms() const = 0;
virtual std::size_t getNumberHistograms() const = 0;
/// Sets MatrixWorkspace title
virtual void setTitle(const std::string&);
......@@ -143,7 +143,7 @@ namespace Mantid
virtual const std::string getTitle() const;
/// Returns the bin index for a given X value of a given workspace index
size_t binIndexOf(const double xValue, const int index = 0) const;
size_t binIndexOf(const double xValue, const std::size_t = 0) const;
//----------------------------------------------------------------------
// DATA ACCESSORS
......@@ -153,13 +153,13 @@ namespace Mantid
/// Returns a read-only (i.e. const) reference to the specified X array
/// @param index :: workspace index to retrieve.
const MantidVec& readX(int const index) const { return dataX(index); }
const MantidVec& readX(std::size_t const index) const { return dataX(index); }
/// Returns a read-only (i.e. const) reference to the specified Y array
/// @param index :: workspace index to retrieve.
const MantidVec& readY(int const index) const { return dataY(index); }
const MantidVec& readY(std::size_t const index) const { return dataY(index); }
/// Returns a read-only (i.e. const) reference to the specified E array
/// @param index :: workspace index to retrieve.
const MantidVec& readE(int const index) const { return dataE(index); }
const MantidVec& readE(std::size_t const index) const { return dataE(index); }
/// Returns a read-only (i.e. const) reference to the specified X error array
/// @param index :: workspace index to retrieve.
const MantidVec& readDx(int const index) const { return dataDx(index); }
......@@ -170,33 +170,33 @@ namespace Mantid
* @param[out] Y :: reference to the pointer to the const data vector
* @param[out] E :: reference to the pointer to the const error vector
*/
virtual void readYE(int const index, MantidVec const*& Y, MantidVec const*& E) const
virtual void readYE(std::size_t const index, MantidVec const*& Y, MantidVec const*& E) const
{
Y = &dataY(index);
E = &dataE(index);
}
/// Returns the x data
virtual MantidVec& dataX(int const index) =