Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mantidproject/mantid
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed Nov 23, 2011
2 parents ef92049 + f95d505 commit 5ed21f7
Show file tree
Hide file tree
Showing 103 changed files with 3,830 additions and 604 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/Build/CMake/CommonVatesSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Framework/DataHandling
Framework/MDEvents
Framework/MDAlgorithms
Framework/Nexus
Framework/NexusCPP
)

set ( COMMONVATES_SETUP_DONE TRUE )
3 changes: 2 additions & 1 deletion Code/Mantid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ add_subdirectory ( Framework )
include_directories ( Framework/Kernel/inc )
include_directories ( Framework/Geometry/inc )
include_directories ( Framework/API/inc )
set ( CORE_MANTIDLIBS Kernel Geometry API ${NEXUS_LIBRARIES})
include_directories ( Framework/NexusCPP/inc )
set ( CORE_MANTIDLIBS Kernel Geometry API )

add_subdirectory ( MantidQt )

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/BoxController.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "MantidKernel/MultiThreaded.h"
#include "MantidKernel/System.h"
#include "MantidKernel/ThreadPool.h"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"
#include <boost/shared_ptr.hpp>
#include <vector>

Expand Down
5 changes: 5 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/ISpectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ namespace API
virtual const MantidVec& dataX() const;
virtual const MantidVec& dataDx() const;

virtual const MantidVec& readX() const;
virtual const MantidVec& readDx() const;

virtual MantidVecPtr ptrX() const;

virtual void setData(const MantidVec& Y) = 0;
Expand All @@ -89,6 +92,8 @@ namespace API

virtual const MantidVec& dataY() const = 0;
virtual const MantidVec& dataE() const = 0;
virtual const MantidVec& readY() const;
virtual const MantidVec& readE() const;

virtual size_t getMemorySize() const = 0;

Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <set>
#include "MantidAPI/ISpectrum.h"
#include "MantidKernel/DateAndTime.h"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"

namespace Mantid
{
Expand Down Expand Up @@ -187,6 +187,10 @@ namespace Mantid
/// Returns the error const
virtual const MantidVec& dataDx(const std::size_t index) const { return getSpectrum(index)->dataDx(); }

virtual double getXMin() const;
virtual double getXMax() const;
virtual void getXMinMax(double &xmin, double &xmax) const;

/// Returns a pointer to the x data
virtual Kernel::cow_ptr<MantidVec> refX(const std::size_t index) const { return getSpectrum(index)->ptrX(); }

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/PropertyNexus.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "MantidKernel/System.h"
#include "MantidKernel/Property.h"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"


namespace Mantid
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/Run.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "MantidKernel/TimeSplitter.h"
#include <vector>
#include "MantidKernel/Matrix.h"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"


namespace Mantid
Expand Down
17 changes: 17 additions & 0 deletions Code/Mantid/Framework/API/src/ISpectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ namespace API
const MantidVec& ISpectrum::dataDx() const
{ return *refDx; }


/// Returns the x data const
const MantidVec& ISpectrum::readX() const
{ return *refX; }

/// Returns the x error data const
const MantidVec& ISpectrum::readDx() const
{ return *refDx; }

/// Returns the y data const
const MantidVec& ISpectrum::readY() const
{ return this->dataY(); }

/// Returns the y error data const
const MantidVec& ISpectrum::readE() const
{ return this->dataE(); }

/// Returns a pointer to the x data
MantidVecPtr ISpectrum::ptrX() const
{ return refX; }
Expand Down
38 changes: 37 additions & 1 deletion Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <numeric>
#include "MantidAPI/NumericAxis.h"
#include "MantidKernel/DateAndTime.h"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"

using Mantid::Kernel::DateAndTime;
using Mantid::Kernel::TimeSeriesProperty;
Expand Down Expand Up @@ -652,6 +652,42 @@ namespace Mantid
} // for each detector ID in the list
}

double MatrixWorkspace::getXMin() const
{
double xmin;
double xmax;
this->getXMinMax(xmin, xmax); // delagate to the proper code
return xmin;
}

double MatrixWorkspace::getXMax() const
{
double xmin;
double xmax;
this->getXMinMax(xmin, xmax); // delagate to the proper code
return xmax;
}

void MatrixWorkspace::getXMinMax(double &xmin, double &xmax) const
{
// set to crazy values to start
xmin = std::numeric_limits<double>::max();
xmax = -1.0 * xmin;
size_t numberOfSpectra = this->getNumberHistograms();

// determine the data range
double temp;
for (size_t workspaceIndex = 0; workspaceIndex < numberOfSpectra; workspaceIndex++)
{
const MantidVec& dataX = this->readX(workspaceIndex); // force using const version
temp = dataX.front();
if (temp < xmin)
xmin = temp;
temp = dataX.back();
if (temp > xmax)
xmax = temp;
}
}

//---------------------------------------------------------------------------------------
/** Integrate all the spectra in the matrix workspace within the range given.
Expand Down
29 changes: 6 additions & 23 deletions Code/Mantid/Framework/API/src/PropertyNexus.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "MantidAPI/PropertyNexus.h"
#include "MantidKernel/System.h"
#include "nexus/NeXusException.hpp"
#include "nexus/NeXusFile.hpp"
#include "MantidNexusCPP/NeXusException.hpp"
#include "MantidNexusCPP/NeXusFile.hpp"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/TimeSeriesProperty.h"
#include "MantidKernel/PropertyWithValue.h"
Expand Down Expand Up @@ -164,11 +164,7 @@ namespace PropertyNexus
template <typename NumT>
void savePropertyWithValue(::NeXus::File * file, PropertyWithValue<NumT> * prop)
{
// Spaces are unacceptable in names - remove them
std::string name(prop->name());
for (size_t i=0; i<name.size(); i++)
if (name[i] == ' ') name[i] = '_';
file->makeGroup(name, "NXlog", 1);
file->makeGroup(prop->name(), "NXlog", 1);
file->writeData("value", (*prop)() );
file->closeGroup();
}
Expand All @@ -177,11 +173,7 @@ namespace PropertyNexus
/** Helper function to save a PropertyWithValue<> */
void savePropertyWithValueString(::NeXus::File * file, PropertyWithValue<std::string> * prop)
{
// Spaces are unacceptable in names - remove them
std::string name(prop->name());
for (size_t i=0; i<name.size(); i++)
if (name[i] == ' ') name[i] = '_';
file->makeGroup(name, "NXlog", 1);
file->makeGroup(prop->name(), "NXlog", 1);
file->writeData("value", prop->value() );
file->closeGroup();
}
Expand Down Expand Up @@ -210,11 +202,7 @@ namespace PropertyNexus
{
std::vector<NumT> value = prop->valuesAsVector();
if( value.empty() ) return;
// Spaces are unacceptable in names - remove them
std::string name(prop->name());
for (size_t i=0; i<name.size(); i++)
if (name[i] == ' ') name[i] = '_';
file->makeGroup(name, "NXlog", 1);
file->makeGroup(prop->name(), "NXlog", 1);
file->writeData("value", value );
saveTimeVector(file, prop);
file->closeGroup();
Expand All @@ -226,12 +214,7 @@ namespace PropertyNexus
{
std::vector<std::string> values = prop->valuesAsVector();
if( values.empty() ) return;

// Spaces are unacceptable in names - remove them
std::string name(prop->name());
for (size_t i=0; i<name.size(); i++)
if (name[i] == ' ') name[i] = '_';
file->makeGroup(name, "NXlog", 1);
file->makeGroup(prop->name(), "NXlog", 1);

// Find the max length of any string
size_t maxlen=0;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/src/Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "MantidGeometry/IComponent.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"
#include "MantidGeometry/Objects/ShapeFactory.h"
#include "nexus/NeXusException.hpp"
#include "MantidNexusCPP/NeXusException.hpp"

using namespace Mantid::Kernel;
using Mantid::Geometry::ShapeFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ class DLLExport DiffractionFocussing2: public API::Algorithm
int validateSpectrumInGroup(size_t wi);

/// Shared pointer to a mutable input workspace
API::MatrixWorkspace_sptr matrixInputW;
API::MatrixWorkspace_sptr m_matrixInputW;

/// Grouping workspace with groups to build
Mantid::DataObjects::GroupingWorkspace_sptr groupWS;

/// Shared pointer to the event workspace
DataObjects::EventWorkspace_sptr eventW;
DataObjects::EventWorkspace_sptr m_eventW;


// This map does not need to be ordered, just a lookup for udet
Expand Down

0 comments on commit 5ed21f7

Please sign in to comment.