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
c97d33c7
Commit
c97d33c7
authored
Mar 16, 2015
by
Gigg, Martyn Anthony
Browse files
Formatting changes before the real changes.
Refs #11359
parent
e053866e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
View file @
c97d33c7
...
...
@@ -55,10 +55,6 @@ public:
/// Destructor
virtual
~
IPeaksWorkspace
();
// boost::shared_ptr<IPeaksWorkspace> clone() = 0;
// void appendFile( std::string filename, Mantid::Geometry::Instrument_sptr
// inst) = 0;
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
...
...
@@ -99,14 +95,15 @@ public:
//---------------------------------------------------------------------------------------------
/** Create an instance of a Peak
* @param QLabFrame :: Q of the center of the peak in the lab frame, in reciprocal space
* @param detectorDistance :: Optional distance between the sample and the detector. Calculated if not provided.
* @param QLabFrame :: Q of the center of the peak in the lab frame, in
* reciprocal space
* @param detectorDistance :: Optional distance between the sample and the
* detector. Calculated if not provided.
* @return a pointer to a new Peak object.
*/
virtual
IPeak
*
createPeak
(
Mantid
::
Kernel
::
V3D
QLabFrame
,
boost
::
optional
<
double
>
detectorDistance
)
const
=
0
;
/**
* Create an instance of a peak using a V3D
* @param HKL V3D
...
...
@@ -136,16 +133,16 @@ public:
* @param coordinateSystem : Special Q3D coordinate system to use.
*/
virtual
void
setCoordinateSystem
(
const
Mantid
::
Kernel
::
SpecialCoordinateSystem
coordinateSystem
)
=
0
;
const
Kernel
::
SpecialCoordinateSystem
coordinateSystem
)
=
0
;
//---------------------------------------------------------------------------------------------
/**
* Get the special coordinate system.
* @returns special Q3D coordinate system to use being used by this
* PeaksWorkspace object. Probably the one the workspace was generated with.
*/
virtual
Mantid
::
Kernel
::
SpecialCoordinateSystem
virtual
Kernel
::
SpecialCoordinateSystem
getSpecialCoordinateSystem
()
const
=
0
;
virtual
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
peakInfo
(
Kernel
::
V3D
QFrame
,
bool
labCoords
)
const
=
0
;
virtual
int
peakInfoNumber
(
Kernel
::
V3D
qLabFrame
,
bool
labCoords
)
const
=
0
;
...
...
Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
View file @
c97d33c7
...
...
@@ -109,11 +109,11 @@ public:
const
Peak
&
getPeak
(
int
peakNum
)
const
;
API
::
IPeak
*
createPeak
(
Kernel
::
V3D
QFrame
,
boost
::
optional
<
double
>
detectorDistance
=
boost
::
optional
<
double
>
())
const
;
boost
::
optional
<
double
>
detectorDistance
=
boost
::
optional
<
double
>
())
const
;
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
peakInfo
(
Kernel
::
V3D
qFrame
,
bool
labCoords
)
const
;
Peak
*
createPeakHKL
(
Kernel
::
V3D
HKL
)
const
;
int
peakInfoNumber
(
Kernel
::
V3D
qFrame
,
bool
labCoords
)
const
;
...
...
@@ -129,12 +129,11 @@ public:
API
::
ITableWorkspace_sptr
createDetectorTable
()
const
;
/// Set the special coordinate system.
virtual
void
setCoordinateSystem
(
const
Mantid
::
Kernel
::
SpecialCoordinateSystem
coordinateSystem
);
virtual
void
setCoordinateSystem
(
const
Kernel
::
SpecialCoordinateSystem
coordinateSystem
);
/// Get the special coordinate system.
virtual
Mantid
::
Kernel
::
SpecialCoordinateSystem
getSpecialCoordinateSystem
()
const
;
Kernel
::
SpecialCoordinateSystem
getSpecialCoordinateSystem
()
const
;
// ====================================== ITableWorkspace Methods
// ==================================
...
...
@@ -183,15 +182,6 @@ public:
void
saveNexus
(
::
NeXus
::
File
*
file
)
const
;
private:
/** Vector of Peak contained within. */
std
::
vector
<
Peak
>
peaks
;
/** Column shared pointers. */
std
::
vector
<
boost
::
shared_ptr
<
Mantid
::
DataObjects
::
PeakColumn
>>
columns
;
/** Column names */
std
::
vector
<
std
::
string
>
columnNames
;
/// Initialize the table structure
void
initColumns
();
/// Adds a new PeakColumn of the given type
...
...
@@ -275,6 +265,15 @@ private:
// ====================================== End ITableWorkspace Methods
// ==================================
/** Vector of Peak contained within. */
std
::
vector
<
Peak
>
peaks
;
/** Column shared pointers. */
std
::
vector
<
boost
::
shared_ptr
<
Mantid
::
DataObjects
::
PeakColumn
>>
columns
;
/** Column names */
std
::
vector
<
std
::
string
>
columnNames
;
// adapter for logs() function, which create reference to this class itself
// and does not allow to delete the shared pointers,
// returned by logs() function when they go out of scope
...
...
Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
View file @
c97d33c7
...
...
@@ -199,11 +199,13 @@ const Peak &PeaksWorkspace::getPeak(const int peakNum) const {
//---------------------------------------------------------------------------------------------
/** Creates an instance of a Peak BUT DOES NOT ADD IT TO THE WORKSPACE
* @param QLabFrame :: Q of the center of the peak, in reciprocal space
* @param detectorDistance :: optional distance between the sample and the detector. You do NOT need to explicitly provide this distance.
* @param detectorDistance :: optional distance between the sample and the
* detector. You do NOT need to explicitly provide this distance.
* @return a pointer to a new Peak object.
*/
API
::
IPeak
*
PeaksWorkspace
::
createPeak
(
Kernel
::
V3D
QLabFrame
,
boost
::
optional
<
double
>
detectorDistance
)
const
{
API
::
IPeak
*
PeaksWorkspace
::
createPeak
(
Kernel
::
V3D
QLabFrame
,
boost
::
optional
<
double
>
detectorDistance
)
const
{
return
new
Peak
(
this
->
getInstrument
(),
QLabFrame
,
detectorDistance
);
}
...
...
@@ -395,31 +397,33 @@ PeaksWorkspace::peakInfo(Kernel::V3D qFrame, bool labCoords) const {
* @param HKL : reciprocal lattice vector coefficients
* @return Fully formed peak.
*/
Peak
*
PeaksWorkspace
::
createPeakHKL
(
V3D
HKL
)
const
{
/*
The following allows us to add peaks where we have a single UB to work from.
*/
Peak
*
PeaksWorkspace
::
createPeakHKL
(
V3D
HKL
)
const
{
/*
The following allows us to add peaks where we have a single UB to work from.
*/
Geometry
::
OrientedLattice
lattice
=
this
->
sample
().
getOrientedLattice
();
Geometry
::
Goniometer
goniometer
=
this
->
run
().
getGoniometer
();
Geometry
::
OrientedLattice
lattice
=
this
->
sample
().
getOrientedLattice
();
Geometry
::
Goniometer
goniometer
=
this
->
run
().
getGoniometer
();
// Calculate qLab from q HKL. As per Busing and Levy 1967, q_lab_frame = 2pi * Goniometer * UB * HKL
V3D
qLabFrame
=
goniometer
.
getR
()
*
lattice
.
getUB
()
*
HKL
*
2
*
M_PI
;
// Calculate qLab from q HKL. As per Busing and Levy 1967, q_lab_frame = 2pi *
// Goniometer * UB * HKL
V3D
qLabFrame
=
goniometer
.
getR
()
*
lattice
.
getUB
()
*
HKL
*
2
*
M_PI
;
// create a peak using the qLab frame
auto
peak
=
new
Peak
(
this
->
getInstrument
(),
qLabFrame
);
// This should calculate the detector positions too.
// create a peak using the qLab frame
auto
peak
=
new
Peak
(
this
->
getInstrument
(),
qLabFrame
);
// This should calculate the detector positions too.
// We need to set HKL separately to keep things consistent.
peak
->
setHKL
(
HKL
[
0
],
HKL
[
1
],
HKL
[
2
]);
// We need to set HKL separately to keep things consistent.
peak
->
setHKL
(
HKL
[
0
],
HKL
[
1
],
HKL
[
2
]);
// Set the goniometer
peak
->
setGoniometerMatrix
(
goniometer
.
getR
());
// Set the goniometer
peak
->
setGoniometerMatrix
(
goniometer
.
getR
());
// Take the run number from this
peak
->
setRunNumber
(
this
->
getRunNumber
());
// Take the run number from this
peak
->
setRunNumber
(
this
->
getRunNumber
());
return
peak
;
return
peak
;
}
/**
...
...
@@ -652,9 +656,8 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
}
const
std
::
string
shapeJSON
=
p
.
getPeakShape
().
toJSON
();
shapes
[
i
]
=
shapeJSON
;
if
(
shapeJSON
.
size
()
>
maxShapeJSONLength
)
{
maxShapeJSONLength
=
shapeJSON
.
size
();
if
(
shapeJSON
.
size
()
>
maxShapeJSONLength
)
{
maxShapeJSONLength
=
shapeJSON
.
size
();
}
}
...
...
@@ -801,7 +804,8 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
std
::
string
rowStr
=
shapes
[
ii
];
for
(
size_t
ic
=
0
;
ic
<
rowStr
.
size
();
ic
++
)
toNexus
[
ii
*
maxShapeJSONLength
+
ic
]
=
rowStr
[
ic
];
for
(
size_t
ic
=
rowStr
.
size
();
ic
<
static_cast
<
size_t
>
(
maxShapeJSONLength
);
ic
++
)
for
(
size_t
ic
=
rowStr
.
size
();
ic
<
static_cast
<
size_t
>
(
maxShapeJSONLength
);
ic
++
)
toNexus
[
ii
*
maxShapeJSONLength
+
ic
]
=
' '
;
}
...
...
@@ -813,7 +817,6 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
file
->
putAttr
(
"interpret_as"
,
specifyString
);
file
->
closeData
();
// QLab & QSample are calculated and do not need to be saved
file
->
closeGroup
();
// end of peaks workpace
...
...
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