Commit c97d33c7 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Formatting changes before the real changes.

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