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
66fdb835
Commit
66fdb835
authored
Mar 08, 2021
by
Whitfield, Ross
Browse files
Rename LeanPeaksWorkspace to LeanElasticPeaksWorkspace
parent
4f21c1c7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/CMakeLists.txt
View file @
66fdb835
...
...
@@ -31,7 +31,7 @@ set(SRC_FILES
src/LeanElasticPeak.cpp
src/BasePeak.cpp
src/PeakColumn.cpp
src/LeanPeakColumn.cpp
src/Lean
Elastic
PeakColumn.cpp
src/PeakNoShapeFactory.cpp
src/PeakShapeBase.cpp
src/PeakShapeEllipsoid.cpp
...
...
@@ -39,7 +39,7 @@ set(SRC_FILES
src/PeakShapeSpherical.cpp
src/PeakShapeSphericalFactory.cpp
src/PeaksWorkspace.cpp
src/LeanPeaksWorkspace.cpp
src/Lean
Elastic
PeaksWorkspace.cpp
src/PropertyWithValue.cpp
src/RebinnedOutput.cpp
src/ReflectometryTransform.cpp
...
...
@@ -115,7 +115,7 @@ set(INC_FILES
inc/MantidDataObjects/LeanElasticPeak.h
inc/MantidDataObjects/BasePeak.h
inc/MantidDataObjects/PeakColumn.h
inc/MantidDataObjects/LeanPeakColumn.h
inc/MantidDataObjects/Lean
Elastic
PeakColumn.h
inc/MantidDataObjects/PeakNoShapeFactory.h
inc/MantidDataObjects/PeakShapeBase.h
inc/MantidDataObjects/PeakShapeEllipsoid.h
...
...
@@ -124,7 +124,7 @@ set(INC_FILES
inc/MantidDataObjects/PeakShapeSpherical.h
inc/MantidDataObjects/PeakShapeSphericalFactory.h
inc/MantidDataObjects/PeaksWorkspace.h
inc/MantidDataObjects/LeanPeaksWorkspace.h
inc/MantidDataObjects/Lean
Elastic
PeaksWorkspace.h
inc/MantidDataObjects/RebinnedOutput.h
inc/MantidDataObjects/ReflectometryTransform.h
inc/MantidDataObjects/ScanningWorkspaceBuilder.h
...
...
@@ -185,7 +185,7 @@ set(TEST_FILES
PeakTest.h
LeanElasticPeakTest.h
PeaksWorkspaceTest.h
LeanPeaksWorkspaceTest.h
Lean
Elastic
PeaksWorkspaceTest.h
RebinnedOutputTest.h
RefAxisTest.h
ReflectometryTransformTest.h
...
...
Framework/DataObjects/inc/MantidDataObjects/LeanPeakColumn.h
→
Framework/DataObjects/inc/MantidDataObjects/Lean
Elastic
PeakColumn.h
View file @
66fdb835
...
...
@@ -7,7 +7,7 @@
#pragma once
#include
"MantidAPI/Column.h"
#include
"MantidDataObjects/LeanPeak.h"
#include
"MantidDataObjects/Lean
Elastic
Peak.h"
#include
<boost/variant.hpp>
#include
<list>
...
...
@@ -24,11 +24,11 @@ namespace DataObjects {
* @author Janik Zikovsky
* @date 2011-04-25 18:06:32.952258
*/
class
DLLExport
LeanPeakColumn
:
public
Mantid
::
API
::
Column
{
class
DLLExport
Lean
Elastic
PeakColumn
:
public
Mantid
::
API
::
Column
{
public:
/// Construct a column with a reference to the peaks list, a name & type
LeanPeakColumn
(
std
::
vector
<
LeanPeak
>
&
peaks
,
const
std
::
string
&
name
);
Lean
Elastic
PeakColumn
(
std
::
vector
<
Lean
Elastic
Peak
>
&
peaks
,
const
std
::
string
&
name
);
/// Number of individual elements in the column.
size_t
size
()
const
override
{
return
m_peaks
.
size
();
}
...
...
@@ -58,7 +58,7 @@ public:
long
int
sizeOfData
()
const
override
;
/// Clone.
LeanPeakColumn
*
clone
()
const
override
;
Lean
Elastic
PeakColumn
*
clone
()
const
override
;
/// Cast to double
double
toDouble
(
size_t
i
)
const
override
;
...
...
@@ -67,7 +67,7 @@ public:
void
fromDouble
(
size_t
i
,
double
value
)
override
;
/// Reference to the data.
const
std
::
vector
<
LeanPeak
>
&
data
()
const
{
return
m_peaks
;
}
const
std
::
vector
<
Lean
Elastic
Peak
>
&
data
()
const
{
return
m_peaks
;
}
bool
equals
(
const
Column
&
otherColumn
,
double
tolerance
)
const
override
{
(
void
)
otherColumn
;
...
...
@@ -90,7 +90,7 @@ protected:
private:
/// Reference to the peaks object saved in the PeaksWorkspace.
std
::
vector
<
LeanPeak
>
&
m_peaks
;
std
::
vector
<
Lean
Elastic
Peak
>
&
m_peaks
;
/// Precision of hkl in table workspace
int
m_hklPrec
;
...
...
Framework/DataObjects/inc/MantidDataObjects/LeanPeaksWorkspace.h
→
Framework/DataObjects/inc/MantidDataObjects/Lean
Elastic
PeaksWorkspace.h
View file @
66fdb835
...
...
@@ -9,8 +9,8 @@
#include
"MantidAPI/IPeaksWorkspace.h"
#include
"MantidAPI/ITableWorkspace.h"
#include
"MantidDataObjects/DllConfig.h"
#include
"MantidDataObjects/LeanPeak.h"
#include
"MantidDataObjects/LeanPeakColumn.h"
#include
"MantidDataObjects/Lean
Elastic
Peak.h"
#include
"MantidDataObjects/Lean
Elastic
PeakColumn.h"
#include
"MantidGeometry/Crystal/IPeak.h"
#include
"MantidKernel/SpecialCoordinateSystem.h"
#include
"MantidKernel/V3D.h"
...
...
@@ -26,24 +26,24 @@ class Logger;
namespace
DataObjects
{
//==========================================================================================
/** @class Mantid::DataObjects::LeanPeaksWorkspace
/** @class Mantid::DataObjects::Lean
Elastic
PeaksWorkspace
The class LeanPeaksWorkspace stores information about a set of SCD lean
The class Lean
Elastic
PeaksWorkspace stores information about a set of SCD lean
peaks.
@author Ruth Mikkelson, SNS ORNL
@date 3/10/2010
*/
class
MANTID_DATAOBJECTS_DLL
LeanPeaksWorkspace
class
MANTID_DATAOBJECTS_DLL
Lean
Elastic
PeaksWorkspace
:
public
Mantid
::
API
::
IPeaksWorkspace
{
public:
using
ColumnAndDirection
=
std
::
pair
<
std
::
string
,
bool
>
;
public:
const
std
::
string
id
()
const
override
{
return
"LeanPeaksWorkspace"
;
}
const
std
::
string
id
()
const
override
{
return
"Lean
Elastic
PeaksWorkspace"
;
}
LeanPeaksWorkspace
();
LeanPeaksWorkspace
&
operator
=
(
const
LeanPeaksWorkspace
&
other
)
=
delete
;
Lean
Elastic
PeaksWorkspace
();
Lean
Elastic
PeaksWorkspace
&
operator
=
(
const
Lean
Elastic
PeaksWorkspace
&
other
)
=
delete
;
/** Get access to shared pointer containing workspace porperties. This
function is there to provide common interface of iTableWorkspace
...
...
@@ -59,13 +59,13 @@ public:
API
::
LogManager_const_sptr
getLogs
()
const
override
;
/// Returns a clone of the workspace
std
::
unique_ptr
<
LeanPeaksWorkspace
>
clone
()
const
{
return
std
::
unique_ptr
<
LeanPeaksWorkspace
>
(
doClone
());
std
::
unique_ptr
<
Lean
Elastic
PeaksWorkspace
>
clone
()
const
{
return
std
::
unique_ptr
<
Lean
Elastic
PeaksWorkspace
>
(
doClone
());
}
/// Returns a default-initialized clone of the workspace
std
::
unique_ptr
<
LeanPeaksWorkspace
>
cloneEmpty
()
const
{
return
std
::
unique_ptr
<
LeanPeaksWorkspace
>
(
doCloneEmpty
());
std
::
unique_ptr
<
Lean
Elastic
PeaksWorkspace
>
cloneEmpty
()
const
{
return
std
::
unique_ptr
<
Lean
Elastic
PeaksWorkspace
>
(
doCloneEmpty
());
}
void
appendFile
(
std
::
string
filename
,
Geometry
::
Instrument_sptr
inst
);
...
...
@@ -82,11 +82,11 @@ public:
void
removePeaks
(
std
::
vector
<
int
>
badPeaks
)
override
;
void
addPeak
(
const
Geometry
::
IPeak
&
peak
)
override
;
/// Move a peak object into this peaks workspace
void
addPeak
(
LeanPeak
&&
peak
);
void
addPeak
(
Lean
Elastic
Peak
&&
peak
);
void
addPeak
(
const
Kernel
::
V3D
&
position
,
const
Kernel
::
SpecialCoordinateSystem
&
frame
)
override
;
LeanPeak
&
getPeak
(
int
peakNum
)
override
;
const
LeanPeak
&
getPeak
(
int
peakNum
)
const
override
;
Lean
Elastic
Peak
&
getPeak
(
int
peakNum
)
override
;
const
Lean
Elastic
Peak
&
getPeak
(
int
peakNum
)
const
override
;
std
::
unique_ptr
<
Geometry
::
IPeak
>
createPeak
(
const
Kernel
::
V3D
&
QLabFrame
,
...
...
@@ -104,8 +104,8 @@ public:
int
peakInfoNumber
(
const
Kernel
::
V3D
&
qFrame
,
bool
labCoords
)
const
override
;
std
::
vector
<
LeanPeak
>
&
getPeaks
();
const
std
::
vector
<
LeanPeak
>
&
getPeaks
()
const
;
std
::
vector
<
Lean
Elastic
Peak
>
&
getPeaks
();
const
std
::
vector
<
Lean
Elastic
Peak
>
&
getPeaks
()
const
;
bool
hasIntegratedPeaks
()
const
override
;
size_t
getMemorySize
()
const
override
;
...
...
@@ -169,14 +169,14 @@ public:
protected:
/// Protected copy constructor. May be used by childs for cloning.
LeanPeaksWorkspace
(
const
LeanPeaksWorkspace
&
other
);
Lean
Elastic
PeaksWorkspace
(
const
Lean
Elastic
PeaksWorkspace
&
other
);
private:
LeanPeaksWorkspace
*
doClone
()
const
override
{
return
new
LeanPeaksWorkspace
(
*
this
);
Lean
Elastic
PeaksWorkspace
*
doClone
()
const
override
{
return
new
Lean
Elastic
PeaksWorkspace
(
*
this
);
}
LeanPeaksWorkspace
*
doCloneEmpty
()
const
override
{
return
new
LeanPeaksWorkspace
();
Lean
Elastic
PeaksWorkspace
*
doCloneEmpty
()
const
override
{
return
new
Lean
Elastic
PeaksWorkspace
();
}
ITableWorkspace
*
doCloneColumns
(
const
std
::
vector
<
std
::
string
>
&
colNames
)
const
override
;
...
...
@@ -196,83 +196,83 @@ private:
API
::
Column_sptr
addColumn
(
const
std
::
string
&
/*type*/
,
const
std
::
string
&
/*name*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot add column."
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot add column."
);
}
bool
addColumns
(
const
std
::
string
&
/*type*/
,
const
std
::
string
&
/*name*/
,
size_t
/*n*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot add columns."
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot add columns."
);
}
void
removeColumn
(
const
std
::
string
&
/*name*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot remove column."
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot remove column."
);
}
void
setRowCount
(
size_t
/*count*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot setRowCount"
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot setRowCount"
);
}
size_t
insertRow
(
size_t
/*index*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot insertRow"
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot insertRow"
);
}
void
removeRow
(
size_t
/*index*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace structure is read-only. Cannot removeRow."
);
"Lean
Elastic
PeaksWorkspace structure is read-only. Cannot removeRow."
);
}
/// find method to get the index of integer cell value in a table workspace
void
find
(
size_t
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
/// find method to get the index of double cell value in a table workspace
void
find
(
double
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
/// find method to get the index of float cell value in a table workspace
void
find
(
float
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
/// find method to get the index of API::Boolean value cell in a table
/// workspace
void
find
(
API
::
Boolean
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
/// find method to get the index of cellstd::string value in a table
/// workspace
void
find
(
std
::
string
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
/// find method to get the index of Mantid::Kernel::V3D cell value in a table
/// workspace
void
find
(
Mantid
::
Kernel
::
V3D
/*value*/
,
size_t
&
/*row*/
,
const
size_t
&
/*col*/
)
override
{
throw
Mantid
::
Kernel
::
Exception
::
NotImplementedError
(
"LeanPeaksWorkspace::find() not implemented."
);
"Lean
Elastic
PeaksWorkspace::find() not implemented."
);
}
// ====================================== End ITableWorkspace Methods
// ==================================
/** Vector of Peak contained within. */
std
::
vector
<
LeanPeak
>
peaks
;
std
::
vector
<
Lean
Elastic
Peak
>
peaks
;
/** Column shared pointers. */
std
::
vector
<
std
::
shared_ptr
<
Mantid
::
DataObjects
::
LeanPeakColumn
>>
columns
;
std
::
vector
<
std
::
shared_ptr
<
Mantid
::
DataObjects
::
Lean
Elastic
PeakColumn
>>
columns
;
/** Column names */
std
::
vector
<
std
::
string
>
columnNames
;
...
...
@@ -282,9 +282,9 @@ private:
};
/// Typedef for a shared pointer to a peaks workspace.
using
LeanPeaksWorkspace_sptr
=
std
::
shared_ptr
<
LeanPeaksWorkspace
>
;
using
Lean
Elastic
PeaksWorkspace_sptr
=
std
::
shared_ptr
<
Lean
Elastic
PeaksWorkspace
>
;
/// Typedef for a shared pointer to a const peaks workspace.
using
LeanPeaksWorkspace_const_sptr
=
std
::
shared_ptr
<
const
LeanPeaksWorkspace
>
;
using
Lean
Elastic
PeaksWorkspace_const_sptr
=
std
::
shared_ptr
<
const
Lean
Elastic
PeaksWorkspace
>
;
}
// namespace DataObjects
}
// namespace Mantid
Framework/DataObjects/src/LeanPeakColumn.cpp
→
Framework/DataObjects/src/Lean
Elastic
PeakColumn.cpp
View file @
66fdb835
...
...
@@ -4,7 +4,7 @@
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidDataObjects/LeanPeakColumn.h"
#include
"MantidDataObjects/Lean
Elastic
PeakColumn.h"
#include
"MantidKernel/ConfigService.h"
#include
"MantidKernel/Exception.h"
#include
"MantidKernel/MultiThreaded.h"
...
...
@@ -19,7 +19,7 @@ namespace Mantid {
namespace
DataObjects
{
namespace
{
/// static logger
Kernel
::
Logger
g_log
(
"LeanPeakColumn"
);
Kernel
::
Logger
g_log
(
"Lean
Elastic
PeakColumn"
);
/// Number of items to keep around in the cell cache (see void_pointer())
size_t
NCELL_ITEM_CACHED
=
100
;
...
...
@@ -71,10 +71,10 @@ const std::string typeFromName(const std::string &name) {
if
(
iter
!=
typeIndex
.
data
().
end
())
{
return
iter
->
second
;
}
else
{
throw
std
::
runtime_error
(
"LeanPeakColumn - Unknown column name:
\"
"
+
name
+
throw
std
::
runtime_error
(
"Lean
Elastic
PeakColumn - Unknown column name:
\"
"
+
name
+
"
\"
"
"Peak column names/types must be explicitly "
"marked in LeanPeakColumn.cpp"
);
"marked in Lean
Elastic
PeakColumn.cpp"
);
}
}
}
// namespace
...
...
@@ -84,24 +84,24 @@ const std::string typeFromName(const std::string &name) {
* @param peaks :: vector of peaks
* @param name :: name for the column
*/
LeanPeakColumn
::
LeanPeakColumn
(
std
::
vector
<
LeanPeak
>
&
peaks
,
Lean
Elastic
PeakColumn
::
Lean
Elastic
PeakColumn
(
std
::
vector
<
Lean
Elastic
Peak
>
&
peaks
,
const
std
::
string
&
name
)
:
m_peaks
(
peaks
),
m_oldRows
()
{
this
->
m_name
=
name
;
this
->
m_type
=
typeFromName
(
name
);
// Throws if the name is unknown
const
std
::
string
key
=
"LeanPeakColumn.hklPrec"
;
const
std
::
string
key
=
"Lean
Elastic
PeakColumn.hklPrec"
;
auto
hklPrec
=
ConfigService
::
Instance
().
getValue
<
int
>
(
key
);
this
->
m_hklPrec
=
hklPrec
.
get_value_or
(
2
);
if
(
!
hklPrec
.
is_initialized
())
{
g_log
.
information
()
<<
"In LeanPeakColumn constructor, did not find any value for '"
<<
key
<<
"In Lean
Elastic
PeakColumn constructor, did not find any value for '"
<<
key
<<
"' from the Config Service. Using default: "
<<
this
->
m_hklPrec
<<
"
\n
"
;
}
}
/// Returns typeid for the data in the column
const
std
::
type_info
&
LeanPeakColumn
::
get_type_info
()
const
{
const
std
::
type_info
&
Lean
Elastic
PeakColumn
::
get_type_info
()
const
{
// This is horrible copy-and-paste with the method below. The whole thing
// around columns could be much better implemented using templates & traits to
// avoid this
...
...
@@ -117,12 +117,12 @@ const std::type_info &LeanPeakColumn::get_type_info() const {
return
typeid
(
V3D
);
}
else
{
throw
std
::
runtime_error
(
"LeanPeakColumn::get_type_info() - Unknown column type: "
+
m_name
);
"Lean
Elastic
PeakColumn::get_type_info() - Unknown column type: "
+
m_name
);
}
}
/// Returns typeid for the pointer type to the data element in the column
const
std
::
type_info
&
LeanPeakColumn
::
get_pointer_type_info
()
const
{
const
std
::
type_info
&
Lean
Elastic
PeakColumn
::
get_pointer_type_info
()
const
{
if
(
type
()
==
"double"
)
{
return
typeid
(
double
*
);
}
else
if
(
type
()
==
"int"
)
{
...
...
@@ -132,7 +132,7 @@ const std::type_info &LeanPeakColumn::get_pointer_type_info() const {
}
else
if
(
type
()
==
"V3D"
)
{
return
typeid
(
V3D
*
);
}
else
{
throw
std
::
runtime_error
(
"LeanPeakColumn::get_pointer_type_info() -: "
+
throw
std
::
runtime_error
(
"Lean
Elastic
PeakColumn::get_pointer_type_info() -: "
+
m_name
);
}
}
...
...
@@ -143,8 +143,8 @@ const std::type_info &LeanPeakColumn::get_pointer_type_info() const {
* @param s :: stream to output
* @param index :: row index
*/
void
LeanPeakColumn
::
print
(
size_t
index
,
std
::
ostream
&
s
)
const
{
LeanPeak
&
peak
=
m_peaks
[
index
];
void
Lean
Elastic
PeakColumn
::
print
(
size_t
index
,
std
::
ostream
&
s
)
const
{
Lean
Elastic
Peak
&
peak
=
m_peaks
[
index
];
s
.
imbue
(
std
::
locale
(
"C"
));
std
::
ios
::
fmtflags
fflags
(
s
.
flags
());
if
(
m_name
==
"RunNumber"
)
...
...
@@ -176,7 +176,7 @@ void LeanPeakColumn::print(size_t index, std::ostream &s) const {
* @param text :: string to read
* @param index :: index of the peak to modify
*/
void
LeanPeakColumn
::
read
(
size_t
index
,
const
std
::
string
&
text
)
{
void
Lean
Elastic
PeakColumn
::
read
(
size_t
index
,
const
std
::
string
&
text
)
{
// Don't modify read-only ones
if
(
this
->
getReadOnly
()
||
index
>=
m_peaks
.
size
())
return
;
...
...
@@ -197,7 +197,7 @@ void LeanPeakColumn::read(size_t index, const std::string &text) {
* @param index :: index of the peak to modify
* @param in :: input stream
*/
void
LeanPeakColumn
::
read
(
const
size_t
index
,
std
::
istringstream
&
in
)
{
void
Lean
Elastic
PeakColumn
::
read
(
const
size_t
index
,
std
::
istringstream
&
in
)
{
if
(
this
->
getReadOnly
()
||
index
>=
m_peaks
.
size
())
return
;
...
...
@@ -215,19 +215,19 @@ void LeanPeakColumn::read(const size_t index, std::istringstream &in) {
//-------------------------------------------------------------------------------------
/** @return true if the column is read-only */
bool
LeanPeakColumn
::
getReadOnly
()
const
{
bool
Lean
Elastic
PeakColumn
::
getReadOnly
()
const
{
return
!
((
m_name
==
"h"
)
||
(
m_name
==
"k"
)
||
(
m_name
==
"l"
)
||
(
m_name
==
"RunNumber"
));
}
//-------------------------------------------------------------------------------------
/// Specialized type check
bool
LeanPeakColumn
::
isBool
()
const
{
return
false
;
}
bool
Lean
Elastic
PeakColumn
::
isBool
()
const
{
return
false
;
}
bool
LeanPeakColumn
::
isNumber
()
const
{
return
false
;
}
bool
Lean
Elastic
PeakColumn
::
isNumber
()
const
{
return
false
;
}
/// @returns overall memory size taken by the column.
long
int
LeanPeakColumn
::
sizeOfData
()
const
{
long
int
Lean
Elastic
PeakColumn
::
sizeOfData
()
const
{
return
sizeof
(
double
)
*
static_cast
<
long
int
>
(
m_peaks
.
size
());
}
...
...
@@ -237,9 +237,9 @@ long int LeanPeakColumn::sizeOfData() const {
* @param count :: Count of new column size (unused)
* @throw Exception::NotImplementedError
*/
void
LeanPeakColumn
::
resize
(
size_t
count
)
{
void
Lean
Elastic
PeakColumn
::
resize
(
size_t
count
)
{
UNUSED_ARG
(
count
);
throw
Exception
::
NotImplementedError
(
"LeanPeakColumn::resize - Peaks must be "
throw
Exception
::
NotImplementedError
(
"Lean
Elastic
PeakColumn::resize - Peaks must be "
"added through the PeaksWorkspace "
"interface."
);
}
...
...
@@ -250,9 +250,9 @@ void LeanPeakColumn::resize(size_t count) {
* @param index :: The new index position (unused)
* @throw Exception::NotImplementedError
*/
void
LeanPeakColumn
::
insert
(
size_t
index
)
{
void
Lean
Elastic
PeakColumn
::
insert
(
size_t
index
)
{
UNUSED_ARG
(
index
);
throw
Exception
::
NotImplementedError
(
"LeanPeakColumn::insert - Peaks must be "
throw
Exception
::
NotImplementedError
(
"Lean
Elastic
PeakColumn::insert - Peaks must be "
"inserted through the PeaksWorkspace "
"interface."
);
}
...
...
@@ -263,9 +263,9 @@ void LeanPeakColumn::insert(size_t index) {
* @param index :: The index position removed(unused)
* @throw Exception::NotImplementedError
*/
void
LeanPeakColumn
::
remove
(
size_t
index
)
{
void
Lean
Elastic
PeakColumn
::
remove
(
size_t
index
)
{
UNUSED_ARG
(
index
);
throw
Exception
::
NotImplementedError
(
"LeanPeakColumn::remove - Peaks must be "
throw
Exception
::
NotImplementedError
(
"Lean
Elastic
PeakColumn::remove - Peaks must be "
"remove through the PeaksWorkspace "
"interface."
);
}
...
...
@@ -275,8 +275,8 @@ void LeanPeakColumn::remove(size_t index) {
* @param index :: A row index pointing to the PeaksWorkspace
* @returns A pointer to the data element at that index from this column
*/
void
*
LeanPeakColumn
::
void_pointer
(
size_t
index
)
{
const
auto
*
constThis
=
const_cast
<
const
LeanPeakColumn
*>
(
this
);
void
*
Lean
Elastic
PeakColumn
::
void_pointer
(
size_t
index
)
{
const
auto
*
constThis
=
const_cast
<
const
Lean
Elastic
PeakColumn
*>
(
this
);
return
const_cast
<
void
*>
(
constThis
->
void_pointer
(
index
));
}
...
...
@@ -285,8 +285,8 @@ void *LeanPeakColumn::void_pointer(size_t index) {
* @param index :: A row index pointing to the PeaksWorkspace
* @returns A pointer to the data element at that index from this column
*/
const
void
*
LeanPeakColumn
::
void_pointer
(
size_t
index
)
const
{
const
LeanPeak
&
peak
=
m_peaks
[
index
];
const
void
*
Lean
Elastic
PeakColumn
::
void_pointer
(
size_t
index
)
const
{
const
Lean
Elastic
Peak
&
peak
=
m_peaks
[
index
];
// The cell() api requires that the value exist somewhere in memory, however,
// some of the values from a Peak are calculated on the fly so a reference
...
...
@@ -327,26 +327,26 @@ const void *LeanPeakColumn::void_pointer(size_t index) const {
}
}
LeanPeakColumn
*
LeanPeakColumn
::
clone
()
const
{
auto
temp
=
new
LeanPeakColumn
(
this
->
m_peaks
,
this
->
m_name
);
Lean
Elastic
PeakColumn
*
Lean
Elastic
PeakColumn
::
clone
()
const
{
auto
temp
=
new
Lean
Elastic
PeakColumn
(
this
->
m_peaks
,
this
->
m_name
);
return
temp
;
}
double
LeanPeakColumn
::
toDouble
(
size_t
/*index*/
)
const
{
double
Lean
Elastic
PeakColumn
::
toDouble
(
size_t
/*index*/
)
const
{
throw
std
::
runtime_error
(
"LeanPeakColumn::toDouble() not implemented, LeanPeakColumn "
"Lean
Elastic
PeakColumn::toDouble() not implemented, Lean
Elastic
PeakColumn "
"is has no general write access"
);
}
void
LeanPeakColumn
::
fromDouble
(
size_t
/*index*/
,
double
/*value*/
)
{
void
Lean
Elastic
PeakColumn
::
fromDouble
(
size_t
/*index*/
,
double
/*value*/
)
{
throw
std
::
runtime_error
(
"fromDouble() not implemented, LeanPeakColumn is has no "
"fromDouble() not implemented, Lean
Elastic
PeakColumn is has no "
"general write access"
);
}
void
LeanPeakColumn
::
setPeakHKLOrRunNumber
(
const
size_t
index
,
void
Lean
Elastic
PeakColumn
::
setPeakHKLOrRunNumber
(
const
size_t
index
,
const
double
val
)
{
LeanPeak
&
peak
=
m_peaks
[
index
];
Lean
Elastic
Peak
&
peak
=
m_peaks
[
index
];
if
(
m_name
==
"h"
)
peak
.
setH
(
val
);
else
if
(
m_name
==
"k"
)
...
...
Framework/DataObjects/src/LeanPeaksWorkspace.cpp
→
Framework/DataObjects/src/Lean
Elastic
PeaksWorkspace.cpp
View file @
66fdb835
...
...
@@ -4,7 +4,7 @@
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidDataObjects/LeanPeaksWorkspace.h"
#include
"MantidDataObjects/Lean
Elastic
PeaksWorkspace.h"
#include
"MantidAPI/Run.h"
#include
"MantidAPI/Sample.h"
#include
"MantidAPI/WorkspaceFactory.h"
...
...
@@ -28,33 +28,33 @@ using namespace Mantid::Geometry;
namespace
Mantid
{
namespace
DataObjects
{
/// Register the workspace as a type
DECLARE_WORKSPACE
(
LeanPeaksWorkspace
)
DECLARE_WORKSPACE
(
Lean
Elastic
PeaksWorkspace
)
//---------------------------------------------------------------------------------------------
/** Constructor. Create a table with all the required columns.
*
* @return LeanPeaksWorkspace object
* @return Lean
Elastic
PeaksWorkspace object
*/
LeanPeaksWorkspace
::
LeanPeaksWorkspace
()
Lean
Elastic
PeaksWorkspace
::
Lean
Elastic
PeaksWorkspace
()
:
IPeaksWorkspace
(),
peaks
(),
columns
(),
columnNames
(),
m_coordSystem
(
None
)
{
initColumns
();
// LeanPeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
// Lean
Elastic
PeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
setNumberOfDetectorGroups
(
0
);
}
//---------------------------------------------------------------------------------------------
/** Copy constructor
*
* @param other :: other LeanPeaksWorkspace to copy from
* @param other :: other Lean
Elastic
PeaksWorkspace to copy from
*/
// LeanPeaksWorkspace::LeanPeaksWorkspace(const LeanPeaksWorkspace &other) =
// Lean
Elastic
PeaksWorkspace::Lean
Elastic
PeaksWorkspace(const Lean
Elastic
PeaksWorkspace &other) =
// default;
LeanPeaksWorkspace
::
LeanPeaksWorkspace
(
const
LeanPeaksWorkspace
&
other
)
Lean
Elastic
PeaksWorkspace
::
Lean
Elastic
PeaksWorkspace
(
const
Lean
Elastic
PeaksWorkspace
&
other
)
:
IPeaksWorkspace
(
other
),
peaks
(
other
.
peaks
),
columns
(),
columnNames
(),
m_coordSystem
(
other
.
m_coordSystem
)
{
initColumns
();
// LeanPeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
// Lean
Elastic
PeaksWorkspace does not use the grouping mechanism of ExperimentInfo.
setNumberOfDetectorGroups
(
0
);
}
...
...
@@ -62,7 +62,7 @@ LeanPeaksWorkspace::LeanPeaksWorkspace(const LeanPeaksWorkspace &other)
*/
class
PeakComparator
{
public:
using
ColumnAndDirection
=
LeanPeaksWorkspace
::
ColumnAndDirection
;
using
ColumnAndDirection
=
Lean
Elastic
PeaksWorkspace
::
ColumnAndDirection
;
std
::
vector
<
ColumnAndDirection
>
&
criteria
;
/** Constructor for the comparator for sorting peaks
...
...
@@ -73,7 +73,7 @@ public:
:
criteria
(
criteria
)
{}
/** Compare two peaks using the stored criteria */
inline
bool
operator
()(
const
LeanPeak
&
a
,
const
LeanPeak
&
b
)
{
inline
bool
operator
()(
const
Lean
Elastic
Peak
&
a
,
const
Lean
Elastic
Peak
&
b
)
{
for
(
const
auto
&
name
:
criteria
)
{
const
auto
&
col
=
name
.
first
;
const
bool
ascending
=
name
.
second
;
...
...
@@ -114,7 +114,7 @@ public:
* The peaks are sorted by the first criterion first, then the 2nd if
*equal, etc.
*/
void
LeanPeaksWorkspace
::
sort
(
std
::
vector
<
ColumnAndDirection
>
&
criteria
)
{
void
Lean
Elastic
PeaksWorkspace
::
sort
(
std
::
vector
<
ColumnAndDirection
>
&
criteria
)
{
PeakComparator
comparator
(
criteria
);
std
::
stable_sort
(
peaks
.
begin
(),
peaks
.
end
(),
comparator
);