Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
6331e6b5
Commit
6331e6b5
authored
Jan 21, 2016
by
Savici, Andrei T
Browse files
Merge pull request #15027 from mantidproject/google-readability-casting
Ran clang-tidy check: google-readability-casting.
parents
c165c386
15b90a72
Changes
140
Hide whitespace changes
Inline
Side-by-side
Framework/API/src/DomainCreatorFactory.cpp
View file @
6331e6b5
...
...
@@ -20,7 +20,7 @@ IDomainCreator *DomainCreatorFactoryImpl::createDomainCreator(
const
unsigned
int
domainType
)
const
{
auto
creator
=
this
->
createUnwrapped
(
id
);
creator
->
initialize
(
pm
,
workspacePropertyName
,
(
IDomainCreator
::
DomainType
)
domainType
);
static_cast
<
IDomainCreator
::
DomainType
>
(
domainType
)
)
;
return
creator
;
}
...
...
Framework/API/src/LogManager.cpp
View file @
6331e6b5
...
...
@@ -224,7 +224,7 @@ void LogManager::removeProperty(const std::string &name, bool delProperty) {
// Remove any cached entries for this log. Need to make this more general
for
(
unsigned
int
stat
=
0
;
stat
<
7
;
++
stat
)
{
m_singleValueCache
.
removeCache
(
std
::
make_pair
(
name
,
(
Math
::
StatisticType
)
stat
));
std
::
make_pair
(
name
,
static_cast
<
Math
::
StatisticType
>
(
stat
))
)
;
}
m_manager
.
removeProperty
(
name
,
delProperty
);
}
...
...
Framework/API/src/MatrixWorkspace.cpp
View file @
6331e6b5
...
...
@@ -1250,7 +1250,7 @@ size_t MatrixWorkspace::binIndexOf(const double xValue,
}
uint64_t
MatrixWorkspace
::
getNPoints
()
const
{
return
(
uint64_t
)
(
this
->
size
());
return
static_cast
<
uint64_t
>
(
this
->
size
());
}
//================================= FOR MDGEOMETRY
...
...
Framework/API/src/ParameterTie.cpp
View file @
6331e6b5
...
...
@@ -44,7 +44,7 @@ ParameterTie::~ParameterTie() {
* @return pointer to added variable
*/
double
*
ParameterTie
::
AddVariable
(
const
char
*
varName
,
void
*
palg
)
{
ParameterTie
&
tie
=
*
(
ParameterTie
*
)
palg
;
ParameterTie
&
tie
=
*
reinterpret_cast
<
ParameterTie
*
>
(
palg
)
;
ParameterReference
ref
(
tie
.
m_function1
,
tie
.
m_function1
->
parameterIndex
(
std
::
string
(
varName
)));
...
...
Framework/Algorithms/src/ApplyTransmissionCorrection.cpp
View file @
6331e6b5
...
...
@@ -122,7 +122,7 @@ void ApplyTransmissionCorrection::exec() {
const
double
exp_term
=
(
1.0
/
cos
(
inputWS
->
detectorTwoTheta
(
det
))
+
1.0
)
/
2.0
;
for
(
int
j
=
0
;
j
<
(
int
)
inputWS
->
readY
(
0
).
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
inputWS
->
readY
(
0
).
size
()
)
;
j
++
)
{
if
(
!
thetaDependent
)
{
YOut
[
j
]
=
1.0
/
TrIn
[
j
];
EOut
[
j
]
=
std
::
fabs
(
ETrIn
[
j
]
*
TrIn
[
j
]
*
TrIn
[
j
]);
...
...
Framework/Algorithms/src/BinaryOperateMasks.cpp
View file @
6331e6b5
...
...
@@ -85,11 +85,14 @@ void BinaryOperateMasks::exec() {
unsigned
int
binop
;
if
(
op
==
"AND"
)
{
binop
=
(
unsigned
int
)
Mantid
::
DataObjects
::
BinaryOperator
::
AND
;
binop
=
static_cast
<
unsigned
int
>
(
Mantid
::
DataObjects
::
BinaryOperator
::
AND
);
}
else
if
(
op
==
"OR"
)
{
binop
=
(
unsigned
int
)
Mantid
::
DataObjects
::
BinaryOperator
::
OR
;
binop
=
static_cast
<
unsigned
int
>
(
Mantid
::
DataObjects
::
BinaryOperator
::
OR
);
}
else
if
(
op
==
"XOR"
)
{
binop
=
(
unsigned
int
)
Mantid
::
DataObjects
::
BinaryOperator
::
XOR
;
binop
=
static_cast
<
unsigned
int
>
(
Mantid
::
DataObjects
::
BinaryOperator
::
XOR
);
}
else
{
binop
=
1000
;
}
...
...
Framework/Algorithms/src/CalculateEfficiency.cpp
View file @
6331e6b5
...
...
@@ -67,7 +67,8 @@ void CalculateEfficiency::exec() {
outputWS
=
WorkspaceFactory
::
Instance
().
create
(
rebinnedWS
);
WorkspaceFactory
::
Instance
().
initializeFromParent
(
inputWS
,
outputWS
,
false
);
for
(
int
i
=
0
;
i
<
(
int
)
rebinnedWS
->
getNumberHistograms
();
i
++
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
rebinnedWS
->
getNumberHistograms
());
i
++
)
{
outputWS
->
dataX
(
i
)
=
rebinnedWS
->
readX
(
i
);
}
setProperty
(
"OutputWorkspace"
,
outputWS
);
...
...
@@ -173,7 +174,8 @@ void CalculateEfficiency::normalizeDetectors(MatrixWorkspace_sptr rebinnedWS,
for
(
size_t
i
=
0
;
i
<
numberOfSpectra
;
i
++
)
{
const
double
currProgress
=
0.4
+
0.2
*
((
double
)
i
/
(
double
)
numberOfSpectra
);
0.4
+
0.2
*
(
static_cast
<
double
>
(
i
)
/
static_cast
<
double
>
(
numberOfSpectra
));
progress
(
currProgress
,
"Computing sensitivity"
);
// Get the detector object for this spectrum
IDetector_const_sptr
det
=
rebinnedWS
->
getDetector
(
i
);
...
...
Framework/Algorithms/src/CompareWorkspaces.cpp
View file @
6331e6b5
...
...
@@ -233,8 +233,8 @@ void CompareWorkspaces::processGroups(
// We should use an algorithm for each so that the output properties are
// reset properly
Algorithm_sptr
checker
=
this
->
createChildAlgorithm
(
this
->
name
(),
progressFraction
*
(
double
)
i
,
progressFraction
*
(
double
)
(
i
+
1
),
false
,
this
->
version
());
this
->
name
(),
progressFraction
*
static_cast
<
double
>
(
i
),
progressFraction
*
static_cast
<
double
>
(
i
+
1
),
false
,
this
->
version
());
checker
->
setPropertyValue
(
"Workspace1"
,
namesOne
[
i
]);
checker
->
setPropertyValue
(
"Workspace2"
,
namesTwo
[
i
]);
for
(
size_t
j
=
0
;
j
<
numNonDefault
;
++
j
)
{
...
...
Framework/Algorithms/src/ConvertToMatrixWorkspace.cpp
View file @
6331e6b5
...
...
@@ -48,7 +48,7 @@ void ConvertToMatrixWorkspace::exec() {
// ...but not the data, so do that here.
PARALLEL_FOR2
(
inputWorkspace
,
outputWorkspace
)
for
(
int64_t
i
=
0
;
i
<
(
int64_t
)
numHists
;
++
i
)
{
for
(
int64_t
i
=
0
;
i
<
static_cast
<
int64_t
>
(
numHists
)
;
++
i
)
{
PARALLEL_START_INTERUPT_REGION
const
ISpectrum
*
inSpec
=
inputWorkspace
->
getSpectrum
(
i
);
ISpectrum
*
outSpec
=
outputWorkspace
->
getSpectrum
(
i
);
...
...
Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp
View file @
6331e6b5
...
...
@@ -53,7 +53,7 @@ DiffractionEventCalibrateDetectors::~DiffractionEventCalibrateDetectors() {}
static
double
gsl_costFunction
(
const
gsl_vector
*
v
,
void
*
params
)
{
double
x
,
y
,
z
,
rotx
,
roty
,
rotz
;
std
::
string
detname
,
inname
,
outname
,
peakOpt
,
rb_param
,
groupWSName
;
std
::
string
*
p
=
(
std
::
string
*
)
params
;
std
::
string
*
p
=
reinterpret_cast
<
std
::
string
*
>
(
params
)
;
detname
=
p
[
0
];
inname
=
p
[
1
];
outname
=
p
[
2
];
...
...
Framework/Algorithms/src/EQSANSTofStructure.cpp
View file @
6331e6b5
...
...
@@ -105,7 +105,8 @@ void EQSANSTofStructure::exec() {
frame_skipping
?
tof_frame_width
*
2.0
:
tof_frame_width
;
double
frame_offset
=
0.0
;
if
(
frame_tof0
>=
tmp_frame_width
)
frame_offset
=
tmp_frame_width
*
((
int
)(
frame_tof0
/
tmp_frame_width
));
frame_offset
=
tmp_frame_width
*
(
static_cast
<
int
>
(
frame_tof0
/
tmp_frame_width
));
this
->
execEvent
(
inputWS
,
frame_tof0
,
frame_offset
,
tof_frame_width
,
tmp_frame_width
,
frame_skipping
);
...
...
Framework/Algorithms/src/FindCenterOfMassPosition.cpp
View file @
6331e6b5
...
...
@@ -131,8 +131,8 @@ void FindCenterOfMassPosition::exec() {
// Get the current spectrum
const
MantidVec
&
YIn
=
inputWS
->
readY
(
i
);
double
y
=
(
double
)
((
i
-
n_monitors
)
%
n_pixel_x
);
double
x
=
floor
(
(
double
)
(
i
-
n_monitors
)
/
n_pixel_y
);
double
y
=
static_cast
<
double
>
((
i
-
n_monitors
)
%
n_pixel_x
);
double
x
=
floor
(
static_cast
<
double
>
(
i
-
n_monitors
)
/
n_pixel_y
);
if
(
x
>=
xmin
&&
x
<=
xmax
&&
y
>=
ymin
&&
y
<=
ymax
)
{
if
(
!
direct_beam
)
{
...
...
Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp
View file @
6331e6b5
...
...
@@ -38,7 +38,7 @@ const double BAD_OFFSET(1000.); // mark things that didn't work with this
double
gsl_costFunction
(
const
gsl_vector
*
v
,
void
*
params
)
{
// FIXME - there is no need to use vectors peakPosToFit, peakPosFitted and
// chisq
double
*
p
=
(
double
*
)
params
;
double
*
p
=
reinterpret_cast
<
double
*
>
(
params
)
;
size_t
n
=
static_cast
<
size_t
>
(
p
[
0
]);
std
::
vector
<
double
>
peakPosToFit
(
n
);
std
::
vector
<
double
>
peakPosFitted
(
n
);
...
...
Framework/Algorithms/src/GetEi2.cpp
View file @
6331e6b5
...
...
@@ -678,9 +678,10 @@ void GetEi2::integrate(double &integral_val, double &integral_err,
MantidVec
::
size_type
nx
(
x
.
size
());
if
(
mu
<
ml
)
{
// special case of no data points in the integration range
unsigned
int
ilo
=
std
::
max
<
unsigned
int
>
((
unsigned
int
)
ml
-
1
,
0
);
unsigned
int
ihi
=
std
::
min
<
unsigned
int
>
((
unsigned
int
)
mu
+
1
,
(
unsigned
int
)
nx
);
unsigned
int
ilo
=
std
::
max
<
unsigned
int
>
(
static_cast
<
unsigned
int
>
(
ml
)
-
1
,
0
);
unsigned
int
ihi
=
std
::
min
<
unsigned
int
>
(
static_cast
<
unsigned
int
>
(
mu
)
+
1
,
static_cast
<
unsigned
int
>
(
nx
));
double
fraction
=
(
xmax
-
xmin
)
/
(
x
[
ihi
]
-
x
[
ilo
]);
integral_val
=
0.5
*
fraction
*
(
s
[
ihi
]
*
((
xmax
-
x
[
ilo
])
+
(
xmin
-
x
[
ilo
]))
+
...
...
@@ -733,7 +734,7 @@ void GetEi2::integrate(double &integral_val, double &integral_err,
double
err_hi
=
e
[
mu
]
*
(
x
[
mu
-
1
]
-
xneff
);
integral_err
+=
err_lo
*
err_lo
+
err_hi
*
err_hi
;
}
else
{
for
(
int
i
=
(
int
)
ml
;
i
<
mu
;
++
i
)
{
for
(
int
i
=
static_cast
<
int
>
(
ml
)
;
i
<
mu
;
++
i
)
{
integral_val
+=
(
s
[
i
+
1
]
+
s
[
i
])
*
(
x
[
i
+
1
]
-
x
[
i
]);
if
(
i
<
mu
-
1
)
{
double
ierr
=
e
[
i
+
1
]
*
(
x
[
i
+
2
]
-
x
[
i
]);
...
...
Framework/Algorithms/src/MonteCarloAbsorption.cpp
View file @
6331e6b5
...
...
@@ -205,7 +205,7 @@ void MonteCarloAbsorption::doSimulation(const IDetector *const detector,
// Attenuation factor is simply the average value
attenFactor
/=
numDetected
;
// Error is 1/sqrt(nevents)
error
=
1.
/
sqrt
(
(
double
)
numDetected
);
error
=
1.
/
sqrt
(
static_cast
<
double
>
(
numDetected
)
)
;
}
/**
...
...
Framework/Algorithms/src/NormaliseToMonitor.cpp
View file @
6331e6b5
...
...
@@ -396,7 +396,7 @@ API::MatrixWorkspace_sptr NormaliseToMonitor::getInWSMonitorSpectrum(
throw
std
::
runtime_error
(
"More then one spectra corresponds to the "
"requested monitor ID, which is unheard of"
);
}
spectra_num
=
(
int
)
indexList
[
0
];
spectra_num
=
static_cast
<
int
>
(
indexList
[
0
]
)
;
}
else
{
// monitor spectrum is specified.
spec2index_map
specs
;
const
SpectraAxis
*
axis
=
...
...
@@ -410,7 +410,7 @@ API::MatrixWorkspace_sptr NormaliseToMonitor::getInWSMonitorSpectrum(
throw
std
::
runtime_error
(
"Input workspace does not contain spectrum "
"number given for MonitorSpectrum"
);
}
spectra_num
=
(
int
)
specs
[
monitorSpec
];
spectra_num
=
static_cast
<
int
>
(
specs
[
monitorSpec
]
)
;
}
return
this
->
extractMonitorSpectrum
(
inputWorkspace
,
spectra_num
);
}
...
...
Framework/Algorithms/src/Q1DWeighted.cpp
View file @
6331e6b5
...
...
@@ -207,8 +207,9 @@ void Q1DWeighted::exec() {
double
sub_y
=
pixelSizeY
*
((
isub
%
nSubPixels
)
-
(
nSubPixels
-
1.0
)
/
2.0
)
/
nSubPixels
;
double
sub_x
=
pixelSizeX
*
(
floor
((
double
)
isub
/
nSubPixels
)
-
(
nSubPixels
-
1.0
)
/
2.0
)
/
double
sub_x
=
pixelSizeX
*
(
floor
(
static_cast
<
double
>
(
isub
)
/
nSubPixels
)
-
(
nSubPixels
-
1.0
)
/
2.0
)
/
nSubPixels
;
// Find the position of this sub-pixel in real space and compute Q
...
...
@@ -224,14 +225,15 @@ void Q1DWeighted::exec() {
// Bin assignment depends on whether we have log or linear bins
if
(
binParams
.
size
()
==
3
)
{
if
(
binParams
[
1
]
>
0.0
)
{
iq
=
(
int
)
floor
((
q
-
binParams
[
0
])
/
binParams
[
1
]);
iq
=
static_cast
<
int
>
(
floor
((
q
-
binParams
[
0
])
/
binParams
[
1
])
)
;
}
else
{
iq
=
(
int
)
floor
(
log
(
q
/
binParams
[
0
])
/
log
(
1.0
-
binParams
[
1
]));
iq
=
static_cast
<
int
>
(
floor
(
log
(
q
/
binParams
[
0
])
/
log
(
1.0
-
binParams
[
1
])));
}
// If we got a more complicated binning, find the q bin the slow way
}
else
{
for
(
int
i_qbin
=
0
;
i_qbin
<
(
int
)
XOut
.
access
().
size
()
-
1
;
i_qbin
++
)
{
for
(
int
i_qbin
=
0
;
i_qbin
<
static_cast
<
int
>
(
XOut
.
access
().
size
())
-
1
;
i_qbin
++
)
{
if
(
q
>=
XOut
.
access
()[
i_qbin
]
&&
q
<
XOut
.
access
()[(
i_qbin
+
1
)])
{
iq
=
i_qbin
;
break
;
...
...
Framework/Algorithms/src/Qhelper.cpp
View file @
6331e6b5
...
...
@@ -116,7 +116,7 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS,
size_t
num_histograms
=
dataWS
->
getNumberHistograms
();
for
(
size_t
i
=
0
;
i
<
num_histograms
;
i
++
)
{
double
adj
=
(
double
)
detectAdj
->
readY
(
i
)[
0
];
double
adj
=
static_cast
<
double
>
(
detectAdj
->
readY
(
i
)[
0
]
)
;
if
(
adj
<=
0.0
)
{
bool
det_is_masked
;
...
...
Framework/Algorithms/src/RadiusSum.cpp
View file @
6331e6b5
...
...
@@ -527,8 +527,8 @@ void RadiusSum::numBinsIsReasonable() {
<<
"It corresponds to a separation smaller than the image "
"resolution (detector size). "
<<
"A resonable number is smaller than "
<<
(
int
)
((
max_radius
-
min_radius
)
/
min_bin_size
)
<<
std
::
endl
;
<<
static_cast
<
int
>
((
max_radius
-
min_radius
)
/
min_bin_size
)
<<
std
::
endl
;
}
double
RadiusSum
::
getMinBinSizeForInstrument
(
API
::
MatrixWorkspace_sptr
inWS
)
{
...
...
@@ -570,8 +570,8 @@ double RadiusSum::getMinBinSizeForNumericImage(API::MatrixWorkspace_sptr inWS) {
std
::
vector
<
double
>
boundaries
=
getBoundariesOfNumericImage
(
inWS
);
const
MantidVec
&
refX
=
inWS
->
readX
(
inputWS
->
getNumberHistograms
()
/
2
);
int
nX
=
(
int
)
(
refX
.
size
());
int
nY
=
(
int
)
(
inWS
->
getAxis
(
1
)
->
length
());
int
nX
=
static_cast
<
int
>
(
refX
.
size
());
int
nY
=
static_cast
<
int
>
(
inWS
->
getAxis
(
1
)
->
length
());
// remembering boundaries is defined as { xMin, xMax, yMin, yMax}
return
std
::
min
(((
boundaries
[
1
]
-
boundaries
[
0
])
/
nX
),
...
...
@@ -592,11 +592,11 @@ void RadiusSum::normalizeOutputByRadius(std::vector<double> &values,
g_log
.
debug
()
<<
"Calculate Output[i] = Counts[i] / (Radius[i] ^ "
<<
exp_power
<<
") << "
<<
std
::
endl
;
if
(
exp_power
>
1.00001
||
exp_power
<
0.99999
)
{
for
(
int
i
=
0
;
i
<
(
int
)
values
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
values
.
size
()
)
;
i
++
)
{
values
[
i
]
=
values
[
i
]
/
pow
(
first_radius
+
i
*
bin_size
,
exp_power
);
}
}
else
{
// avoid calling pow because exp_power == 1 (for performance)
for
(
int
i
=
0
;
i
<
(
int
)
values
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
values
.
size
()
)
;
i
++
)
{
values
[
i
]
=
values
[
i
]
/
(
first_radius
+
i
*
bin_size
);
}
}
...
...
@@ -649,7 +649,7 @@ void RadiusSum::setUpOutputWorkspace(std::vector<double> &values) {
MantidVec
&
refX
=
outputWS
->
dataX
(
0
);
double
bin_size
=
(
max_radius
-
min_radius
)
/
num_bins
;
for
(
int
i
=
0
;
i
<
(
(
int
)
refX
.
size
())
-
1
;
i
++
)
for
(
int
i
=
0
;
i
<
(
static_cast
<
int
>
(
refX
.
size
())
)
-
1
;
i
++
)
refX
[
i
]
=
min_radius
+
i
*
bin_size
;
refX
[
refX
.
size
()
-
1
]
=
max_radius
;
...
...
Framework/Algorithms/src/RebinToWorkspace.cpp
View file @
6331e6b5
...
...
@@ -75,7 +75,7 @@ void RebinToWorkspace::createRebinParameters(
// params vector should have the form [x_1, delta_1,x_2, ...
// ,x_n-1,delta_n-1,x_n), see Rebin.cpp
rb_params
.
clear
();
int
xsize
=
(
int
)
matchXdata
.
size
();
int
xsize
=
static_cast
<
int
>
(
matchXdata
.
size
()
)
;
rb_params
.
reserve
(
xsize
*
2
);
for
(
int
i
=
0
;
i
<
xsize
;
++
i
)
{
// bin bound
...
...
Prev
1
2
3
4
5
…
7
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment