Skip to content

Commit

Permalink
Merge pull request #824 from mantidproject/11868_relocate
Browse files Browse the repository at this point in the history
Move Peak Classes to Geometry Crystal Subpackage
  • Loading branch information
martyngigg committed Jun 1, 2015
2 parents 5240467 + 7d5b55b commit 708c0cf
Show file tree
Hide file tree
Showing 104 changed files with 323 additions and 289 deletions.
18 changes: 0 additions & 18 deletions Code/Mantid/Framework/API/CMakeLists.txt
Expand Up @@ -63,7 +63,6 @@ set ( SRC_FILES
src/IMDIterator.cpp
src/IMDWorkspace.cpp
src/IPawleyFunction.cpp
src/IPeak.cpp
src/IPeakFunction.cpp
src/IPeaksWorkspace.cpp
src/IPowderDiffPeakFunction.cpp
Expand Down Expand Up @@ -99,11 +98,6 @@ set ( SRC_FILES
src/ParameterReference.cpp
src/ParameterTie.cpp
src/PeakFunctionIntegrator.cpp
src/PeakTransform.cpp
src/PeakTransformHKL.cpp
src/PeakTransformQLab.cpp
src/PeakTransformQSample.cpp
src/PeakTransformSelector.cpp
src/Progress.cpp
src/Projection.cpp
src/PropertyManagerDataService.cpp
Expand Down Expand Up @@ -165,7 +159,6 @@ set ( INC_FILES
inc/MantidAPI/CompositeDomain.h
inc/MantidAPI/CompositeDomainMD.h
inc/MantidAPI/CompositeFunction.h
inc/MantidAPI/ConcretePeakTransformFactory.h
inc/MantidAPI/ConstraintFactory.h
inc/MantidAPI/CoordTransform.h
inc/MantidAPI/CostFunctionFactory.h
Expand Down Expand Up @@ -223,7 +216,6 @@ set ( INC_FILES
inc/MantidAPI/IMDWorkspace.h
inc/MantidAPI/IMaskWorkspace.h
inc/MantidAPI/IPawleyFunction.h
inc/MantidAPI/IPeak.h
inc/MantidAPI/IPeakFunction.h
inc/MantidAPI/IPeaksWorkspace.h
inc/MantidAPI/IPowderDiffPeakFunction.h
Expand Down Expand Up @@ -267,12 +259,6 @@ set ( INC_FILES
inc/MantidAPI/ParameterReference.h
inc/MantidAPI/ParameterTie.h
inc/MantidAPI/PeakFunctionIntegrator.h
inc/MantidAPI/PeakTransform.h
inc/MantidAPI/PeakTransformFactory.h
inc/MantidAPI/PeakTransformHKL.h
inc/MantidAPI/PeakTransformQLab.h
inc/MantidAPI/PeakTransformQSample.h
inc/MantidAPI/PeakTransformSelector.h
inc/MantidAPI/Progress.h
inc/MantidAPI/Projection.h
inc/MantidAPI/PropertyManagerDataService.h
Expand Down Expand Up @@ -370,10 +356,6 @@ set ( TEST_FILES
ParameterReferenceTest.h
ParameterTieTest.h
PeakFunctionIntegratorTest.h
PeakTransformHKLTest.h
PeakTransformQLabTest.h
PeakTransformQSampleTest.h
PeakTransformSelectorTest.h
ProjectionTest.h
PropertyManagerDataServiceTest.h
PropertyNexusTest.h
Expand Down
20 changes: 11 additions & 9 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
@@ -1,5 +1,5 @@
#ifndef MANTID_API_IPEAKSPACE_H_
#define MANTID_API_IPEAKSPACE_H_ 1
#define MANTID_API_IPEAKSPACE_H_

//----------------------------------------------------------------------
// Includes
Expand All @@ -10,9 +10,11 @@
#include <boost/optional.hpp>

namespace Mantid {

namespace API {
namespace Geometry {
class IPeak;
}
namespace API {


//==========================================================================================
/** Interface to the class Mantid::DataObjects::PeaksWorkspace
Expand Down Expand Up @@ -70,28 +72,28 @@ class MANTID_API_DLL IPeaksWorkspace : public ITableWorkspace,
/** Add a peak to the list
* @param ipeak :: Peak object to add (copy) into this.
*/
virtual void addPeak(const IPeak &ipeak) = 0;
virtual void addPeak(const Mantid::Geometry::IPeak &ipeak) = 0;

//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak
* @param peakNum :: index of the peak to get.
* @return a reference to a Peak object.
*/
virtual IPeak &getPeak(int peakNum) = 0;
virtual Mantid::Geometry::IPeak &getPeak(int peakNum) = 0;

//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak (const version)
* @param peakNum :: index of the peak to get.
* @return a reference to a Peak object.
*/
virtual const IPeak &getPeak(int peakNum) const = 0;
virtual const Mantid::Geometry::IPeak &getPeak(int peakNum) const = 0;

//---------------------------------------------------------------------------------------------
/** Return a pointer to the Peak
* @param peakNum :: index of the peak to get.
* @return a pointer to a Peak object.
*/
IPeak *getPeakPtr(const int peakNum) { return &this->getPeak(peakNum); }
Mantid::Geometry::IPeak *getPeakPtr(const int peakNum) { return &this->getPeak(peakNum); }

//---------------------------------------------------------------------------------------------
/** Create an instance of a Peak
Expand All @@ -101,15 +103,15 @@ class MANTID_API_DLL IPeaksWorkspace : public ITableWorkspace,
* detector. Calculated if not provided.
* @return a pointer to a new Peak object.
*/
virtual IPeak *createPeak(Mantid::Kernel::V3D QLabFrame,
virtual Mantid::Geometry::IPeak *createPeak(Mantid::Kernel::V3D QLabFrame,
boost::optional<double> detectorDistance) const = 0;

/**
* Create an instance of a peak using a V3D
* @param HKL V3D
* @return a pointer to a new Peak object.
*/
virtual IPeak *createPeakHKL(Mantid::Kernel::V3D HKL) const = 0;
virtual Mantid::Geometry::IPeak *createPeakHKL(Mantid::Kernel::V3D HKL) const = 0;

//---------------------------------------------------------------------------------------------
/** Determine if the workspace has been integrated using a peaks integration
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/AddPeak.cpp
@@ -1,7 +1,7 @@
#include "MantidAlgorithms/AddPeak.h"
#include "MantidKernel/System.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IPeak.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidAPI/MatrixWorkspace.h"

using namespace Mantid::PhysicalConstants;
Expand Down Expand Up @@ -112,7 +112,7 @@ void AddPeak::exec() {
Qy *= knorm;
Qz *= knorm;

Mantid::API::IPeak *peak =
Mantid::Geometry::IPeak *peak =
peaksWS->createPeak(Mantid::Kernel::V3D(Qx, Qy, Qz), l2);
peak->setDetectorID(detID);
peak->setGoniometerMatrix(runWS->run().getGoniometer().getR());
Expand Down
@@ -1,12 +1,13 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidGeometry/Crystal/IPeak.h"

#include "MantidAlgorithms/CheckWorkspacesMatch.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/WorkspaceGroup.h"
#include "MantidAPI/IPeak.h"
#include "MantidAPI/NumericAxis.h"
#include "MantidAPI/TableRow.h"
#include "MantidDataObjects/EventWorkspace.h"
Expand Down
Expand Up @@ -8,7 +8,7 @@
#define INTEGRATEPEAKTIMESLICES_H_

#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IPeak.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
Expand Down Expand Up @@ -287,11 +287,11 @@ class DLLExport IntegratePeakTimeSlices : public Mantid::API::Algorithm {
bool getNeighborPixIDs(boost::shared_ptr<Geometry::IComponent> comp,
Kernel::V3D &Center, double &Radius, int *&ArryofID);

int CalculateTimeChannelSpan(API::IPeak const &peak, const double dQ,
int CalculateTimeChannelSpan(Geometry::IPeak const &peak, const double dQ,
Mantid::MantidVec const &X, const int specNum,
int &Centerchan);

double CalculatePositionSpan(API::IPeak const &peak, const double dQ);
double CalculatePositionSpan(Geometry::IPeak const &peak, const double dQ);

void InitializeColumnNamesInTableWorkspace(
DataObjects::TableWorkspace_sptr &TabWS);
Expand Down Expand Up @@ -354,7 +354,7 @@ class DLLExport IntegratePeakTimeSlices : public Mantid::API::Algorithm {
void FindPlane(Kernel::V3D &center, Kernel::V3D &xvec, Kernel::V3D &yvec,
double &ROW, double &COL, int &NROWS, int &NCOLS,
double &pixWidthx, double &pixHeighty,
API::IPeak const &peak) const;
Geometry::IPeak const &peak) const;

int find(Mantid::MantidVec const &X, const double time);

Expand Down
Expand Up @@ -10,7 +10,7 @@
#include <boost/function.hpp>

namespace Mantid {
namespace API {
namespace Geometry {
class IPeak;
}
namespace Crystal {
Expand Down Expand Up @@ -51,7 +51,7 @@ class DLLExport PeakBackground : public HardThresholdBackground {
/// MD coordinates to use
Mantid::Kernel::SpecialCoordinateSystem m_mdCoordinates;
/// Pointer to member function used for coordinate determination.
boost::function<Mantid::Kernel::V3D(const Mantid::API::IPeak *)>
boost::function<Mantid::Kernel::V3D(const Mantid::Geometry::IPeak *)>
m_coordFunction;

public:
Expand Down Expand Up @@ -84,4 +84,4 @@ class DLLExport PeakBackground : public HardThresholdBackground {
} // namespace Crystal
} // namespace Mantid

#endif /* MANTID_CRYSTAL_PEAKBACKGROUND_H_ */
#endif /* MANTID_CRYSTAL_PEAKBACKGROUND_H_ */
Expand Up @@ -7,11 +7,13 @@
#include <boost/shared_ptr.hpp>

namespace Mantid {
namespace API {
namespace Geometry{
class IPeak;
class PeakTransform;
}
namespace API {
class IMDHistoWorkspace;
class IMDEventWorkspace;
class PeakTransform;
}
namespace Crystal {

Expand Down Expand Up @@ -51,11 +53,11 @@ class DLLExport PeakClusterProjection {
boost::shared_ptr<Mantid::API::IMDEventWorkspace> &mdWS);
/// Get the signal value at the peak center
Mantid::signal_t
signalAtPeakCenter(const Mantid::API::IPeak &peak,
signalAtPeakCenter(const Mantid::Geometry::IPeak &peak,
Mantid::API::MDNormalization normalization =
Mantid::API::NoNormalization) const;
/// Get the peak center
Mantid::Kernel::V3D peakCenter(const Mantid::API::IPeak &peak) const;
Mantid::Kernel::V3D peakCenter(const Mantid::Geometry::IPeak &peak) const;
/// Destructor
virtual ~PeakClusterProjection();

Expand All @@ -68,7 +70,7 @@ class DLLExport PeakClusterProjection {
boost::shared_ptr<Mantid::API::IMDWorkspace> m_mdWS;

/// Peak Transform
boost::shared_ptr<Mantid::API::PeakTransform> m_peakTransform;
boost::shared_ptr<Mantid::Geometry::PeakTransform> m_peakTransform;
};

} // namespace Crystal
Expand Down
Expand Up @@ -134,7 +134,7 @@ class DLLExport SCDPanelErrors : public API::ParamFunction,
* @return The new peak with the new instrument( adjusted with the
*parameters) and time adjusted.
*/
static DataObjects::Peak createNewPeak(const API::IPeak &peak_old,
static DataObjects::Peak createNewPeak(const Geometry::IPeak &peak_old,
Geometry::Instrument_sptr instrNew,
double T0, double L0);

Expand All @@ -155,7 +155,7 @@ class DLLExport SCDPanelErrors : public API::ParamFunction,
*
* @return A new instrument with the parameters applied.
*/
Geometry::Instrument_sptr getNewInstrument(const API::IPeak &peak) const;
Geometry::Instrument_sptr getNewInstrument(const Geometry::IPeak &peak) const;

private:
/**
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/Framework/Crystal/src/AddPeakHKL.cpp
@@ -1,6 +1,8 @@
#include "MantidCrystal/AddPeakHKL.h"

#include "MantidGeometry/Crystal/IPeak.h"

#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IPeak.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/ArrayLengthValidator.h"

Expand Down Expand Up @@ -62,7 +64,7 @@ namespace Crystal
{
IPeaksWorkspace_sptr peakWS = this->getProperty("Workspace");
const std::vector<double> hklValue = this->getProperty("HKL");
IPeak * peak = peakWS->createPeakHKL(V3D(hklValue[0], hklValue[1], hklValue[2]));
Mantid::Geometry::IPeak * peak = peakWS->createPeakHKL(V3D(hklValue[0], hklValue[1], hklValue[2]));
peakWS->addPeak(*peak);
delete peak;
}
Expand Down
12 changes: 6 additions & 6 deletions Code/Mantid/Framework/Crystal/src/FilterPeaks.cpp
Expand Up @@ -4,17 +4,17 @@
#include "MantidDataObjects/PeaksWorkspace.h"

namespace {
double HKLSum(const Mantid::API::IPeak &p) {
double HKLSum(const Mantid::Geometry::IPeak &p) {
return p.getH() + p.getK() + p.getL();
}

double HKL2(const Mantid::API::IPeak &p) {
double HKL2(const Mantid::Geometry::IPeak &p) {
return p.getH() * p.getH() + p.getK() * p.getK() + p.getL() * p.getL();
}

double intensity(const Mantid::API::IPeak &p) { return p.getIntensity(); }
double intensity(const Mantid::Geometry::IPeak &p) { return p.getIntensity(); }

double SN(const Mantid::API::IPeak &p) {
double SN(const Mantid::Geometry::IPeak &p) {
return p.getIntensity() / p.getSigmaIntensity();
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ void FilterPeaks::exec() {
filteredWS->copyExperimentInfoFrom(inputWS.get());

const std::string FilterVariable = getProperty("FilterVariable");
double (*filterFunction)(const Mantid::API::IPeak &) = 0;
double (*filterFunction)(const Mantid::Geometry::IPeak &) = 0;
if (FilterVariable == "h+k+l")
filterFunction = &HKLSum;
else if (FilterVariable == "h^2+k^2+l^2")
Expand All @@ -104,7 +104,7 @@ void FilterPeaks::exec() {

for (int i = 0; i < inputWS->getNumberPeaks(); ++i) {
bool pass(false);
const API::IPeak &currentPeak = inputWS->getPeak(i);
const Geometry::IPeak &currentPeak = inputWS->getPeak(i);
const double currentValue =
filterFunction(currentPeak); // filterFunction pointer set above

Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Crystal/src/FindClusterFaces.cpp
Expand Up @@ -7,13 +7,14 @@
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/IMDIterator.h"
#include "MantidAPI/IPeaksWorkspace.h"
#include "MantidAPI/IPeak.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidAPI/IMDHistoWorkspace.h"
#include "MantidAPI/TableRow.h"

#include "MantidCrystal/PeakClusterProjection.h"

using namespace Mantid::Kernel;
using namespace Mantid::Geometry;
using namespace Mantid::API;

namespace {
Expand Down Expand Up @@ -48,7 +49,7 @@ createOptionalLabelFilter(size_t dimensionality, int emptyLabelId,
PeakClusterProjection projection(clusterImage);

for (int i = 0; i < filterWorkspace->getNumberPeaks(); ++i) {
IPeak &peak = filterWorkspace->getPeak(i);
Mantid::Geometry::IPeak &peak = filterWorkspace->getPeak(i);
const int labelIdAtPeakCenter =
static_cast<int>(projection.signalAtPeakCenter(peak));
if (labelIdAtPeakCenter > emptyLabelId) {
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Crystal/src/FindSXPeaks.cpp
Expand Up @@ -224,7 +224,7 @@ void FindSXPeaks::reducePeakList(const peakvector &pcv) {
for (std::size_t i = 0; i < finalv.size(); i++) {
finalv[i].reduce();
try {
IPeak *peak = m_peaks->createPeak(finalv[i].getQ());
Geometry::IPeak *peak = m_peaks->createPeak(finalv[i].getQ());
if (peak) {
peak->setIntensity(finalv[i].getIntensity());
peak->setDetectorID(finalv[i].getDetectorId());
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Crystal/src/IndexSXPeaks.cpp
Expand Up @@ -5,7 +5,7 @@
#include "MantidAPI/WorkspaceValidators.h"
#include "MantidKernel/VectorHelper.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidAPI/IPeak.h"
#include "MantidGeometry/Crystal/IPeak.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidKernel/BoundedValidator.h"

Expand All @@ -15,8 +15,9 @@ namespace Crystal {
// Register the class into the algorithm factory
DECLARE_ALGORITHM(IndexSXPeaks)

using namespace Kernel;
using namespace Geometry;
using namespace API;
using namespace Kernel;

/** Initialisation method.
*
Expand Down

0 comments on commit 708c0cf

Please sign in to comment.