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
4be4e5a6
Commit
4be4e5a6
authored
Feb 25, 2016
by
Nick Draper
Browse files
change specid_t to specnum_t is was a source of confusion
re #15450
parent
206fb6a3
Changes
131
Hide whitespace changes
Inline
Side-by-side
Framework/API/inc/MantidAPI/Axis.h
View file @
4be4e5a6
...
...
@@ -87,8 +87,8 @@ public:
/// Find the index of the given double value
virtual
size_t
indexOfValue
(
const
double
value
)
const
=
0
;
/// Get the spectrum
index
virtual
spec
id
_t
spectraNo
(
const
std
::
size_t
&
index
)
const
;
/// Get the spectrum
number
virtual
spec
num
_t
spectraNo
(
const
std
::
size_t
&
index
)
const
;
/// Get the length of the axis
virtual
std
::
size_t
length
()
const
=
0
;
...
...
Framework/API/inc/MantidAPI/IEventList.h
View file @
4be4e5a6
...
...
@@ -24,7 +24,7 @@ public:
IEventList
()
{}
/// Constructor
IEventList
(
spec
id
_t
specNo
)
:
ISpectrum
(
specNo
)
{}
IEventList
(
spec
num
_t
specNo
)
:
ISpectrum
(
specNo
)
{}
/// Return the current event type for the list
virtual
Mantid
::
API
::
EventType
getEventType
()
const
=
0
;
...
...
Framework/API/inc/MantidAPI/ILiveListener.h
View file @
4be4e5a6
...
...
@@ -135,7 +135,7 @@ public:
* spectra.
* @param specList :: A vector with spectra indices.
*/
virtual
void
setSpectra
(
const
std
::
vector
<
spec
id
_t
>
&
specList
)
{
virtual
void
setSpectra
(
const
std
::
vector
<
spec
num
_t
>
&
specList
)
{
(
void
)
specList
;
}
...
...
Framework/API/inc/MantidAPI/ISpectrum.h
View file @
4be4e5a6
...
...
@@ -47,7 +47,7 @@ namespace API {
class
DLLExport
ISpectrum
{
public:
ISpectrum
();
ISpectrum
(
const
spec
id
_t
specNo
);
ISpectrum
(
const
spec
num
_t
specNo
);
ISpectrum
(
const
ISpectrum
&
other
);
virtual
~
ISpectrum
();
...
...
@@ -112,9 +112,9 @@ public:
void
clearDetectorIDs
();
// ---------------------------------------------------------
spec
id
_t
getSpectrumNo
()
const
;
spec
num
_t
getSpectrumNo
()
const
;
void
setSpectrumNo
(
spec
id
_t
num
);
void
setSpectrumNo
(
spec
num
_t
num
);
// ---------------------------------------------------------
virtual
void
lockData
()
const
;
...
...
@@ -126,7 +126,7 @@ public:
protected:
/// The spectrum number of this spectrum
spec
id
_t
m_specNo
;
spec
num
_t
m_specNo
;
/// Set of the detector IDs associated with this spectrum
std
::
set
<
detid_t
>
detectorIDs
;
...
...
Framework/API/inc/MantidAPI/MatrixWorkspace.h
View file @
4be4e5a6
...
...
@@ -103,18 +103,18 @@ public:
/// Causes the nearest neighbours map to be rebuilt
void
rebuildNearestNeighbours
();
/// Query the NearestNeighbours object for a detector
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
getNeighbours
(
const
Geometry
::
IDetector
*
comp
,
const
double
radius
=
0.0
,
const
bool
ignoreMaskedDetectors
=
false
)
const
;
/// Query the NearestNeighbours object for a given spectrum index using a
/// search radius
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
getNeighbours
(
spec
id
_t
spec
,
const
double
radius
,
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
getNeighbours
(
spec
num
_t
spec
,
const
double
radius
,
const
bool
ignoreMaskedDetectors
=
false
)
const
;
/// Query the NearestNeighbours object for a given spectrum index using the
/// direct number of nearest neighbours
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
getNeighboursExact
(
spec
id
_t
spec
,
const
int
nNeighbours
,
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
getNeighboursExact
(
spec
num
_t
spec
,
const
int
nNeighbours
,
const
bool
ignoreMaskedDetectors
=
false
)
const
;
//@}
...
...
@@ -131,14 +131,14 @@ public:
getDetectorIDToWorkspaceIndexVector
(
std
::
vector
<
size_t
>
&
out
,
detid_t
&
offset
,
bool
throwIfMultipleDets
=
false
)
const
;
virtual
void
getSpectrumToWorkspaceIndexVector
(
std
::
vector
<
size_t
>
&
out
,
spec
id
_t
&
offset
)
const
;
void
getIndicesFromSpectra
(
const
std
::
vector
<
spec
id
_t
>
&
spectraList
,
spec
num
_t
&
offset
)
const
;
void
getIndicesFromSpectra
(
const
std
::
vector
<
spec
num
_t
>
&
spectraList
,
std
::
vector
<
size_t
>
&
indexList
)
const
;
size_t
getIndexFromSpectrumNumber
(
const
spec
id
_t
specNo
)
const
;
size_t
getIndexFromSpectrumNumber
(
const
spec
num
_t
specNo
)
const
;
void
getIndicesFromDetectorIDs
(
const
std
::
vector
<
detid_t
>
&
detIdList
,
std
::
vector
<
size_t
>
&
indexList
)
const
;
void
getSpectraFromDetectorIDs
(
const
std
::
vector
<
detid_t
>
&
detIdList
,
std
::
vector
<
spec
id
_t
>
&
spectraList
)
const
;
std
::
vector
<
spec
num
_t
>
&
spectraList
)
const
;
bool
hasGroupedDetectors
()
const
;
...
...
Framework/API/inc/MantidAPI/SpectraAxis.h
View file @
4be4e5a6
...
...
@@ -61,7 +61,7 @@ public:
bool
operator
==
(
const
Axis
&
)
const
override
;
std
::
string
label
(
const
std
::
size_t
&
index
)
const
override
;
spec
id
_t
spectraNo
(
const
std
::
size_t
&
index
)
const
override
;
spec
num
_t
spectraNo
(
const
std
::
size_t
&
index
)
const
override
;
// Get a map that contains the spectra index as the key and the index in the
// array as teh value
void
getSpectraIndexMap
(
spec2index_map
&
)
const
;
...
...
Framework/API/inc/MantidAPI/SpectraDetectorTypes.h
View file @
4be4e5a6
...
...
@@ -15,12 +15,12 @@ namespace Mantid {
#ifndef HAS_UNORDERED_MAP_H
/// Map with key = spectrum number, value = workspace index
typedef
std
::
map
<
spec
id
_t
,
size_t
>
spec2index_map
;
typedef
std
::
map
<
spec
num
_t
,
size_t
>
spec2index_map
;
/// Map with key = detector ID, value = workspace index
typedef
std
::
map
<
detid_t
,
size_t
>
detid2index_map
;
#else
/// Map with key = spectrum number, value = workspace index
typedef
std
::
tr1
::
unordered_map
<
spec
id
_t
,
size_t
>
spec2index_map
;
typedef
std
::
tr1
::
unordered_map
<
spec
num
_t
,
size_t
>
spec2index_map
;
/// Map with key = detector ID, value = workspace index
typedef
std
::
tr1
::
unordered_map
<
detid_t
,
size_t
>
detid2index_map
;
#endif
...
...
Framework/API/inc/MantidAPI/SpectrumDetectorMapping.h
View file @
4be4e5a6
...
...
@@ -50,34 +50,34 @@ class MatrixWorkspace;
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
MANTID_API_DLL
SpectrumDetectorMapping
{
typedef
std
::
unordered_map
<
spec
id
_t
,
std
::
set
<
detid_t
>>
sdmap
;
typedef
std
::
unordered_map
<
spec
num
_t
,
std
::
set
<
detid_t
>>
sdmap
;
public:
explicit
SpectrumDetectorMapping
(
const
MatrixWorkspace
*
const
workspace
,
bool
useSpecNoIndex
=
true
);
SpectrumDetectorMapping
(
const
std
::
vector
<
spec
id
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
spec
num
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
detid_t
>
&
detectorIDs
,
const
std
::
vector
<
detid_t
>
&
ignoreDetIDs
=
std
::
vector
<
detid_t
>
());
SpectrumDetectorMapping
(
const
spec
id
_t
*
const
spectrumNumbers
,
SpectrumDetectorMapping
(
const
spec
num
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
size_t
arrayLengths
);
SpectrumDetectorMapping
();
virtual
~
SpectrumDetectorMapping
();
std
::
set
<
spec
id
_t
>
getSpectrumNumbers
()
const
;
std
::
set
<
spec
num
_t
>
getSpectrumNumbers
()
const
;
const
std
::
set
<
detid_t
>
&
getDetectorIDsForSpectrumNo
(
const
spec
id
_t
spectrumNo
)
const
;
getDetectorIDsForSpectrumNo
(
const
spec
num
_t
spectrumNo
)
const
;
const
std
::
set
<
detid_t
>
&
getDetectorIDsForSpectrumIndex
(
const
size_t
index
)
const
;
const
sdmap
&
getMapping
()
const
;
bool
indexIsSpecNumber
()
const
;
private:
void
fillMapFromArray
(
const
spec
id
_t
*
const
spectrumNumbers
,
void
fillMapFromArray
(
const
spec
num
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
const
size_t
arrayLengths
);
void
fillMapFromVector
(
const
std
::
vector
<
spec
id
_t
>
&
spectrumNumbers
,
void
fillMapFromVector
(
const
std
::
vector
<
spec
num
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
detid_t
>
&
detectorIDs
,
const
std
::
vector
<
detid_t
>
&
ignoreDetIDs
);
...
...
Framework/API/src/Axis.cpp
View file @
4be4e5a6
...
...
@@ -63,7 +63,7 @@ double Axis::getValue(const std::size_t &index,
* @return The spectrum number as an int
* @throw domain_error If this method is called on a numeric axis
*/
spec
id
_t
Axis
::
spectraNo
(
const
std
::
size_t
&
index
)
const
{
spec
num
_t
Axis
::
spectraNo
(
const
std
::
size_t
&
index
)
const
{
UNUSED_ARG
(
index
)
throw
std
::
domain_error
(
"Cannot call spectraNo() on a non-spectra axis."
);
}
...
...
Framework/API/src/ISpectrum.cpp
View file @
4be4e5a6
...
...
@@ -13,7 +13,7 @@ ISpectrum::ISpectrum()
/** Constructor with spectrum number
* @param specNo :: spectrum # of the spectrum
*/
ISpectrum
::
ISpectrum
(
const
spec
id
_t
specNo
)
ISpectrum
::
ISpectrum
(
const
spec
num
_t
specNo
)
:
m_specNo
(
specNo
),
detectorIDs
(),
refX
(),
refDx
(),
m_hasDx
(
false
)
{}
//----------------------------------------------------------------------------------------------
...
...
@@ -212,11 +212,11 @@ std::set<detid_t> &ISpectrum::getDetectorIDs() { return this->detectorIDs; }
// ---------------------------------------------------------
/// @return the spectrum number of this spectrum
spec
id
_t
ISpectrum
::
getSpectrumNo
()
const
{
return
m_specNo
;
}
spec
num
_t
ISpectrum
::
getSpectrumNo
()
const
{
return
m_specNo
;
}
/** Sets the the spectrum number of this spectrum
* @param num :: the spectrum number of this spectrum */
void
ISpectrum
::
setSpectrumNo
(
spec
id
_t
num
)
{
m_specNo
=
num
;
}
void
ISpectrum
::
setSpectrumNo
(
spec
num
_t
num
)
{
m_specNo
=
num
;
}
// ---------------------------------------------------------
/** Lock access to the data so that it does not get deleted while reading.
...
...
Framework/API/src/MatrixWorkspace.cpp
View file @
4be4e5a6
...
...
@@ -224,7 +224,7 @@ void MatrixWorkspace::rebuildSpectraMapping(const bool includeMonitors) {
// The detector ID
const
detid_t
detId
=
*
it
;
// By default: Spectrum number = index + 1
const
spec
id
_t
specNo
=
spec
id
_t
(
index
+
1
);
const
spec
num
_t
specNo
=
spec
num
_t
(
index
+
1
);
if
(
index
<
this
->
getNumberHistograms
())
{
ISpectrum
*
spec
=
getSpectrum
(
index
);
...
...
@@ -288,7 +288,7 @@ void MatrixWorkspace::rebuildNearestNeighbours() {
*be ignored. True to ignore detectors.
* @return map of DetectorID to distance for the nearest neighbours
*/
std
::
map
<
spec
id
_t
,
V3D
>
std
::
map
<
spec
num
_t
,
V3D
>
MatrixWorkspace
::
getNeighbours
(
const
Geometry
::
IDetector
*
comp
,
const
double
radius
,
const
bool
ignoreMaskedDetectors
)
const
{
...
...
@@ -296,7 +296,7 @@ MatrixWorkspace::getNeighbours(const Geometry::IDetector *comp,
buildNearestNeighbours
(
ignoreMaskedDetectors
);
}
// Find the spectrum number
std
::
vector
<
spec
id
_t
>
spectra
;
std
::
vector
<
spec
num
_t
>
spectra
;
this
->
getSpectraFromDetectorIDs
(
std
::
vector
<
detid_t
>
(
1
,
comp
->
getID
()),
spectra
);
if
(
spectra
.
empty
())
{
...
...
@@ -305,7 +305,7 @@ MatrixWorkspace::getNeighbours(const Geometry::IDetector *comp,
"detector"
,
comp
->
getID
());
}
std
::
map
<
spec
id
_t
,
V3D
>
neighbours
=
std
::
map
<
spec
num
_t
,
V3D
>
neighbours
=
m_nearestNeighbours
->
neighboursInRadius
(
spectra
[
0
],
radius
);
return
neighbours
;
}
...
...
@@ -319,13 +319,13 @@ MatrixWorkspace::getNeighbours(const Geometry::IDetector *comp,
*be ignored. True to ignore detectors.
* @return map of DetectorID to distance for the nearest neighbours
*/
std
::
map
<
spec
id
_t
,
V3D
>
MatrixWorkspace
::
getNeighbours
(
spec
id
_t
spec
,
const
double
radius
,
std
::
map
<
spec
num
_t
,
V3D
>
MatrixWorkspace
::
getNeighbours
(
spec
num
_t
spec
,
const
double
radius
,
bool
ignoreMaskedDetectors
)
const
{
if
(
!
m_nearestNeighbours
)
{
buildNearestNeighbours
(
ignoreMaskedDetectors
);
}
std
::
map
<
spec
id
_t
,
V3D
>
neighbours
=
std
::
map
<
spec
num
_t
,
V3D
>
neighbours
=
m_nearestNeighbours
->
neighboursInRadius
(
spec
,
radius
);
return
neighbours
;
}
...
...
@@ -339,8 +339,8 @@ MatrixWorkspace::getNeighbours(specid_t spec, const double radius,
*be ignored. True to ignore detectors.
* @return map of DetectorID to distance for the nearest neighbours
*/
std
::
map
<
spec
id
_t
,
V3D
>
MatrixWorkspace
::
getNeighboursExact
(
spec
id
_t
spec
,
const
int
nNeighbours
,
std
::
map
<
spec
num
_t
,
V3D
>
MatrixWorkspace
::
getNeighboursExact
(
spec
num
_t
spec
,
const
int
nNeighbours
,
bool
ignoreMaskedDetectors
)
const
{
if
(
!
m_nearestNeighbours
)
{
SpectrumDetectorMapping
spectraMap
(
this
);
...
...
@@ -348,7 +348,7 @@ MatrixWorkspace::getNeighboursExact(specid_t spec, const int nNeighbours,
nNeighbours
,
this
->
getInstrument
(),
spectraMap
.
getMapping
(),
ignoreMaskedDetectors
));
}
std
::
map
<
spec
id
_t
,
V3D
>
neighbours
=
m_nearestNeighbours
->
neighbours
(
spec
);
std
::
map
<
spec
num
_t
,
V3D
>
neighbours
=
m_nearestNeighbours
->
neighbours
(
spec
);
return
neighbours
;
}
...
...
@@ -383,7 +383,7 @@ spec2index_map MatrixWorkspace::getSpectrumToWorkspaceIndexMap() const {
*vector.
*/
void
MatrixWorkspace
::
getSpectrumToWorkspaceIndexVector
(
std
::
vector
<
size_t
>
&
out
,
spec
id
_t
&
offset
)
const
{
std
::
vector
<
size_t
>
&
out
,
spec
num
_t
&
offset
)
const
{
SpectraAxis
*
ax
=
dynamic_cast
<
SpectraAxis
*>
(
this
->
m_axes
[
1
]);
if
(
!
ax
)
throw
std
::
runtime_error
(
"MatrixWorkspace::getSpectrumToWorkspaceIndexMap: "
...
...
@@ -391,14 +391,14 @@ void MatrixWorkspace::getSpectrumToWorkspaceIndexVector(
"generate a map."
);
// Find the min/max spectra IDs
spec
id
_t
min
=
std
::
numeric_limits
<
spec
id
_t
>::
max
();
// So that any number
spec
num
_t
min
=
std
::
numeric_limits
<
spec
num
_t
>::
max
();
// So that any number
// will be less than this
spec
id
_t
max
=
-
std
::
numeric_limits
<
spec
id
_t
>::
max
();
// So that any number
spec
num
_t
max
=
-
std
::
numeric_limits
<
spec
num
_t
>::
max
();
// So that any number
// will be greater than
// this
size_t
length
=
ax
->
length
();
for
(
size_t
i
=
0
;
i
<
length
;
i
++
)
{
spec
id
_t
spec
=
ax
->
spectraNo
(
i
);
spec
num
_t
spec
=
ax
->
spectraNo
(
i
);
if
(
spec
<
min
)
min
=
spec
;
if
(
spec
>
max
)
...
...
@@ -413,7 +413,7 @@ void MatrixWorkspace::getSpectrumToWorkspaceIndexVector(
// Make the vector
for
(
size_t
i
=
0
;
i
<
length
;
i
++
)
{
spec
id
_t
spec
=
ax
->
spectraNo
(
i
);
spec
num
_t
spec
=
ax
->
spectraNo
(
i
);
out
[
spec
+
offset
]
=
i
;
}
}
...
...
@@ -545,7 +545,7 @@ void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
*not a Workspace2D)
*/
void
MatrixWorkspace
::
getIndicesFromSpectra
(
const
std
::
vector
<
spec
id
_t
>
&
spectraList
,
const
std
::
vector
<
spec
num
_t
>
&
spectraList
,
std
::
vector
<
size_t
>
&
indexList
)
const
{
// Clear the output index list
indexList
.
clear
();
...
...
@@ -571,7 +571,7 @@ void MatrixWorkspace::getIndicesFromSpectra(
* @throw runtime_error if not found.
*/
size_t
MatrixWorkspace
::
getIndexFromSpectrumNumber
(
const
spec
id
_t
specNo
)
const
{
MatrixWorkspace
::
getIndexFromSpectrumNumber
(
const
spec
num
_t
specNo
)
const
{
for
(
size_t
i
=
0
;
i
<
this
->
getNumberHistograms
();
++
i
)
{
if
(
this
->
getSpectrum
(
i
)
->
getSpectrumNo
()
==
specNo
)
return
i
;
...
...
@@ -624,14 +624,14 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
*/
void
MatrixWorkspace
::
getSpectraFromDetectorIDs
(
const
std
::
vector
<
detid_t
>
&
detIdList
,
std
::
vector
<
spec
id
_t
>
&
spectraList
)
const
{
std
::
vector
<
spec
num
_t
>
&
spectraList
)
const
{
spectraList
.
clear
();
// Try every detector in the list
for
(
auto
detId
:
detIdList
)
{
bool
foundDet
=
false
;
spec
id
_t
foundSpecNum
=
0
;
spec
num
_t
foundSpecNum
=
0
;
// Go through every histogram
for
(
size_t
i
=
0
;
i
<
this
->
getNumberHistograms
();
i
++
)
{
...
...
Framework/API/src/SpectraAxis.cpp
View file @
4be4e5a6
...
...
@@ -84,7 +84,7 @@ void SpectraAxis::setValue(const std::size_t &index, const double &value) {
/**
* Finds the index of the given value on the axis
* @param value A value on the axis. It is treated as a spectrum number and cast
* to spec
id
_t on input
* to spec
num
_t on input
* @return The index closest to given value
* @throws std::out_of_range if the value is out of range of the axis
*/
...
...
@@ -109,7 +109,7 @@ size_t SpectraAxis::indexOfValue(const double value) const {
* @return The spectrum number as an int
* @throw IndexError If the index requested is not in the range of this axis
*/
spec
id
_t
SpectraAxis
::
spectraNo
(
const
std
::
size_t
&
index
)
const
{
spec
num
_t
SpectraAxis
::
spectraNo
(
const
std
::
size_t
&
index
)
const
{
if
(
index
>=
length
())
{
throw
Kernel
::
Exception
::
IndexError
(
index
,
length
()
-
1
,
"SpectraAxis: Index out of range."
);
...
...
Framework/API/src/SpectrumDetectorMapping.cpp
View file @
4be4e5a6
...
...
@@ -34,7 +34,7 @@ SpectrumDetectorMapping::SpectrumDetectorMapping(
* are not of equal length
*/
SpectrumDetectorMapping
::
SpectrumDetectorMapping
(
const
std
::
vector
<
spec
id
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
spec
num
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
detid_t
>
&
detectorIDs
,
const
std
::
vector
<
detid_t
>
&
ignoreDetIDs
)
:
m_indexIsSpecNo
(
true
)
{
...
...
@@ -51,7 +51,7 @@ SpectrumDetectorMapping::SpectrumDetectorMapping(
* @throws std::invalid_argument if a null array pointer is passed in
*/
SpectrumDetectorMapping
::
SpectrumDetectorMapping
(
const
spec
id
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
const
spec
num
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
size_t
arrayLengths
)
:
m_indexIsSpecNo
(
true
)
{
if
(
spectrumNumbers
==
nullptr
||
detectorIDs
==
nullptr
)
{
...
...
@@ -64,7 +64,7 @@ SpectrumDetectorMapping::SpectrumDetectorMapping(
/// Called by the c-array constructors to do the actual filling
void
SpectrumDetectorMapping
::
fillMapFromArray
(
const
spec
id
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
const
spec
num
_t
*
const
spectrumNumbers
,
const
detid_t
*
const
detectorIDs
,
const
size_t
arrayLengths
)
{
for
(
size_t
i
=
0
;
i
<
arrayLengths
;
++
i
)
{
m_mapping
[
spectrumNumbers
[
i
]].
insert
(
detectorIDs
[
i
]);
...
...
@@ -73,7 +73,7 @@ void SpectrumDetectorMapping::fillMapFromArray(
/// Called by the vector constructors to do the actual filling
void
SpectrumDetectorMapping
::
fillMapFromVector
(
const
std
::
vector
<
spec
id
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
spec
num
_t
>
&
spectrumNumbers
,
const
std
::
vector
<
detid_t
>
&
detectorIDs
,
const
std
::
vector
<
detid_t
>
&
ignoreDetIDs
)
{
std
::
set
<
detid_t
>
ignoreIDs
(
ignoreDetIDs
.
begin
(),
ignoreDetIDs
.
end
());
...
...
@@ -92,8 +92,8 @@ SpectrumDetectorMapping::SpectrumDetectorMapping()
SpectrumDetectorMapping
::~
SpectrumDetectorMapping
()
{}
/// @returns An ordered set of the unique spectrum numbers
std
::
set
<
spec
id
_t
>
SpectrumDetectorMapping
::
getSpectrumNumbers
()
const
{
std
::
set
<
spec
id
_t
>
specs
;
std
::
set
<
spec
num
_t
>
SpectrumDetectorMapping
::
getSpectrumNumbers
()
const
{
std
::
set
<
spec
num
_t
>
specs
;
auto
itend
=
m_mapping
.
end
();
for
(
auto
it
=
m_mapping
.
begin
();
it
!=
itend
;
++
it
)
{
specs
.
insert
(
it
->
first
);
...
...
@@ -102,7 +102,7 @@ std::set<specid_t> SpectrumDetectorMapping::getSpectrumNumbers() const {
}
const
std
::
set
<
detid_t
>
&
SpectrumDetectorMapping
::
getDetectorIDsForSpectrumNo
(
const
spec
id
_t
spectrumNo
)
const
{
const
spec
num
_t
spectrumNo
)
const
{
if
(
!
m_indexIsSpecNo
)
throw
std
::
runtime_error
(
"Indicies are in spectrum index, not number."
);
return
m_mapping
.
at
(
spectrumNo
);
...
...
Framework/API/test/MatrixWorkspaceTest.h
View file @
4be4e5a6
...
...
@@ -124,7 +124,7 @@ public:
const
size_t
nhist
(
10
);
testWS
.
initialize
(
nhist
,
1
,
1
);
for
(
size_t
i
=
0
;
i
<
testWS
.
getNumberHistograms
();
i
++
)
{
TS_ASSERT_EQUALS
(
testWS
.
getSpectrum
(
i
)
->
getSpectrumNo
(),
spec
id
_t
(
i
+
1
));
TS_ASSERT_EQUALS
(
testWS
.
getSpectrum
(
i
)
->
getSpectrumNo
(),
spec
num
_t
(
i
+
1
));
TS_ASSERT
(
testWS
.
getSpectrum
(
i
)
->
hasDetectorID
(
detid_t
(
i
)));
}
}
...
...
@@ -133,7 +133,7 @@ public:
WorkspaceTester
testWS
;
testWS
.
initialize
(
3
,
1
,
1
);
spec
id
_t
specs
[]
=
{
1
,
2
,
2
,
3
};
spec
num
_t
specs
[]
=
{
1
,
2
,
2
,
3
};
detid_t
detids
[]
=
{
10
,
99
,
20
,
30
};
TS_ASSERT_THROWS_NOTHING
(
testWS
.
updateSpectraUsing
(
SpectrumDetectorMapping
(
specs
,
detids
,
4
)));
...
...
Framework/API/test/SpectrumDetectorMappingTest.h
View file @
4be4e5a6
...
...
@@ -43,7 +43,7 @@ public:
}
void
test_vector_constructor_unequal_lengths
()
{
TS_ASSERT_THROWS
(
SpectrumDetectorMapping
(
std
::
vector
<
spec
id
_t
>
(
2
),
TS_ASSERT_THROWS
(
SpectrumDetectorMapping
(
std
::
vector
<
spec
num
_t
>
(
2
),
std
::
vector
<
detid_t
>
(
1
)),
std
::
invalid_argument
);
}
...
...
@@ -64,7 +64,7 @@ public:
void
test_vector_constructor_uses_all_spectra_by_default
()
{
// Empty is fine for the input
std
::
vector
<
spec
id
_t
>
specs
;
std
::
vector
<
spec
num
_t
>
specs
;
std
::
vector
<
detid_t
>
detids
;
SpectrumDetectorMapping
map
(
specs
,
detids
);
TS_ASSERT
(
map
.
getMapping
().
empty
());
...
...
@@ -84,7 +84,7 @@ public:
void
test_vector_constructor_ignores_detectors_in_ignore_list
()
{
const
int
ndets
=
5
;
std
::
vector
<
spec
id
_t
>
specs
(
ndets
,
0
);
std
::
vector
<
spec
num
_t
>
specs
(
ndets
,
0
);
std
::
vector
<
detid_t
>
detids
(
ndets
,
0
);
for
(
int
i
=
0
;
i
<
ndets
;
++
i
)
{
specs
[
i
]
=
i
+
1
;
...
...
@@ -112,7 +112,7 @@ public:
}
void
test_array_constructor_null_inputs
()
{
spec
id
_t
specs
[
2
];
spec
num
_t
specs
[
2
];
detid_t
detids
[
2
];
TS_ASSERT_THROWS
(
SpectrumDetectorMapping
(
NULL
,
detids
,
10
),
std
::
invalid_argument
);
...
...
@@ -121,7 +121,7 @@ public:
}
void
test_array_constructor
()
{
spec
id
_t
specs
[]
=
{
1
,
2
,
2
,
3
};
spec
num
_t
specs
[]
=
{
1
,
2
,
2
,
3
};
detid_t
detids
[]
=
{
10
,
99
,
20
,
30
};
SpectrumDetectorMapping
map
(
specs
,
detids
,
4
);
...
...
@@ -129,7 +129,7 @@ public:
}
void
test_getSpectrumNumbers
()
{
spec
id
_t
specs
[]
=
{
5
,
4
,
4
,
3
};
spec
num
_t
specs
[]
=
{
5
,
4
,
4
,
3
};
detid_t
detids
[]
=
{
10
,
99
,
20
,
30
};
SpectrumDetectorMapping
map
(
specs
,
detids
,
4
);
...
...
Framework/Algorithms/inc/MantidAlgorithms/GeneratePeaks.h
View file @
4be4e5a6
...
...
@@ -71,7 +71,7 @@ private:
void
processTableColumnNames
();
void
importPeaksFromTable
(
std
::
map
<
spec
id
_t
,
std
::
vector
<
std
::
pair
<
double
,
API
::
IFunction_sptr
>>>
&
std
::
map
<
spec
num
_t
,
std
::
vector
<
std
::
pair
<
double
,
API
::
IFunction_sptr
>>>
&
functionmap
);
/// Import peak and background function parameters from vector
...
...
@@ -80,7 +80,7 @@ private:
/// Generate peaks in output data workspaces
void
generatePeaks
(
const
std
::
map
<
spec
id
_t
,
const
std
::
map
<
spec
num
_t
,
std
::
vector
<
std
::
pair
<
double
,
API
::
IFunction_sptr
>>>
&
functionmap
,
API
::
MatrixWorkspace_sptr
dataWS
);
...
...
@@ -117,11 +117,11 @@ private:
std
::
vector
<
double
>
m_vecBkgdParamValues
;
/// Spectrum map from full spectra workspace to partial spectra workspace
std
::
map
<
spec
id
_t
,
spec
id
_t
>
m_SpectrumMap
;
std
::
map
<
spec
num
_t
,
spec
num
_t
>
m_SpectrumMap
;
/// Set of spectra (workspace indexes) in the original workspace that contain
/// peaks to generate
std
::
set
<
spec
id
_t
>
m_spectraSet
;
std
::
set
<
spec
num
_t
>
m_spectraSet
;
/// Flag to use automatic background (???)
bool
m_useAutoBkgd
;
...
...
Framework/Algorithms/inc/MantidAlgorithms/GetEi.h
View file @
4be4e5a6
...
...
@@ -83,12 +83,12 @@ private:
void
init
()
override
;
void
exec
()
override
;
void
getGeometry
(
API
::
MatrixWorkspace_const_sptr
WS
,
spec
id
_t
mon0Spec
,
spec
id
_t
mon1Spec
,
double
&
monitor0Dist
,
void
getGeometry
(
API
::
MatrixWorkspace_const_sptr
WS
,
spec
num
_t
mon0Spec
,
spec
num
_t
mon1Spec
,
double
&
monitor0Dist
,
double
&
monitor1Dist
)
const
;
std
::
vector
<
size_t
>
getMonitorSpecIndexs
(
API
::
MatrixWorkspace_const_sptr
WS
,
spec
id
_t
specNum1
,
spec
id
_t
specNum2
)
const
;
spec
num
_t
specNum1
,
spec
num
_t
specNum2
)
const
;
double
timeToFly
(
double
s
,
double
E_KE
)
const
;
double
getPeakCentre
(
API
::
MatrixWorkspace_const_sptr
WS
,
const
int64_t
monitIn
,
const
double
peakTime
);
...
...
Framework/Algorithms/inc/MantidAlgorithms/He3TubeEfficiency.h
View file @
4be4e5a6
...
...
@@ -120,7 +120,7 @@ private:
/// Sample position
Kernel
::
V3D
samplePos
;
/// The spectra numbers that were skipped
std
::
vector
<
spec
id
_t
>
spectraSkipped
;
std
::
vector
<
spec
num
_t
>
spectraSkipped
;
/// Algorithm progress keeper
API
::
Progress
*
progress
;
};
...
...
Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h
View file @
4be4e5a6
...
...
@@ -12,7 +12,7 @@
namespace
Mantid
{
namespace
Algorithms
{
typedef
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
SpectraDistanceMap
;
typedef
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
SpectraDistanceMap
;
/*
Filters spectra detector list by radius.
...
...
@@ -41,7 +41,7 @@ public:
unfiltered
.
begin
(),
unfiltered
.
end
(),
std
::
inserter
(
neighbSpectra
,
neighbSpectra
.
end
()),
[
cutoff
](
const
std
::
pair
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
&
spectraDistance
)
{
const
std
::
pair
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
&
spectraDistance
)
{
return
spectraDistance
.
second
.
norm
()
<=
cutoff
;
});
return
neighbSpectra
;
...
...
Framework/Algorithms/inc/MantidAlgorithms/SpatialGrouping.h
View file @
4be4e5a6
...
...
@@ -78,11 +78,11 @@ private:
void
exec
()
override
;
/// expand our search out to the next neighbours along
bool
expandNet
(
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
&
nearest
,
spec
id
_t
spec
,
const
size_t
&
noNeighbours
,
bool
expandNet
(
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
&
nearest
,
spec
num
_t
spec
,
const
size_t
&
noNeighbours
,
const
Mantid
::
Geometry
::
BoundingBox
&
bbox
);
/// sort by distance
void
sortByDistance
(
std
::
map
<
spec
id
_t
,
Mantid
::
Kernel
::
V3D
>
&
nearest
,
void
sortByDistance
(
std
::
map
<
spec
num
_t
,
Mantid
::
Kernel
::
V3D
>
&
nearest
,
const
size_t
&
noNeighbours
);
/// create expanded bounding box for our purposes
void
createBox
(
boost
::
shared_ptr
<
const
Geometry
::
IDetector
>
det
,
...
...
@@ -91,9 +91,9 @@ private:
void
growBox
(
double
&
min
,
double
&
max
,
const
double
&
factor
);
/// map of detectors in the instrument
std
::
map
<
spec
id
_t
,
boost
::
shared_ptr
<
const
Geometry
::
IDetector
>>
m_detectors
;
std
::
map
<
spec
num
_t
,
boost
::
shared_ptr
<
const
Geometry
::
IDetector
>>
m_detectors
;
/// flag which detectors are included in a group already
std
::
set
<
spec
id
_t
>
m_included
;