diff --git a/Code/Mantid/Framework/API/src/MDGeometry.cpp b/Code/Mantid/Framework/API/src/MDGeometry.cpp index 8f672479b2b406038cadb11d3aab9544eb2336e6..7a2f52368aab2534bfb49ed475b68ac61aafcaa2 100644 --- a/Code/Mantid/Framework/API/src/MDGeometry.cpp +++ b/Code/Mantid/Framework/API/src/MDGeometry.cpp @@ -338,8 +338,8 @@ namespace API for (size_t d=0; d<m_dimensions.size(); d++) { IMDDimension_sptr dim = m_dimensions[d]; - double min = (dim->getMinimum() * scaling[d]) + offset[d]; - double max = (dim->getMaximum() * scaling[d]) + offset[d]; + coord_t min = (dim->getMinimum() * coord_t(scaling[d])) + coord_t(offset[d]); + coord_t max = (dim->getMaximum() * coord_t(scaling[d])) + coord_t(offset[d]); dim->setRange( dim->getNBins(), min, max); } // Clear the original workspace diff --git a/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp b/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp index 7c362f62a62c9a61f074b4475e8d75318d5daf0f..7635a1924bbdc9b5a22927f42ab673266960dec4 100644 --- a/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp +++ b/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp @@ -1361,19 +1361,19 @@ namespace Mantid virtual bool getIsIntegrated() const {return m_axis.length() == 1;} /// @return the minimum extent of this dimension - virtual double getMinimum() const {return m_axis(0);} + virtual coord_t getMinimum() const {return coord_t(m_axis(0));} /// @return the maximum extent of this dimension - virtual double getMaximum() const {return m_axis(m_axis.length()-1);} + virtual coord_t getMaximum() const {return coord_t(m_axis(m_axis.length()-1));} /// number of bins dimension have (an integrated has one). A axis directed along dimension would have getNBins+1 axis points. virtual size_t getNBins() const {return m_axis.length();} /// Change the extents and number of bins - virtual void setRange(size_t /*nBins*/, double /*min*/, double /*max*/){throw std::runtime_error("Not implemented");} + virtual void setRange(size_t /*nBins*/, coord_t /*min*/, coord_t /*max*/){throw std::runtime_error("Not implemented");} /// Get coordinate for index; - virtual double getX(size_t ind)const {return m_axis(ind);} + virtual coord_t getX(size_t ind)const {return coord_t(m_axis(ind));} //Dimensions must be xml serializable. @@ -1416,20 +1416,20 @@ namespace Mantid /// if the dimension is integrated (e.g. have single bin) virtual bool getIsIntegrated() const {return m_X.size() == 1;} - /// @return the minimum extent of this dimension - virtual double getMinimum() const {return m_X.front();} + /// coord_t the minimum extent of this dimension + virtual coord_t getMinimum() const {return coord_t(m_X.front());} /// @return the maximum extent of this dimension - virtual double getMaximum() const {return m_X.back();} + virtual coord_t getMaximum() const {return coord_t(m_X.back());} /// number of bins dimension have (an integrated has one). A axis directed along dimension would have getNBins+1 axis points. virtual size_t getNBins() const {return m_X.size()-1;} /// Change the extents and number of bins - virtual void setRange(size_t /*nBins*/, double /*min*/, double /*max*/){throw std::runtime_error("Not implemented");} + virtual void setRange(size_t /*nBins*/, coord_t /*min*/, coord_t /*max*/){throw std::runtime_error("Not implemented");} /// Get coordinate for index; - virtual double getX(size_t ind)const {return m_X[ind];} + virtual coord_t getX(size_t ind)const {return coord_t(m_X[ind]);} //Dimensions must be xml serializable. virtual std::string toXMLString() const {throw std::runtime_error("Not implemented");} diff --git a/Code/Mantid/Framework/API/src/MatrixWorkspaceMDIterator.cpp b/Code/Mantid/Framework/API/src/MatrixWorkspaceMDIterator.cpp index c2dd9a65adc0f393ec57d2a4f089af6f935a1f0d..caaf1abca4816e598abfa7f18c016783f8d01474 100644 --- a/Code/Mantid/Framework/API/src/MatrixWorkspaceMDIterator.cpp +++ b/Code/Mantid/Framework/API/src/MatrixWorkspaceMDIterator.cpp @@ -46,7 +46,7 @@ namespace API m_max = (m_endWI - m_beginWI) * m_blockSize; m_xIndex = 0; // Trigger the calculation for the first index - m_workspaceIndex = -1; + m_workspaceIndex = size_t(-1); // This makes sure calcWorkspacePos() updates calcWorkspacePos(m_beginWI); } @@ -225,9 +225,9 @@ namespace API { // Place the point in X dimension if (m_isBinnedData) - m_center[0] = (m_X[m_xIndex] + m_X[m_xIndex+1]) / 2.0; + m_center[0] = VMD_t((m_X[m_xIndex] + m_X[m_xIndex+1]) / 2.0); else - m_center[0] = m_X[m_xIndex]; + m_center[0] = VMD_t(m_X[m_xIndex]); return m_center; } diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/IMDDimension.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/IMDDimension.h index fe1dcbb30b66330a6eff7342cc58fcf2950ab5c5..134efe84f12bfda07dd03c9e1b7d724dc03524bb 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/IMDDimension.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/IMDDimension.h @@ -1,11 +1,12 @@ #ifndef I_MD_DIMENSION_H #define I_MD_DIMENSION_H -#include <vector> -#include <stdexcept> #include "MantidGeometry/DllConfig.h" +#include "MantidGeometry/MDGeometry/MDTypes.h" #include "MantidKernel/V3D.h" #include <boost/shared_ptr.hpp> +#include <stdexcept> +#include <vector> namespace Mantid { @@ -57,10 +58,10 @@ namespace Mantid virtual std::string getDimensionId() const = 0; /// @return the minimum extent of this dimension - virtual double getMinimum() const = 0; + virtual coord_t getMinimum() const = 0; /// @return the maximum extent of this dimension - virtual double getMaximum() const = 0; + virtual coord_t getMaximum() const = 0; /// @return number of bins dimension have (an integrated has one). A axis directed along dimension would have getNBins+1 axis points. virtual size_t getNBins() const = 0; @@ -69,14 +70,14 @@ namespace Mantid virtual std::string toXMLString() const = 0; /// Change the extents and number of bins - virtual void setRange(size_t nBins, double min, double max) = 0; + virtual void setRange(size_t nBins, coord_t min, coord_t max) = 0; /** @return coordinate of the axis at the given index * @param ind :: index into the axis */ - virtual double getX(size_t ind)const = 0; + virtual coord_t getX(size_t ind) const = 0; /** @return the width of each bin */ - virtual double getBinWidth() const + virtual coord_t getBinWidth() const { return (getMaximum() - getMinimum())/getNBins(); } diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDHistoDimension.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDHistoDimension.h index 786836fad7b04190ffd8e2ecb2a33b9e9fa573e4..f195c006f0db11fa42193c99bf5785027cc0ff82 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDHistoDimension.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDHistoDimension.h @@ -31,10 +31,10 @@ namespace Geometry * @param max :: maximum extent * @param numBins :: number of bins (evenly spaced) */ - MDHistoDimension(std::string name, std::string ID, std::string units, double min, double max, size_t numBins) + MDHistoDimension(std::string name, std::string ID, std::string units, coord_t min, coord_t max, size_t numBins) : m_name(name), m_dimensionId(ID), m_units(units), m_min(min), m_max(max), m_numBins(numBins), - m_binWidth((max-min)/static_cast<double>(numBins)) + m_binWidth((max-min)/static_cast<coord_t>(numBins)) { if(max < min) { @@ -80,13 +80,13 @@ namespace Geometry } /// Returns the maximum extent of this dimension - virtual double getMaximum() const + virtual coord_t getMaximum() const { return m_max; } /// Returns the minimum extent of this dimension - virtual double getMinimum() const + virtual coord_t getMinimum() const { return m_min; } @@ -101,13 +101,13 @@ namespace Geometry virtual std::string toXMLString() const; /// Get coordinate for index; - virtual double getX(size_t index) const + virtual coord_t getX(size_t index) const { - return static_cast<double>(index) * m_binWidth + m_min; + return static_cast<coord_t>(index) * m_binWidth + m_min; } /// Return the width of one bin. - double getBinWidth() const + coord_t getBinWidth() const { return m_binWidth; } @@ -117,7 +117,7 @@ namespace Geometry * @param min :: extents minimum * @param max :: extents maximum */ - void setRange(size_t nBins, double min, double max) + void setRange(size_t nBins, coord_t min, coord_t max) { if(max < min) { @@ -126,7 +126,7 @@ namespace Geometry m_min = min; m_max = max; m_numBins = nBins; - m_binWidth = (m_max-m_min) / static_cast<double>(m_numBins); + m_binWidth = (m_max-m_min) / static_cast<coord_t>(m_numBins); } private: @@ -140,16 +140,16 @@ namespace Geometry std::string m_units; /// Extent of dimension - double m_min; + coord_t m_min; /// Extent of dimension - double m_max; + coord_t m_max; /// Number of bins size_t m_numBins; /// Calculated bin size - double m_binWidth; + coord_t m_binWidth; }; diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlane.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlane.h index 6e84ff0c2bd50efff81c2d84e2eb4ae1574133e4..0e839b4f05776b77e9a63faa4d56f23c13c20db6 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlane.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlane.h @@ -61,7 +61,8 @@ namespace Geometry public: MDPlane(const Mantid::Kernel::VMD & normal, const Mantid::Kernel::VMD & point); MDPlane(const std::vector<coord_t> & normal, const std::vector<coord_t> & point); - MDPlane(const size_t nd, const coord_t * normal, const coord_t * point); + MDPlane(const size_t nd, const float * normal, const float * point); + MDPlane(const size_t nd, const double * normal, const double * point); MDPlane(const std::vector<Mantid::Kernel::VMD> & vectors, const Mantid::Kernel::VMD & origin, const Mantid::Kernel::VMD & insidePoint); MDPlane(const MDPlane & other); MDPlane & operator=(const MDPlane & other); diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlaneImplicitFunction.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlaneImplicitFunction.h index 1aac129ebb5df92f779d93aaa20414aa6f4d8eaf..63f86d0c7f5892d0f849dbd33b519c7a6bbac384 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlaneImplicitFunction.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/MDGeometry/MDPlaneImplicitFunction.h @@ -41,8 +41,8 @@ public: /// Default constructor. MDPlaneImplicitFunction(); /// Parameter constructor for setting origin. - MDPlaneImplicitFunction(const size_t nd, const coord_t * normal, - const coord_t * point); + MDPlaneImplicitFunction(const size_t nd, const float * normal, const float * point); + MDPlaneImplicitFunction(const size_t nd, const double * normal, const double * point); /// Class destructor. virtual ~MDPlaneImplicitFunction(); diff --git a/Code/Mantid/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp b/Code/Mantid/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp index da558a0816a622b9477e0b090fd29461eabb1100..5bb7174419d8d8f0f5ecbec70beb66d41bb9b3cd 100644 --- a/Code/Mantid/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp +++ b/Code/Mantid/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp @@ -82,7 +82,7 @@ Mantid::Geometry::IMDDimension* IMDDimensionFactory::create() const Mantid::Geometry::IMDDimension* IMDDimensionFactory::create(int nBins, double min, double max) const { MDHistoDimension* product = doCreate(); - product->setRange(nBins, min, max); //Override the number of bins, min and max. + product->setRange(nBins, coord_t(min), coord_t(max)); //Override the number of bins, min and max. return product; } @@ -126,7 +126,7 @@ Mantid::Geometry::MDHistoDimension* IMDDimensionFactory::doCreate() const lowerBounds = lowerLimit; } - return new MDHistoDimension(name, id, units, lowerBounds, upperBounds, nBins); + return new MDHistoDimension(name, id, units, coord_t(lowerBounds), coord_t(upperBounds), nBins); } /** diff --git a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDHistoDimensionBuilder.cpp b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDHistoDimensionBuilder.cpp index f83cee93d94c724e39c1ce9480ec9e625ed581a2..7c6682df02853c6421509652f6a5e6e3c52fceff 100644 --- a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDHistoDimensionBuilder.cpp +++ b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDHistoDimensionBuilder.cpp @@ -143,7 +143,7 @@ namespace Mantid { throw std::invalid_argument("Cannot create MDHistogramDimension without setting a n bins."); } - return new MDHistoDimension(m_name, m_id, m_units, m_min, m_max, m_nbins); + return new MDHistoDimension(m_name, m_id, m_units, coord_t(m_min), coord_t(m_max), m_nbins); } /* diff --git a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlane.cpp b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlane.cpp index 4442ea6c85a2f7d0ed0ff97bd1098781d3e16cf9..ffcda27627186d21b5b1cfe059d8a49fb45acbf8 100644 --- a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlane.cpp +++ b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlane.cpp @@ -48,7 +48,21 @@ namespace Geometry * @param normal :: normal to the plane. Points that are in the direction of the normal of the plane are considered to be bounded by it. * @param point :: any point that is on the plane */ - MDPlane::MDPlane(const size_t nd, const coord_t * normal, const coord_t * point) + MDPlane::MDPlane(const size_t nd, const float * normal, const float * point) + : m_nd(nd) + { + if ((m_nd < 1) || (m_nd > 100)) throw std::invalid_argument("MDPlane::ctor(): Invalid number of dimensions in the workspace!"); + construct(normal, point); + } + + //---------------------------------------------------------------------------------------------- + /** Constructor with normal and point + * + * @param nd :: number of dimensions + * @param normal :: normal to the plane. Points that are in the direction of the normal of the plane are considered to be bounded by it. + * @param point :: any point that is on the plane + */ + MDPlane::MDPlane(const size_t nd, const double * normal, const double * point) : m_nd(nd) { if ((m_nd < 1) || (m_nd > 100)) throw std::invalid_argument("MDPlane::ctor(): Invalid number of dimensions in the workspace!"); diff --git a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlaneImplicitFunction.cpp b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlaneImplicitFunction.cpp index 9016704d17d8113683562250200df52f1154ef97..d3d0b36c91b5806d90638f2f21753dfbb5672705 100644 --- a/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlaneImplicitFunction.cpp +++ b/Code/Mantid/Framework/Geometry/src/MDGeometry/MDPlaneImplicitFunction.cpp @@ -29,14 +29,35 @@ MDPlaneImplicitFunction::MDPlaneImplicitFunction() : MDImplicitFunction() * @param point array of coorindates for the plane origin */ MDPlaneImplicitFunction::MDPlaneImplicitFunction(const size_t nd, - const coord_t *normal, - const coord_t *point) : + const float *normal, + const float *point) : MDImplicitFunction() { this->origin = new coord_t[nd]; for( std::size_t i = 0; i < nd; i++) { - this->origin[i] = point[i]; + this->origin[i] = coord_t(point[i]); + } + this->addPlane(MDPlane(nd, normal, point)); +} + +/** + * This parameter constructor is used for when the origin of the implicit + * plane is needed in the future. The coordinate arrays MUST be the same + * length and match the specified number of dimensions. + * @param nd the number of dimensions for the implicit plane + * @param normal array of coordinates for the plane normal + * @param point array of coorindates for the plane origin + */ +MDPlaneImplicitFunction::MDPlaneImplicitFunction(const size_t nd, + const double *normal, + const double *point) : + MDImplicitFunction() +{ + this->origin = new coord_t[nd]; + for( std::size_t i = 0; i < nd; i++) + { + this->origin[i] = coord_t(point[i]); } this->addPlane(MDPlane(nd, normal, point)); } diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IConvertToMDEventsMethods.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IConvertToMDEventsMethods.cpp index 7269c3a1a2c1d8e19790aad1e15b0bcf91b968be..91c77c806262b146e23401a8046d97e54a523445 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IConvertToMDEventsMethods.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IConvertToMDEventsMethods.cpp @@ -48,7 +48,7 @@ IConvertToMDEventsMethods::fillAddProperties(std::vector<coord_t> &Coord,size_t Kernel::Property *pProperty = (inWS2D->run().getProperty(TWS.dim_names[i])); Kernel::TimeSeriesProperty<double> *run_property = dynamic_cast<Kernel::TimeSeriesProperty<double> *>(pProperty); if(run_property){ - Coord[i]=run_property->firstValue(); + Coord[i]=coord_t(run_property->firstValue()); }else{ // e.g Ei can be a property and dimenson Kernel::PropertyWithValue<double> *proc_property = dynamic_cast<Kernel::PropertyWithValue<double> *>(pProperty); @@ -56,7 +56,7 @@ IConvertToMDEventsMethods::fillAddProperties(std::vector<coord_t> &Coord,size_t convert_log.error()<<" property: "<<this->TWS.dim_names[i]<<" is neither a time series (run) property nor a property with double value\n"; throw(std::invalid_argument(" can not interpret property, used as dimension")); } - Coord[i] = *(proc_property); + Coord[i] = coord_t(*(proc_property)); } if(Coord[i]<TWS.dim_min[i] || Coord[i]>=TWS.dim_max[i])return false; } @@ -93,4 +93,4 @@ IConvertToMDEventsMethods::IConvertToMDEventsMethods() {} } // endNamespace MDAlgorithms -} \ No newline at end of file +} diff --git a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp index c599f24b5806867ed24ae9921e5ac9b0b6842637..6d798ce34ad33e6e4f4de84b7eef56d002295c9d 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/MergeMD.cpp @@ -113,8 +113,8 @@ namespace MDAlgorithms size_t numDims = ws0->getNumDims(); // Extents to create. - std::vector<double> dimMin(numDims, +1e30); - std::vector<double> dimMax(numDims, -1e30); + std::vector<coord_t> dimMin(numDims, coord_t(+1e30)); + std::vector<coord_t> dimMax(numDims, coord_t(-1e30)); // Validate each workspace for (size_t i=0; i < m_workspaces.size(); i++) diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h index 2088e3b1cb5f1faeec1a8018948a890c38806754..d365840581e58bd333a08f0365f64a0e73ec3fdb 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventWSWrapper.h @@ -114,7 +114,7 @@ private: for (size_t d=0; d<nd; d++) { Geometry::MDHistoDimension * dim = new Geometry::MDHistoDimension(this->targ_dim_names[d], this->targ_dim_ID[d], this->targ_dim_units[d], - this->dim_min[d], this->dim_max[d], 10); + coord_t(this->dim_min[d]), coord_t(this->dim_max[d]), 10); ws->addDimension(Geometry::MDHistoDimension_sptr(dim)); } ws->initialize(); @@ -171,4 +171,4 @@ private: } // endnamespace MDEvents } // endnamespace Mantid -#endif \ No newline at end of file +#endif diff --git a/Code/Mantid/Framework/MDEvents/src/ConvertToDiffractionMDWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/ConvertToDiffractionMDWorkspace.cpp index 172ca3e03c0fcb8cf9091ed8ed16b6ddcc1170fb..e6e3a7a2fb3af124dcda494e3a1e41f6fd52c886 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvertToDiffractionMDWorkspace.cpp @@ -204,7 +204,7 @@ namespace MDEvents for (; it != it_end; it++) { // Get the wavenumber in ang^-1 using the previously calculated constant. - coord_t wavenumber = wavenumber_in_angstrom_times_tof_in_microsec / it->tof(); + coord_t wavenumber = coord_t(wavenumber_in_angstrom_times_tof_in_microsec / it->tof()); // Q vector = K_final - K_initial = wavenumber * (output_direction - input_direction) coord_t center[3] = {Q_dir_x * wavenumber, Q_dir_y * wavenumber, Q_dir_z * wavenumber}; @@ -356,7 +356,7 @@ namespace MDEvents // Give all the dimensions for (size_t d=0; d<nd; d++) { - MDHistoDimension * dim = new MDHistoDimension(dimensionNames[d], dimensionNames[d], dimensionUnits, extents[d*2], extents[d*2+1], 10); + MDHistoDimension * dim = new MDHistoDimension(dimensionNames[d], dimensionNames[d], dimensionUnits, coord_t(extents[d*2]), coord_t(extents[d*2+1]), 10); ws->addDimension(MDHistoDimension_sptr(dim)); } ws->initialize(); diff --git a/Code/Mantid/Framework/MDEvents/src/CreateMDWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/CreateMDWorkspace.cpp index ef2d5186c75b7f757fcc347f59fb2e3d5951d4df..51f707ba596d2df6f8e988b8a6783b14b5f6e6a4 100644 --- a/Code/Mantid/Framework/MDEvents/src/CreateMDWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/CreateMDWorkspace.cpp @@ -167,7 +167,7 @@ namespace MDEvents // Give all the dimensions for (size_t d=0; d<ndims; d++) { - MDHistoDimension * dim = new MDHistoDimension(names[d], names[d], units[d], extents[d*2], extents[d*2+1], 1); + MDHistoDimension * dim = new MDHistoDimension(names[d], names[d], units[d], coord_t(extents[d*2]), coord_t(extents[d*2+1]), 1); out->addDimension(MDHistoDimension_sptr(dim)); } diff --git a/Code/Mantid/Framework/MDEvents/src/FakeMDEventData.cpp b/Code/Mantid/Framework/MDEvents/src/FakeMDEventData.cpp index 10df8edb24219a4e40a04be796fb24d6ad21ffe1..2ce2acaf3b2dc5f8d3d1a9693739b28d58804a08 100644 --- a/Code/Mantid/Framework/MDEvents/src/FakeMDEventData.cpp +++ b/Code/Mantid/Framework/MDEvents/src/FakeMDEventData.cpp @@ -129,7 +129,7 @@ namespace MDEvents coord_t radiusSquared = 0; for (size_t d=0; d<nd; d++) { - centers[d] = genUnit()-0.5; // Distribute around +- the center + centers[d] = genUnit()-coord_t(0.5); // Distribute around +- the center radiusSquared += centers[d]*centers[d]; } @@ -230,7 +230,7 @@ namespace MDEvents { coord_t centers[nd]; for (size_t d=0; d<nd; d++) - centers[d] = (*gens[d])(); // use a different generator for each dimension + centers[d] = coord_t((*gens[d])()); // use a different generator for each dimension // Default or randomized error/signal float signal = 1.0; diff --git a/Code/Mantid/Framework/MDEvents/src/LoadMD.cpp b/Code/Mantid/Framework/MDEvents/src/LoadMD.cpp index 3dd31e9e71ca46267c0e7de929ba59a384bfe2b8..54bdf8006e9a5aad756bd531323f2f76446eebdb 100644 --- a/Code/Mantid/Framework/MDEvents/src/LoadMD.cpp +++ b/Code/Mantid/Framework/MDEvents/src/LoadMD.cpp @@ -406,8 +406,8 @@ namespace Mantid std::vector<Mantid::Geometry::MDDimensionExtents> extentsVector(nd); for (size_t d=0; d<nd; d++) { - extentsVector[d].min = extents[i*nd*2 + d*2]; - extentsVector[d].max = extents[i*nd*2 + d*2 + 1]; + extentsVector[d].min = coord_t(extents[i*nd*2 + d*2]); + extentsVector[d].max = coord_t(extents[i*nd*2 + d*2 + 1]); } if (box_type == 1) diff --git a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp b/Code/Mantid/Framework/MDEvents/src/MDBox.cpp index 1c38f9c3f60268443d95149ff2ef186778bd998d..cac30473b6a30485e78e216bfa278afdd3b466f6 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDBox.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDBox.cpp @@ -677,8 +677,8 @@ namespace MDEvents radiusTransform.apply(it->getCenter(), out); if (out[0] < radiusSquared) { - double eventSignal = it->getSignal(); - signal += eventSignal; + coord_t eventSignal = coord_t(it->getSignal()); + signal += signal_t(eventSignal); for (size_t d=0; d<nd; d++) centroid[d] += it->getCenter(d) * eventSignal; } @@ -706,7 +706,7 @@ namespace MDEvents { coord_t * center = it->getCenterNonConst(); for (size_t d=0; d<nd; d++) - center[d] = (center[d] * scaling[d]) + offset[d]; + center[d] = (center[d] * coord_t(scaling[d])) + coord_t(offset[d]); } this->releaseEvents(); } diff --git a/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp b/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp index b46041092e45858c90ab85b2e8cf38211a5c6e73..b318b7ce08f176a9f696056fb19d44bae0ed4ec4 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp @@ -91,10 +91,10 @@ namespace MDEvents throw std::runtime_error("MDGridBox::ctor(): Invalid splitting criterion (one was zero)."); // Calculate the volume - double volume = 1; + coord_t volume = 1; for (size_t d=0; d<nd; d++) volume *= boxSize[d]; - double inverseVolume = 1.0 / volume; + coord_t inverseVolume = coord_t(1.0) / volume; // Create the array of MDBox contents. boxes.clear(); @@ -120,7 +120,7 @@ namespace MDEvents // Set the extents of this box. for (size_t d=0; d<nd; d++) { - coord_t min = this->extents[d].min + boxSize[d] * double(indices[d]); + coord_t min = this->extents[d].min + boxSize[d] * coord_t(indices[d]); myBox->setExtents(d, min, min + boxSize[d]); } myBox->setInverseVolume(inverseVolume); // Set the cached inverse volume @@ -230,7 +230,7 @@ namespace MDEvents splitCumul[d] = tot; tot *= split[d]; // Length of the side of a box in this dimension - boxSize[d] = (this->extents[d].max - this->extents[d].min) / double(split[d]); + boxSize[d] = (this->extents[d].max - this->extents[d].min) / coord_t(split[d]); // Accumulate the squared diagonal length. diagonalSquared += boxSize[d] * boxSize[d]; } @@ -561,7 +561,7 @@ namespace MDEvents // Coordinates of this vertex coord_t vertexCoord[nd]; for (size_t d=0; d<nd; ++d) - vertexCoord[d] = double(vertexIndex[d]) * boxSize[d] + this->extents[d].min; + vertexCoord[d] = coord_t(vertexIndex[d]) * boxSize[d] + this->extents[d].min; // Now check each plane to see if the vertex is bounded by it for (size_t p=0; p<numPlanes; p++) @@ -1231,7 +1231,7 @@ namespace MDEvents // Coordinates of this vertex coord_t vertexCoord[nd]; for (size_t d=0; d<nd; ++d) - vertexCoord[d] = double(vertexIndex[d]) * boxSize[d] + this->extents[d].min; + vertexCoord[d] = coord_t(vertexIndex[d]) * boxSize[d] + this->extents[d].min; // Is this vertex contained? coord_t out[nd]; diff --git a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp index 1d678b3e01df5633435add0f4d9a272b84cbe377..6dc4253fff6f3e1d07f206a893760393b4581774 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDHistoWorkspace.cpp @@ -139,7 +139,7 @@ namespace MDEvents coord_t volume = 1.0; for (size_t i=0; i < numDimensions; ++i) volume *= m_dimensions[i]->getBinWidth(); - m_inverseVolume = 1.0 / volume; + m_inverseVolume = coord_t(1.0) / volume; // Continue with the vertexes array this->initVertexesArray(); @@ -294,7 +294,7 @@ namespace MDEvents VMD out(numDimensions); // Offset the 0th box by the position of this linear index, in each dimension, plus a half for (size_t d=0; d<numDimensions; d++) - out[d] = m_vertexesArray[d] + m_boxLength[d] * (coord_t(dimIndexes[d]) + 0.5); + out[d] = m_vertexesArray[d] + m_boxLength[d] * (coord_t(dimIndexes[d]) + coord_t(0.5)); return out; } @@ -456,7 +456,7 @@ namespace MDEvents // Unit-vector of the direction VMD dir = end - start; - double length = dir.normalize(); + coord_t length = dir.normalize(); // Vector with +1 where direction is positive, -1 where negative #define sgn(x) ((x<0)?-1:((x>0)?1:0)) @@ -477,7 +477,7 @@ namespace MDEvents } // Ordered list of boundaries in position-along-the-line coordinates - std::set<double> boundaries; + std::set<coord_t> boundaries; // Start with the start/end points, if they are within range. if (pointInWorkspace(this, start)) @@ -490,16 +490,16 @@ namespace MDEvents for (size_t d=0; d<nd; d++) { IMDDimension_const_sptr dim = this->getDimension(d); - double lineStartX = start[d]; + coord_t lineStartX = start[d]; if (dir[d] != 0.0) { for (size_t i=0; i<=dim->getNBins(); i++) { // Position in this coordinate - double thisX = dim->getX(i); + coord_t thisX = dim->getX(i); // Position along the line. Is this between the start and end of it? - double linePos = (thisX - lineStartX) / dir[d]; + coord_t linePos = (thisX - lineStartX) / dir[d]; if (linePos >= 0 && linePos <= length) { // Full position @@ -518,17 +518,17 @@ namespace MDEvents // Nothing at all! // Make a single bin with NAN x.push_back(0); x.push_back(length); - y.push_back(std::numeric_limits<double>::quiet_NaN()); - e.push_back(std::numeric_limits<double>::quiet_NaN()); + y.push_back(std::numeric_limits<signal_t>::quiet_NaN()); + e.push_back(std::numeric_limits<signal_t>::quiet_NaN()); return; } else { // Get the first point - std::set<double>::iterator it; + std::set<coord_t>::iterator it; it = boundaries.begin(); - double lastLinePos = *it; + coord_t lastLinePos = *it; VMD lastPos = start + (dir * lastLinePos); x.push_back(lastLinePos); @@ -537,7 +537,7 @@ namespace MDEvents for (; it != boundaries.end(); it++) { // This is our current position along the line - double linePos = *it; + coord_t linePos = *it; x.push_back(linePos); // This is the full position at this boundary @@ -573,8 +573,8 @@ namespace MDEvents else { // Invalid index. This shouldn't happen - y.push_back(std::numeric_limits<double>::quiet_NaN()); - e.push_back(std::numeric_limits<double>::quiet_NaN()); + y.push_back(std::numeric_limits<signal_t>::quiet_NaN()); + e.push_back(std::numeric_limits<signal_t>::quiet_NaN()); } } // for each unique boundary } // if there is at least one point diff --git a/Code/Mantid/Framework/MDEvents/src/SlicingAlgorithm.cpp b/Code/Mantid/Framework/MDEvents/src/SlicingAlgorithm.cpp index 79ae00a78fc62a3169c7b3100fee0e077b3e3fc9..f9eb452d6613effd048d2eead13c6848805014e2 100644 --- a/Code/Mantid/Framework/MDEvents/src/SlicingAlgorithm.cpp +++ b/Code/Mantid/Framework/MDEvents/src/SlicingAlgorithm.cpp @@ -193,7 +193,7 @@ namespace MDEvents double scaling = double(numBins) / length; // Create the output dimension - MDHistoDimension_sptr out(new MDHistoDimension(name, id, units, min, max, numBins)); + MDHistoDimension_sptr out(new MDHistoDimension(name, id, units, coord_t(min), coord_t(max), numBins)); // Put both in the algo for future use m_bases.push_back(basis); @@ -346,7 +346,7 @@ namespace MDEvents throw std::invalid_argument("Wrong number of values (3 are expected) after the name in the dimensions string: " + str); // Extract the arguments - double min, max; + coord_t min, max; int numBins = 0; Strings::convert(strs[0], min); Strings::convert(strs[1], max); @@ -781,8 +781,8 @@ namespace MDEvents size_t nd = m_inWS->getNumDims(); if (m_axisAligned) { - std::vector<coord_t> function_min(nd, -1e50); // default to all space if the dimension is not specified - std::vector<coord_t> function_max(nd, +1e50); // default to all space if the dimension is not specified + std::vector<coord_t> function_min(nd, coord_t(-1e30)); // default to all space if the dimension is not specified + std::vector<coord_t> function_max(nd, coord_t(+1e30)); // default to all space if the dimension is not specified for (size_t bd=0; bd<m_outD; bd++) { // Dimension in the MDEventWorkspace diff --git a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp index fb1cba134e7ae03e519d44db8cdea0d98669f965..f47b3b8a147a79d87a11c2315f16eb68c1902edf 100644 --- a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp +++ b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp @@ -1,15 +1,17 @@ -#include "MantidQtAPI/MantidQwtIMDWorkspaceData.h" -#include "MantidAPI/IMDIterator.h" -#include "MantidGeometry/MDGeometry/IMDDimension.h" -#include "MantidAPI/NullCoordTransform.h" #include "MantidAPI/CoordTransform.h" +#include "MantidAPI/IMDIterator.h" #include "MantidAPI/IMDWorkspace.h" +#include "MantidAPI/NullCoordTransform.h" +#include "MantidGeometry/MDGeometry/IMDDimension.h" +#include "MantidGeometry/MDGeometry/MDTypes.h" +#include "MantidQtAPI/MantidQwtIMDWorkspaceData.h" using namespace Mantid::Kernel; using namespace Mantid::Geometry; using Mantid::API::NullCoordTransform; using Mantid::API::CoordTransform; using Mantid::API::IMDWorkspace; +using Mantid::coord_t; /** This is needed to successfully compile on windows. */ QwtData & QwtData::operator=(class QwtData const &) @@ -69,7 +71,7 @@ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_c else { // Mid point along each dimension - m_start[d] = (dim->getMaximum() + dim->getMinimum()) / 2.0; + m_start[d] = (dim->getMaximum() + dim->getMinimum()) / coord_t(2.0); m_end[d] = m_start[d]; } } diff --git a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp index a7884ac2d65524169232fd0e7ed90e5803201526..eaffcc5dc3e714fa0fbf8428415cf024bd54b71f 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp @@ -535,7 +535,7 @@ void LineViewer::setPlanarWidth(double width) if (m_allDimsFree) { for (size_t d=0; d<m_thickness.getNumDims(); d++) - m_thickness[d] = width; + m_thickness[d] = VMD_t(width); } else { @@ -544,7 +544,7 @@ void LineViewer::setPlanarWidth(double width) { // Only modify the locked onese if (m_thickness[d] == oldPlanarWidth) - m_thickness[d] = width; + m_thickness[d] = VMD_t(width); } // And always set the planar one m_planeWidth = width; @@ -664,8 +664,8 @@ void LineViewer::setStartXY(double x, double y) { if (m_allDimsFree) throw std::runtime_error("LineViewer::setStartXY(): cannot use with all dimensions free."); - m_start[m_freeDimX] = x; - m_start[m_freeDimY] = y; + m_start[m_freeDimX] = VMD_t(x); + m_start[m_freeDimY] = VMD_t(y); updateStartEnd(); // Send the signal that the positions changed emit changedStartOrEnd(m_start, m_end); @@ -682,8 +682,8 @@ void LineViewer::setEndXY(double x, double y) { if (m_allDimsFree) throw std::runtime_error("LineViewer::setEndXY(): cannot use with all dimensions free."); - m_end[m_freeDimX] = x; - m_end[m_freeDimY] = y; + m_end[m_freeDimX] = VMD_t(x); + m_end[m_freeDimY] = VMD_t(y); updateStartEnd(); // Send the signal that the positions changed emit changedStartOrEnd(m_start, m_end); @@ -724,7 +724,7 @@ void LineViewer::setThickness(double width) { if (!m_ws) return; for (int i=0; i<int(m_ws->getNumDims()); i++) - m_thickness[i] = width; + m_thickness[i] = VMD_t(width); this->setPlanarWidth(width); } @@ -744,7 +744,7 @@ void LineViewer::setThickness(int dim, double width) if (!m_ws) return; if (dim >= int(m_ws->getNumDims()) || dim < 0) throw std::invalid_argument("There is no dimension # " + Strings::toString(dim) + " in the workspace."); - m_thickness[dim] = width; + m_thickness[dim] = VMD_t(width); updateStartEnd(); } diff --git a/Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp b/Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp index 9dbe820f16302d9b69454216340f37b82176322b..14aaa6c7952da3b55af4544884234cb06f873944 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp @@ -1047,18 +1047,18 @@ void SliceViewer::findRangeSlice() IMDDimension_const_sptr dim = m_dimensions[d]; if (widget->getShownDim() == 0) { - min[d] = xint.minValue(); - max[d] = xint.maxValue(); + min[d] = VMD_t(xint.minValue()); + max[d] = VMD_t(xint.maxValue()); } else if (widget->getShownDim() == 1) { - min[d] = yint.minValue(); - max[d] = yint.maxValue(); + min[d] = VMD_t(yint.minValue()); + max[d] = VMD_t(yint.maxValue()); } else { // Is a slice. Take a slice of widht = binWidth - min[d] = widget->getSlicePoint() - dim->getBinWidth() * 0.45; + min[d] = VMD_t(widget->getSlicePoint()) - dim->getBinWidth() * VMD_t(0.45); max[d] = min[d] + dim->getBinWidth(); } } @@ -1088,9 +1088,9 @@ void SliceViewer::showInfoAt(double x, double y) if (!m_ws) return; VMD coords(m_ws->getNumDims()); for (size_t d=0; d<m_ws->getNumDims(); d++) - coords[d] = m_dimWidgets[d]->getSlicePoint(); - coords[m_dimX] = x; - coords[m_dimY] = y; + coords[d] = VMD_t(m_dimWidgets[d]->getSlicePoint()); + coords[m_dimX] = VMD_t(x); + coords[m_dimY] = VMD_t(y); signal_t signal = m_ws->getSignalAtVMD(coords, this->m_data->getNormalization()); ui.lblInfoX->setText(QString::number(x, 'g', 4)); ui.lblInfoY->setText(QString::number(y, 'g', 4)); @@ -1139,7 +1139,7 @@ void SliceViewer::updateDisplay(bool resetAxes) m_dimX = d; if (widget->getShownDim() == 1) m_dimY = d; - slicePoint.push_back(widget->getSlicePoint()); + slicePoint.push_back(VMD_t(widget->getSlicePoint())); } // Avoid going out of range if (m_dimX >= m_ws->getNumDims()) m_dimX = m_ws->getNumDims()-1; @@ -1622,7 +1622,7 @@ void SliceViewer::openFromXML(const QString & xml) V3D normal, origin; normal.fromString(normalStr); origin.fromString(originStr); - double planeOrigin = 0; + coord_t planeOrigin = 0; int normalDim = -1; for (int i=0; i<3; i++) if (normal[i] > 0.99) normalDim = i; @@ -1632,7 +1632,7 @@ void SliceViewer::openFromXML(const QString & xml) throw std::runtime_error("SliceViewer::openFromXML(): Could not find the normal of the plane. Plane must be along one of the axes!"); // Get the plane origin and the dimension in the workspace dimensions - planeOrigin = origin[normalDim]; + planeOrigin = coord_t(origin[normalDim]); normalDim = dimMap[normalDim]; VMD slicePoint(m_ws->getNumDims()); @@ -1641,7 +1641,7 @@ void SliceViewer::openFromXML(const QString & xml) slicePoint[normalDim] = planeOrigin; // The "time" of the paraview view if (dimMap[3] > 0) - slicePoint[dimMap[3]] = TimeValue; + slicePoint[dimMap[3]] = coord_t(TimeValue); // Now find the first unused dimensions = that is the X view dimension int xdim =-1; diff --git a/Code/Mantid/MantidQt/SliceViewer/src/SliceViewerWindow.cpp b/Code/Mantid/MantidQt/SliceViewer/src/SliceViewerWindow.cpp index a7820c8b2bb19cc47e19665998867a7e85131a5c..53f1245933a5d8edd84a8d073ac6f4f0356acc43 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/SliceViewerWindow.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/SliceViewerWindow.cpp @@ -277,10 +277,10 @@ void SliceViewerWindow::setLineViewerValues(QPointF start2D, QPointF end2D, doub { VMD start = m_slicer->getSlicePoint(); VMD end = start; - start[m_slicer->getDimX()] = start2D.x(); - start[m_slicer->getDimY()] = start2D.y(); - end[m_slicer->getDimX()] = end2D.x(); - end[m_slicer->getDimY()] = end2D.y(); + start[m_slicer->getDimX()] = VMD_t(start2D.x()); + start[m_slicer->getDimY()] = VMD_t(start2D.y()); + end[m_slicer->getDimX()] = VMD_t(end2D.x()); + end[m_slicer->getDimY()] = VMD_t(end2D.y()); m_liner->setStart(start); m_liner->setEnd(end); m_liner->setPlanarWidth(width); diff --git a/Code/Mantid/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp b/Code/Mantid/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp index 8ac3c0406d945dfa46e498f742adf522fac89788..1c278bdf56792c50dd018af52944fe4a73ada6c8 100644 --- a/Code/Mantid/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/MDEWLoadingPresenter.cpp @@ -47,8 +47,8 @@ namespace Mantid for (size_t d=0; d<nDimensions; d++) { IMDDimension_const_sptr inDim = eventWs->getDimension(d); - double min = (ext[d].min); - double max = (ext[d].max); + coord_t min = (ext[d].min); + coord_t max = (ext[d].max); if (min > max) { min = 0.0; diff --git a/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp b/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp index 3369f0d2b4ceb32b714ffb6db5721b38c99a77f2..722479aa6cbb7e662db3686485fa40dc93bbb15d 100644 --- a/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/MDHWLoadingPresenter.cpp @@ -46,8 +46,8 @@ namespace Mantid for (size_t d=0; d<nDimensions; d++) { IMDDimension_const_sptr inDim = histoWs->getDimension(d); - double min = inDim->getMinimum(); - double max = inDim->getMaximum(); + coord_t min = inDim->getMinimum(); + coord_t max = inDim->getMaximum(); if (min > max) { min = 0.0; diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp index f487b8de4f4c90d93e5dfb5ecb19a4cfd07bb925..04f1939c28fc985289eac045fa9d4567ba995e3e 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingHexahedronFactory.cpp @@ -92,16 +92,16 @@ namespace VATES const int nBinsY = static_cast<int>( m_workspace->getYDimension()->getNBins() ); const int nBinsZ = static_cast<int>( m_workspace->getZDimension()->getNBins() ); - const double maxX = m_workspace-> getXDimension()->getMaximum(); - const double minX = m_workspace-> getXDimension()->getMinimum(); - const double maxY = m_workspace-> getYDimension()->getMaximum(); - const double minY = m_workspace-> getYDimension()->getMinimum(); - const double maxZ = m_workspace-> getZDimension()->getMaximum(); - const double minZ = m_workspace-> getZDimension()->getMinimum(); + const coord_t maxX = m_workspace->getXDimension()->getMaximum(); + const coord_t minX = m_workspace->getXDimension()->getMinimum(); + const coord_t maxY = m_workspace->getYDimension()->getMaximum(); + const coord_t minY = m_workspace->getYDimension()->getMinimum(); + const coord_t maxZ = m_workspace->getZDimension()->getMaximum(); + const coord_t minZ = m_workspace->getZDimension()->getMinimum(); - double incrementX = (maxX - minX) / (nBinsX); - double incrementY = (maxY - minY) / (nBinsY); - double incrementZ = (maxZ - minZ) / (nBinsZ); + coord_t incrementX = (maxX - minX) / coord_t(nBinsX); + coord_t incrementY = (maxY - minY) / coord_t(nBinsY); + coord_t incrementZ = (maxZ - minZ) / coord_t(nBinsZ); const int imageSize = (nBinsX ) * (nBinsY ) * (nBinsZ ); vtkPoints *points = vtkPoints::New(); @@ -190,16 +190,16 @@ namespace VATES index = 0; for (int z = 0; z < nPointsZ; z++) { - in[2] = (minZ + (z * incrementZ)); //Calculate increment in z; + in[2] = (minZ + (coord_t(z) * incrementZ)); //Calculate increment in z; for (int y = 0; y < nPointsY; y++) { - in[1] = (minY + (y * incrementY)); //Calculate increment in y; + in[1] = (minY + (coord_t(y) * incrementY)); //Calculate increment in y; for (int x = 0; x < nPointsX; x++) { // Create the point only when needed if (pointNeeded[index]) { - in[0] = (minX + (x * incrementX)); //Calculate increment in x; + in[0] = (minX + (coord_t(x) * incrementX)); //Calculate increment in x; if (transform) { transform->apply(in, out); diff --git a/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp b/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp index 83f859ffc7b6b6a8656e607cf88702fc8016d54c..ba3185df037501101d8587edfabcb39e63ed0d0a 100644 --- a/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp +++ b/Code/Mantid/Vates/VatesAPI/src/vtkThresholdingQuadFactory.cpp @@ -67,13 +67,13 @@ namespace Mantid const int nBinsX = static_cast<int>( m_workspace->getXDimension()->getNBins() ); const int nBinsY = static_cast<int>( m_workspace->getYDimension()->getNBins() ); - const double maxX = m_workspace-> getXDimension()->getMaximum(); - const double minX = m_workspace-> getXDimension()->getMinimum(); - const double maxY = m_workspace-> getYDimension()->getMaximum(); - const double minY = m_workspace-> getYDimension()->getMinimum(); + const coord_t maxX = m_workspace-> getXDimension()->getMaximum(); + const coord_t minX = m_workspace-> getXDimension()->getMinimum(); + const coord_t maxY = m_workspace-> getYDimension()->getMaximum(); + const coord_t minY = m_workspace-> getYDimension()->getMinimum(); - double incrementX = (maxX - minX) / (nBinsX); - double incrementY = (maxY - minY) / (nBinsY); + coord_t incrementX = (maxX - minX) / coord_t(nBinsX); + coord_t incrementY = (maxY - minY) / coord_t(nBinsY); const int imageSize = (nBinsX ) * (nBinsY ); vtkPoints *points = vtkPoints::New(); @@ -145,13 +145,13 @@ namespace Mantid index = 0; for (int i = 0; i < nPointsX; i++) { - in[0] = minX + (i * incrementX); //Calculate increment in x; + in[0] = minX + (coord_t(i) * incrementX); //Calculate increment in x; for (int j = 0; j < nPointsY; j++) { // Create the point only when needed if (pointNeeded[index]) { - in[1] = minY + (j * incrementY); //Calculate increment in y; + in[1] = minY + (coord_t(j) * incrementY); //Calculate increment in y; if (transform) { transform->apply(in, out); diff --git a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp index cfc3ba9e10d6d4c28dcddb72f7d4a5d913ecea17..471aa9954ba94fb6cd4ac5688878297d8e202e04 100644 --- a/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp +++ b/Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/MultisliceView.cpp @@ -600,9 +600,9 @@ void MultiSliceView::showCutInSliceViewer(const QString &name) pqPipelineSource *cut = smModel->findItem<pqPipelineSource *>(name); vtkSMProxy *plane = vtkSMPropertyHelper(cut->getProxy(), "CutFunction").GetAsProxy(); - coord_t origin[3]; + double origin[3]; vtkSMPropertyHelper(plane, "Origin").Get(origin, 3); - coord_t orient[3]; + double orient[3]; vtkSMPropertyHelper(plane, "Normal").Get(orient, 3); // Create the XML holder