Commit 6c1a29bb authored by Janik Zikovsky's avatar Janik Zikovsky
Browse files

Refs #4791 suppress more warnings

parent 98eb8fa5
......@@ -44,8 +44,10 @@ namespace Mantid
/// Define indicating that the coord_t type is a float (not double)
#undef COORDT_IS_FLOAT
//#define COORDT_IS_FLOAT
/** Typedef for the signal recorded in a MDBox, etc.
* Note: MDEvents use 'float' internally to save memory
*/
typedef double signal_t;
......
......@@ -80,7 +80,7 @@ namespace Geometry
// Flip the normal over
delete [] this->m_normal;
for (size_t d=0; d<normal.getNumDims(); d++)
normal[d] = -1.0 * normal[d];
normal[d] = coord_t(-1.0) * normal[d];
// And re-construct
construct(normal, origin);
}
......
#ifndef MANTID_KERNEL_VMD_H_
#define MANTID_KERNEL_VMD_H_
#include "MantidKernel/System.h"
#include "MantidKernel/Strings.h"
#include "MantidKernel/System.h"
#include "MantidKernel/Tolerance.h"
#include "MantidKernel/V3D.h"
#include <cstddef>
#include <stdexcept>
#include <sstream>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
using boost::algorithm::split;
using boost::algorithm::is_any_of;
#include <cstddef>
#include <sstream>
#include <stdexcept>
namespace Mantid
......@@ -245,6 +242,9 @@ namespace Kernel
VMDBase(const std::string & str)
: nd(nd)
{
using boost::algorithm::split;
using boost::algorithm::is_any_of;
std::vector<std::string> strs;
boost::split(strs, str, boost::is_any_of(", "));
......@@ -541,8 +541,11 @@ namespace Kernel
TYPE * data;
};
/// Define the VMD as using the double data type.
typedef VMDBase<double> VMD;
/// Underlying data type for the VMD type
typedef double VMD_t;
/// Define the VMD as using the double or float data type.
typedef VMDBase<VMD_t> VMD;
// Overload operator <<
MANTID_KERNEL_DLL std::ostream& operator<<(std::ostream&, const VMDBase<double>&);
......
#include "MantidKernel/VMD.h"
#include "MantidKernel/System.h"
#include "MantidKernel/DllConfig.h"
using namespace Mantid::Kernel;
......@@ -128,10 +129,13 @@ VMDBase<TYPE> VMDBase<TYPE>::getNormalVector(const std::vector<VMDBase<TYPE> > &
}
/// @cond
/// Instantiate VMDBase classes
template DLLExport class VMDBase<double>;
template DLLExport class VMDBase<float>;
/// Instantiate stream operators
MANTID_KERNEL_DLL std::ostream& operator<<(std::ostream&, VMDBase<double>&);
MANTID_KERNEL_DLL std::ostream& operator<<(std::ostream&, VMDBase<float>&);
} // namespace Mantid
} // namespace Kernel
......
......@@ -260,7 +260,7 @@ namespace MDEvents
void getCenter(coord_t * center) const
{
for (size_t d=0; d<nd; ++d)
center[d] = (extents[d].max + extents[d].min) / 2.0;
center[d] = (extents[d].max + extents[d].min) / coord_t(2.0);
}
//-----------------------------------------------------------------------------------------------
......@@ -275,7 +275,7 @@ namespace MDEvents
volume *= (extents[d].max - extents[d].min);
}
/// Floating point multiplication is much faster than division, so cache 1/volume.
m_inverseVolume = 1.0 / volume;
m_inverseVolume = coord_t(1.0) / volume;
}
//-----------------------------------------------------------------------------------------------
......
......@@ -48,7 +48,7 @@ namespace Mantid
col_it = vecStrCols.begin();
while(col_it != vecStrCols.end())
{
double val = atof(col_it->c_str());
coord_t val = coord_t(atof(col_it->c_str()));
elements.push_back(val);
++col_it;
}
......
......@@ -132,7 +132,7 @@ namespace MDEvents
for (size_t d=0; d<nd; ++d)
{
dimensionsUsed[d] = true; // Use all dimensions
center[d] = pos[d];
center[d] = coord_t(pos[d]);
}
CoordTransformDistance sphere(nd, center, dimensionsUsed);
......
......@@ -170,9 +170,9 @@ namespace MDEvents
V3D Q_dir = mat * Q_dir_lab_frame;
// For speed we extract the components.
double Q_dir_x = Q_dir.X();
double Q_dir_y = Q_dir.Y();
double Q_dir_z = Q_dir.Z();
coord_t Q_dir_x = coord_t(Q_dir.X());
coord_t Q_dir_y = coord_t(Q_dir.Y());
coord_t Q_dir_z = coord_t(Q_dir.Z());
// For lorentz correction, calculate sin(theta))^2
double sin_theta_squared = 0;
......@@ -204,7 +204,7 @@ namespace MDEvents
for (; it != it_end; it++)
{
// Get the wavenumber in ang^-1 using the previously calculated constant.
double wavenumber = wavenumber_in_angstrom_times_tof_in_microsec / it->tof();
coord_t wavenumber = 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};
......
......@@ -134,19 +134,19 @@ namespace MDEvents
}
// Make a unit vector pointing in this direction
coord_t radius = sqrt(radiusSquared);
coord_t radius = coord_t(sqrt(radiusSquared));
for (size_t d=0; d<nd; d++)
centers[d] /= radius;
// Now place the point along this radius, scaled with ^1/n for uniformity.
coord_t radPos = genUnit();
radPos = pow(radPos, 1.0/double(nd));
radPos = coord_t(pow(radPos, 1.0/double(nd)));
for (size_t d=0; d<nd; d++)
{
// Multiply by the scaling and the desired peak radius
centers[d] *= (radPos * desiredRadius);
centers[d] *= (radPos * coord_t(desiredRadius));
// Also offset by the center of the peak, as taken in Params
centers[d] += params[d+1];
centers[d] += coord_t(params[d+1]);
}
// Default or randomized error/signal
......
......@@ -513,7 +513,7 @@ namespace MDEvents
// Other parameters
double PeakDistanceThreshold = getProperty("PeakDistanceThreshold");
peakRadiusSquared = PeakDistanceThreshold*PeakDistanceThreshold;
peakRadiusSquared = coord_t(PeakDistanceThreshold*PeakDistanceThreshold);
DensityThresholdFactor = getProperty("DensityThresholdFactor");
MaxPeaks = getProperty("MaxPeaks");
......
......@@ -136,8 +136,8 @@ namespace MDEvents
{
for (size_t d=0; d<nd; d++)
{
extents[d].min = (extents[d].min * scaling[d]) + offset[d];
extents[d].max = (extents[d].max * scaling[d]) + offset[d];
extents[d].min = (extents[d].min * coord_t(scaling[d])) + coord_t(offset[d]);
extents[d].max = (extents[d].max * coord_t(scaling[d])) + coord_t(offset[d]);
}
// Re-calculate the volume of the box
this->calcVolume();
......
......@@ -146,14 +146,14 @@ namespace MDEvents
for (size_t d=0; d<nd; ++d)
{
dimensionsUsed[d] = true; // Use all dimensions
center[d] = pos[d];
center[d] = coord_t(pos[d]);
}
CoordTransformDistance sphere(nd, center, dimensionsUsed);
// Perform the integration into whatever box is contained within.
signal_t signal = 0;
signal_t errorSquared = 0;
ws->getBox()->integrateSphere(sphere, PeakRadius*PeakRadius, signal, errorSquared);
ws->getBox()->integrateSphere(sphere, coord_t(PeakRadius*PeakRadius), signal, errorSquared);
// Integrate around the background radius
signal_t bgSignal = 0;
......@@ -161,7 +161,7 @@ namespace MDEvents
if (BackgroundRadius > PeakRadius)
{
// Get the total signal inside "BackgroundRadius"
ws->getBox()->integrateSphere(sphere, BackgroundRadius*BackgroundRadius, bgSignal, bgErrorSquared);
ws->getBox()->integrateSphere(sphere, coord_t(BackgroundRadius*BackgroundRadius), bgSignal, bgErrorSquared);
// Evaluate the signal inside "BackgroundStartRadius"
signal_t interiorSignal = 0;
......@@ -169,7 +169,7 @@ namespace MDEvents
// Integrate this 3rd radius, if needed
if (BackgroundStartRadius != PeakRadius)
ws->getBox()->integrateSphere(sphere, BackgroundStartRadius*BackgroundStartRadius, interiorSignal, interiorErrorSquared);
ws->getBox()->integrateSphere(sphere, coord_t(BackgroundStartRadius*BackgroundStartRadius), interiorSignal, interiorErrorSquared);
else
{
// PeakRadius == BackgroundStartRadius, so use the previous value
......
......@@ -432,13 +432,13 @@ namespace MDEvents
for (size_t d=0; d<nd; d++)
{
// Total up the coordinate weighted by the signal.
centroid[d] += event.getCenter(d) * signal;
centroid[d] += event.getCenter(d) * coord_t(signal);
}
}
// Normalize by the total signal
for (size_t d=0; d<nd; d++)
centroid[d] /= this->m_signal;
centroid[d] /= coord_t(this->m_signal);
}
//-----------------------------------------------------------------------------------------------
......
......@@ -92,7 +92,7 @@ namespace MDEvents
{
// Calculate the center of the 0-th bin
for (size_t d=0; d<m_nd; d++)
m_center[d] = m_origin[d] + (0 + 0.5) * m_binWidth[d];
m_center[d] = m_origin[d] + coord_t(0.5) * m_binWidth[d];
// Skip on if the first point is NOT contained
if (!m_function->isPointContained(m_center))
next();
......@@ -156,7 +156,7 @@ namespace MDEvents
// Calculate the center
for (size_t d=0; d<m_nd; d++)
{
m_center[d] = m_origin[d] + (double(m_index[d]) + 0.5) * m_binWidth[d];
m_center[d] = m_origin[d] + (coord_t(m_index[d]) + coord_t(0.5)) * m_binWidth[d];
// std::cout << m_center[d] << ",";
}
// std::cout<<std::endl;
......@@ -255,7 +255,7 @@ namespace MDEvents
Utils::NestedForLoop::GetIndicesFromLinearIndex(m_nd, m_pos, m_indexMaker, m_indexMax, m_index);
// Find the center
for (size_t d=0; d<m_nd; d++)
m_center[d] = m_origin[d] + (double(m_index[d]) + 0.5) * m_binWidth[d];
m_center[d] = m_origin[d] + (coord_t(m_index[d]) + coord_t(0.5)) * m_binWidth[d];
return VMD(m_nd, m_center);
}
......
......@@ -227,13 +227,13 @@ void LineViewer::readTextboxes()
bool ok;
for (int d=0; d<int(m_ws->getNumDims()); d++)
{
start[d] = m_startText[d]->text().toDouble(&ok);
start[d] = VMD_t(m_startText[d]->text().toDouble(&ok));
allOk = allOk && ok;
end[d] = m_endText[d]->text().toDouble(&ok);
end[d] = VMD_t(m_endText[d]->text().toDouble(&ok));
allOk = allOk && ok;
width[d] = m_thicknessText[d]->text().toDouble(&ok);
width[d] = VMD_t(m_thicknessText[d]->text().toDouble(&ok));
allOk = allOk && ok;
}
// Now the planar width
......@@ -275,11 +275,11 @@ void LineViewer::apply()
// Build the basis vectors using the angles
VMD basisX = m_start * 0;
basisX[m_freeDimX] = cos(angle);
basisX[m_freeDimY] = sin(angle);
basisX[m_freeDimX] = VMD_t(cos(angle));
basisX[m_freeDimY] = VMD_t(sin(angle));
VMD basisY = m_start * 0;
basisY[m_freeDimX] = cos(perpAngle);
basisY[m_freeDimY] = sin(perpAngle);
basisY[m_freeDimX] = VMD_t(cos(perpAngle));
basisY[m_freeDimY] = VMD_t(sin(perpAngle));
// Offset the origin in the plane by the width
VMD origin = m_start - basisY * planeWidth;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment