Skip to content

Commit

Permalink
Re #9249 Fix merge with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Ferraz Leal committed Jun 6, 2014
2 parents 2756e52 + 972342c commit 8efd370
Show file tree
Hide file tree
Showing 63 changed files with 2,507 additions and 150 deletions.
13 changes: 13 additions & 0 deletions Code/Mantid/Build/Jenkins/buildscript
Expand Up @@ -78,6 +78,15 @@ $SCL_ON_RHEL6 "ctest -j$BUILD_THREADS --schedule-random --output-on-failure -E M
# Run GUI tests serially
$SCL_ON_RHEL6 "ctest --output-on-failure -R MantidPlot"

###############################################################################
# Build the documentation - tests first then html
# Only rhel6 nodes to avoid redundant work
###############################################################################
if [[ "$ON_RHEL6" == true ]]; then
$SCL_ON_RHEL6 "make docs-test"
$SCL_ON_RHEL6 "make docs-html"
fi

###############################################################################
# Create the install kit if this is a clean or non-Mac build
###############################################################################
Expand All @@ -94,7 +103,11 @@ if [[ "$CLEANBUILD" == true ]]; then
fi

# We could build the source tarball anywhere, but we choose to do it on RHEL6
# We also parcel up the documentation into a tar file that is easier to move around
# and labelled by the commit id it was built with. This assumes the Jenkins git plugin
# has set the GIT_COMMIT environment variable
if [[ "$ON_RHEL6" == true ]]; then
tar -cjf mantiddocs-g${GIT_COMMIT:0:7}.tar.bz2 --exclude='*.buildinfo' docs/html
# The ..._PREFIX argument avoids opt/Mantid directories at the top of the tree
$SCL_ON_RHEL6 "cpack --config CPackSourceConfig.cmake -D CPACK_PACKAGING_INSTALL_PREFIX="
fi
Expand Down
22 changes: 14 additions & 8 deletions Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Expand Up @@ -256,9 +256,13 @@ namespace Mantid
typedef std::map<size_t,double> MaskList;
const MaskList& maskedBins(const size_t& spectrumIndex) const;

// Methods handling the internal monitor workspace
void setMonitorWorkspace(const boost::shared_ptr<MatrixWorkspace>& monitorWS);
boost::shared_ptr<MatrixWorkspace> monitorWorkspace() const;

void saveInstrumentNexus(::NeXus::File * file) const;
void loadInstrumentNexus(::NeXus::File * file);
void saveSpectraMapNexus(::NeXus::File * file, const std::vector<int>& spec,
void saveSpectraMapNexus(::NeXus::File * file, const std::vector<int>& spec,
const ::NeXus::NXcompression compression = ::NeXus::LZW) const;

//=====================================================================================
Expand Down Expand Up @@ -292,14 +296,13 @@ namespace Mantid
virtual std::vector<IMDIterator*> createIterators(size_t suggestedNumCores = 1,
Mantid::Geometry::MDImplicitFunction * function = NULL) const;

/// Apply masking.
void setMDMasking(Mantid::Geometry::MDImplicitFunction* maskingRegion);

/// Clear exsting masking.
void clearMDMasking();
/// Apply masking.
void setMDMasking(Mantid::Geometry::MDImplicitFunction* maskingRegion);
/// Clear exsting masking.
void clearMDMasking();

/// @return the special coordinate system used if any.
virtual Mantid::API::SpecialCoordinateSystem getSpecialCoordinateSystem() const;
/// @return the special coordinate system used if any.
virtual Mantid::API::SpecialCoordinateSystem getSpecialCoordinateSystem() const;

//=====================================================================================
// End IMDWorkspace methods
Expand Down Expand Up @@ -332,6 +335,9 @@ namespace Mantid
/// The set of masked bins in a map keyed on spectrum index
std::map< int64_t, MaskList > m_masks;

/// A workspace holding monitor data relating to the main data in the containing workspace (null if none).
boost::shared_ptr<MatrixWorkspace> m_monitorWorkspace;

protected:
/// Assists conversions to and from 2D histogram indexing to 1D indexing.
MatrixWSIndexCalculator m_indexCalculator;
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceHistory.h
Expand Up @@ -70,6 +70,8 @@ class MANTID_API_DLL WorkspaceHistory
size_t size() const;
/// Is the history empty
bool empty() const;
/// remove all algorithm history objects from the workspace history
void clearHistory();
/// Retrieve an algorithm history by index
AlgorithmHistory_const_sptr getAlgorithmHistory(const size_t index) const;
/// Add operator[] access
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/src/CatalogManager.cpp
Expand Up @@ -39,6 +39,9 @@ namespace Mantid
*/
ICatalog_sptr CatalogManagerImpl::getCatalog(const std::string &sessionID)
{
// Checks if a user is logged into the catalog. Inform the user if they are not.
if(m_activeCatalogs.empty()) throw std::runtime_error("You are not currently logged into a catalog.");

if(sessionID.empty())
{
auto composite = boost::make_shared<CompositeCatalog>();
Expand Down
19 changes: 19 additions & 0 deletions Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Expand Up @@ -1060,6 +1060,25 @@ namespace Mantid
return it->second;
}

/** Sets the internal monitor workspace to the provided workspace.
* This method is intended for use by data-loading algorithms.
* Note that no checking is performed as to whether this workspace actually contains data
* pertaining to monitors, or that the spectra point to Detector objects marked as monitors.
* It simply has to be of the correct type to be accepted.
* @param monitorWS The workspace containing the monitor data.
*/
void MatrixWorkspace::setMonitorWorkspace(const boost::shared_ptr<MatrixWorkspace>& monitorWS)
{
m_monitorWorkspace = monitorWS;
}

/** Returns a pointer to the internal monitor workspace.
*/
boost::shared_ptr<MatrixWorkspace> MatrixWorkspace::monitorWorkspace() const
{
return m_monitorWorkspace;
}

//---------------------------------------------------------------------------------------------
/** Return memory used by the workspace, in bytes.
* @return bytes used.
Expand Down
8 changes: 8 additions & 0 deletions Code/Mantid/Framework/API/src/WorkspaceHistory.cpp
Expand Up @@ -88,6 +88,14 @@ bool WorkspaceHistory::empty() const
return m_algorithms.empty();
}

/**
* Empty the list of algorithm history objects.
*/
void WorkspaceHistory::clearHistory()
{
m_algorithms.clear();
}

/**
* Retrieve an algorithm history by index
* @param index :: An index within the workspace history
Expand Down
13 changes: 13 additions & 0 deletions Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h
Expand Up @@ -787,6 +787,19 @@ class MatrixWorkspaceTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(ws->getXMax(), 1.0);
}

void test_monitorWorkspace()
{
auto ws = boost::make_shared<WorkspaceTester>();
TSM_ASSERT( "There should be no monitor workspace by default", ! ws->monitorWorkspace() )

auto ws2 = boost::make_shared<WorkspaceTester>();
ws->setMonitorWorkspace(ws2);
TSM_ASSERT_EQUALS( "Monitor workspace not successfully set", ws->monitorWorkspace(), ws2 )

ws->setMonitorWorkspace(boost::shared_ptr<MatrixWorkspace>());
TSM_ASSERT( "Monitor workspace not successfully reset", ! ws->monitorWorkspace() )
}

private:
boost::shared_ptr<MatrixWorkspace> ws;

Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/Framework/API/test/WorkspaceFactoryTest.h
Expand Up @@ -75,6 +75,8 @@ class WorkspaceFactoryTest : public CxxTest::TestSuite
ws_child->mutableRun().addProperty("Ei", 12.0);
ws_child->mutableSample().setName("MySample");

ws_child->setMonitorWorkspace(boost::make_shared<Workspace1DTest>());

MatrixWorkspace_sptr child;
TS_ASSERT_THROWS_NOTHING( child = WorkspaceFactory::Instance().create(ws_child) );
TS_ASSERT_EQUALS( child->id(), "Workspace1DTest");
Expand Down Expand Up @@ -102,7 +104,9 @@ class WorkspaceFactoryTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS("MySample", ws_child->sample().getName());
TS_ASSERT_EQUALS("MySampleChild", child->sample().getName());


// Monitor workspace
TSM_ASSERT( "The workspace factory should not propagate a monitor workspace", ! child->monitorWorkspace() );

MatrixWorkspace_sptr ws2D(new Workspace2DTest);
ws2D->initialize(3,1,1);
MatrixWorkspace_sptr child2;
Expand Down
6 changes: 6 additions & 0 deletions Code/Mantid/Framework/Algorithms/CMakeLists.txt
Expand Up @@ -181,6 +181,7 @@ set ( SRC_FILES
src/RemoveExpDecay.cpp
src/RemoveLowResTOF.cpp
src/RemovePromptPulse.cpp
src/RemoveWorkspaceHistory.cpp
src/RenameWorkspace.cpp
src/RenameWorkspaces.cpp
src/ReplaceSpecialValues.cpp
Expand Down Expand Up @@ -210,6 +211,7 @@ set ( SRC_FILES
src/SpecularReflectionCalculateTheta.cpp
src/SpecularReflectionPositionCorrect.cpp
src/SphericalAbsorption.cpp
src/Stitch1D.cpp
src/StripPeaks.cpp
src/StripVanadiumPeaks.cpp
src/StripVanadiumPeaks2.cpp
Expand Down Expand Up @@ -415,6 +417,7 @@ set ( INC_FILES
inc/MantidAlgorithms/RemoveExpDecay.h
inc/MantidAlgorithms/RemoveLowResTOF.h
inc/MantidAlgorithms/RemovePromptPulse.h
inc/MantidAlgorithms/RemoveWorkspaceHistory.h
inc/MantidAlgorithms/RenameWorkspace.h
inc/MantidAlgorithms/RenameWorkspaces.h
inc/MantidAlgorithms/ReplaceSpecialValues.h
Expand Down Expand Up @@ -444,6 +447,7 @@ set ( INC_FILES
inc/MantidAlgorithms/SpecularReflectionCalculateTheta.h
inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h
inc/MantidAlgorithms/SphericalAbsorption.h
inc/MantidAlgorithms/Stitch1D.h
inc/MantidAlgorithms/StripPeaks.h
inc/MantidAlgorithms/StripVanadiumPeaks.h
inc/MantidAlgorithms/StripVanadiumPeaks2.h
Expand Down Expand Up @@ -642,6 +646,7 @@ set ( TEST_FILES
RemoveExpDecayTest.h
RemoveLowResTOFTest.h
RemovePromptPulseTest.h
RemoveWorkspaceHistoryTest.h
RenameWorkspaceTest.h
RenameWorkspacesTest.h
ReplaceSpecialValuesTest.h
Expand All @@ -667,6 +672,7 @@ set ( TEST_FILES
SpecularReflectionCalculateThetaTest.h
SpecularReflectionPositionCorrectTest.h
SphericalAbsorptionTest.h
Stitch1DTest.h
StripPeaksTest.h
StripVanadiumPeaks2Test.h
StripVanadiumPeaksTest.h
Expand Down
@@ -0,0 +1,58 @@
#ifndef MANTID_ALGORITHMS_REMOVEWORKSPACEHISTORY_H_
#define MANTID_ALGORITHMS_REMOVEWORKSPACEHISTORY_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"

namespace Mantid
{
namespace Algorithms
{

/** RemoveWorkspaceHistory
Removes all algorithm history records from the workspace history attached to a workspace.
Copyright &copy; 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport RemoveWorkspaceHistory : public API::Algorithm
{
public:
RemoveWorkspaceHistory();
virtual ~RemoveWorkspaceHistory();

virtual const std::string name() const;
virtual const std::string summary() const;
virtual int version() const;
virtual const std::string category() const;

private:
void init();
void exec();


};


} // namespace Algorithms
} // namespace Mantid

#endif /* MANTID_ALGORITHMS_REMOVEWORKSPACEHISTORY_H_ */

0 comments on commit 8efd370

Please sign in to comment.