Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mantidproject/mantid
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Nov 3, 2011
2 parents fa319de + cb28868 commit a88f646
Show file tree
Hide file tree
Showing 69 changed files with 1,862 additions and 281 deletions.
28 changes: 28 additions & 0 deletions Code/Mantid/Build/CMake/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set ( CMAKE_INCLUDE_PATH ${MAIN_CMAKE_INCLUDE_PATH} )

###########################################################################
# Look for Git. Used for version headers - faked if not found.
# Also makes sure our commit hooks are linked in the right place.
###########################################################################

set ( MtdVersion_WC_LAST_CHANGED_REV 0 )
Expand All @@ -85,6 +86,7 @@ if ( GIT_FOUND )
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
if ( NOT NOT_GIT_REPO ) # i.e This is a git repository!

# Remove the tag name part
string ( REGEX MATCH "[-](.*)" MtdVersion_WC_LAST_CHANGED_REV ${GIT_DESCRIBE} )
# Extract the SHA1 part (with a 'g' prefix which stands for 'git')
Expand All @@ -97,7 +99,33 @@ if ( GIT_FOUND )
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
string ( SUBSTRING ${MtdVersion_WC_LAST_CHANGED_DATE} 0 16 MtdVersion_WC_LAST_CHANGED_DATE )

###########################################################################
# This part puts our hooks (in .githooks) into .git/hooks
###########################################################################
# First need to find the top-level directory of the git repository
execute_process ( COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
OUTPUT_VARIABLE GIT_TOP_LEVEL
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
# N.B. The variable comes back from 'git describe' with a line feed on the end, so we need to lose that
string ( REGEX MATCH "(.*)[^\n]" GIT_TOP_LEVEL ${GIT_TOP_LEVEL} )
# Prefer symlinks on platforms that support it so we don't rely on cmake running to be up-to-date
# On Windows, we have to copy the file
if ( WIN32 )
execute_process ( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_TOP_LEVEL}/.githooks/pre-commit
${GIT_TOP_LEVEL}/.git/hooks )
execute_process ( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GIT_TOP_LEVEL}/.githooks/commit-msg
${GIT_TOP_LEVEL}/.git/hooks )
else ()
execute_process ( COMMAND ${CMAKE_COMMAND} -E create_symlink ${GIT_TOP_LEVEL}/.githooks/pre-commit
${GIT_TOP_LEVEL}/.git/hooks/pre-commit )
execute_process ( COMMAND ${CMAKE_COMMAND} -E create_symlink ${GIT_TOP_LEVEL}/.githooks/commit-msg
${GIT_TOP_LEVEL}/.git/hooks/commit-msg )
endif ()

endif()

else()
# Just use a dummy version number and print a warning
message ( STATUS "Git not found - using dummy revision number and date" )
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Build/class_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def write_source(subproject, classname, filename, args):
if not args.alg:
algorithm_top = ""
algorithm_source = ""
s = ""
else:
s = """/*WIKI*
TODO: Enter a full wiki-markup description of your algorithm here. You can then use the Build/wiki_maker.py script to generate your full wiki page.
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set ( SRC_FILES
src/AnalysisDataService.cpp
src/ArchiveSearchFactory.cpp
src/Axis.cpp
src/BoxController.cpp
src/CatalogFactory.cpp
src/CloneableAlgorithm.cpp
src/Column.cpp
Expand Down Expand Up @@ -99,6 +100,7 @@ set ( INC_FILES
inc/MantidAPI/AnalysisDataService.h
inc/MantidAPI/ArchiveSearchFactory.h
inc/MantidAPI/Axis.h
inc/MantidAPI/BoxController.h
inc/MantidAPI/CatalogFactory.h
inc/MantidAPI/CloneableAlgorithm.h
inc/MantidAPI/Column.h
Expand Down Expand Up @@ -199,6 +201,7 @@ set ( TEST_FILES
test/AlgorithmTest.h
test/AnalysisDataServiceTest.h
test/AsynchronousTest.h
test/BoxControllerTest.h
test/CompositeFunctionTest.h
test/CoordTransformTest.h
test/CostFunctionFactoryTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Mantid
{
namespace MDEvents
namespace API
{


Expand Down Expand Up @@ -492,7 +492,10 @@ namespace MDEvents
/// Shared ptr to BoxController
typedef boost::shared_ptr<BoxController> BoxController_sptr;

}//namespace MDEvents
/// Shared ptr to a const BoxController
typedef boost::shared_ptr<const BoxController> BoxController_const_sptr;

}//namespace API

}//namespace Mantid

Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/IMDEventWorkspace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef IMDEVENTWORKSPACE_H_
#define IMDEVENTWORKSPACE_H_

#include "MantidAPI/BoxController.h"
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/IMDWorkspace.h"
Expand All @@ -10,8 +11,8 @@
#include "MantidGeometry/MDGeometry/MDDimensionExtents.h"
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidKernel/ProgressBase.h"
#include <boost/shared_ptr.hpp>
#include "MantidKernel/ThreadScheduler.h"
#include <boost/shared_ptr.hpp>

namespace Mantid
{
Expand Down Expand Up @@ -42,6 +43,9 @@ namespace API
/// Returns some information about the box controller, to be displayed in the GUI, for example
virtual std::vector<std::string> getBoxControllerStats() const = 0;

virtual Mantid::API::BoxController_sptr getBoxController() = 0;
virtual Mantid::API::BoxController_const_sptr getBoxController() const = 0;

/// Helper method that makes a table workspace with some box data
virtual Mantid::API::ITableWorkspace_sptr makeBoxTable(size_t start, size_t num) = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "MantidKernel/Strings.h"
#include "MantidKernel/System.h"
#include "MantidKernel/VectorHelper.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <Poco/DOM/Attr.h>
Expand All @@ -20,7 +20,7 @@ using Mantid::Kernel::VectorHelper::splitStringIntoVector;

namespace Mantid
{
namespace MDEvents
namespace API
{

//-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -158,7 +158,7 @@ namespace MDEvents

} // namespace Mantid

} // namespace MDEvents
} // namespace API



Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#define BOXPLITCONTROLLER_TEST_H

#include "MantidKernel/DiskMRU.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include <cxxtest/TestSuite.h>
#include <map>
#include <memory>

using namespace Mantid;
using namespace Mantid::API;
using namespace Mantid::Kernel;
using namespace Mantid::MDEvents;

class BoxControllerTest : public CxxTest::TestSuite
{
Expand Down
33 changes: 25 additions & 8 deletions Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,9 @@ void LoadEventNexus::init()
setPropertyGroup("FilterMonByTimeStart", grp4);
setPropertyGroup("FilterMonByTimeStop", grp4);

declareProperty(
new PropertyWithValue<bool>("MetaDataOnly", false, Direction::Input),
"If true, only the meta data and sample logs will be loaded.");
}


Expand Down Expand Up @@ -917,6 +920,8 @@ void LoadEventNexus::makeMapToEventLists()
*/
void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)
{
bool metaDataOnly = getProperty("MetaDataOnly");

// Get the time filters
setTimeFilters(monitors);

Expand Down Expand Up @@ -967,6 +972,26 @@ void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)
file.closeGroup();
file.close();

// Delete the output workspace name if it existed
std::string outName = getPropertyValue("OutputWorkspace");
if (AnalysisDataService::Instance().doesExist(outName))
AnalysisDataService::Instance().remove( outName );

// set more properties on the workspace
loadEntryMetadata(m_filename, WS, m_top_entry_name);

if(metaDataOnly) {
//Now, create a default X-vector for histogramming, with just 2 bins.
Kernel::cow_ptr<MantidVec> axis;
MantidVec& xRef = axis.access();
xRef.resize(2);
xRef[0] = static_cast<double>(std::numeric_limits<uint32_t>::max()) * 0.1 - 1; //Just to make sure the bins hold it all
xRef[1] = 1;
//Set the binning axis using this.
WS->setAllX(axis);
return;
}

// --------- Loading only one bank ? ----------------------------------
std::string onebank = getProperty("BankName");
bool doOneBank = (onebank != "");
Expand Down Expand Up @@ -995,11 +1020,6 @@ void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)
onebank = "";
}

// Delete the output workspace name if it existed
std::string outName = getPropertyValue("OutputWorkspace");
if (AnalysisDataService::Instance().doesExist(outName))
AnalysisDataService::Instance().remove( outName );

prog->report("Initializing all pixels");

//----------------- Pad Empty Pixels -------------------------------
Expand Down Expand Up @@ -1097,9 +1117,6 @@ void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)
//Set the binning axis using this.
WS->setAllX(axis);

// set more properties on the workspace
loadEntryMetadata(m_filename, WS, m_top_entry_name);

// if there is time_of_flight load it
loadTimeOfFlight(m_filename, WS, m_top_entry_name,classType);
}
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ API::MatrixWorkspace_sptr LoadNexusProcessed::loadEventEntry(NXData & wksp_cls,
el.reserve(index_end - index_start);
el.clearDetectorIDs();

for (long i=index_start; i<index_end; i++)
for (int64_t i=index_start; i<index_end; i++)
switch (type)
{
case TOF:
Expand Down Expand Up @@ -485,7 +485,7 @@ API::Workspace_sptr LoadNexusProcessed::loadEntry(NXRoot & root, const std::stri
//// validate the optional spectrum parameters, if set
checkOptionalProperties(nspectra);
// Actual number of spectra in output workspace (if only a range was going to be loaded)
int total_specs=calculateWorkspacesize(nspectra);
size_t total_specs=calculateWorkspacesize(nspectra);

//// Create the 2D workspace for the output
local_workspace = boost::dynamic_pointer_cast<API::MatrixWorkspace>
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/ConvertToQ3DdE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ boost::shared_ptr<MDEvents::MDEventWorkspace<MDE,4> > create_empty4DEventWS(cons
ws->initialize();

// Build up the box controller
MDEvents::BoxController_sptr bc = ws->getBoxController();
Mantid::API::BoxController_sptr bc = ws->getBoxController();
bc->setSplitInto(5);
// bc->setSplitThreshold(1500);
bc->setSplitThreshold(10);
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/ConvertToQNDany.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> > create
ws->initialize();

// Build up the box controller
MDEvents::BoxController_sptr bc = ws->getBoxController();
Mantid::API::BoxController_sptr bc = ws->getBoxController();
bc->setSplitInto(5);
// bc->setSplitThreshold(1500);
bc->setSplitThreshold(10);
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDEvents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set ( SRC_FILES
src/AffineMatrixParameter.cpp
src/AffineMatrixParameterParser.cpp
src/BinToMDHistoWorkspace.cpp
src/BoxController.cpp
src/BoxControllerSettingsAlgorithm.cpp
src/CentroidPeaksMD.cpp
src/CloneMDWorkspace.cpp
src/ConvertToDiffractionMDWorkspace.cpp
Expand Down Expand Up @@ -50,7 +50,7 @@ set ( INC_FILES
inc/MantidMDEvents/AffineMatrixParameter.h
inc/MantidMDEvents/AffineMatrixParameterParser.h
inc/MantidMDEvents/BinToMDHistoWorkspace.h
inc/MantidMDEvents/BoxController.h
inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h
inc/MantidMDEvents/CentroidPeaksMD.h
inc/MantidMDEvents/CloneMDWorkspace.h
inc/MantidMDEvents/ConvertToDiffractionMDWorkspace.h
Expand Down Expand Up @@ -89,7 +89,7 @@ set ( INC_FILES
set ( TEST_FILES
test/AffineMatrixParameterParserTest.h
test/AffineMatrixParameterTest.h
test/BoxControllerTest.h
test/BoxControllerSettingsAlgorithmTest.h
test/CentroidPeaksMDTest.h
test/CloneMDWorkspaceTest.h
test/ConvertToDiffractionMDWorkspaceTest.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_
#define MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_

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

namespace Mantid
{
namespace MDEvents
{

/** An abstract algorithm sub-class for algorithms that
* define properties for BoxController settings.
*
* This will be inherited by other algorithms as required.
@author Janik Zikovsky
@date 2011-11-02
Copyright &copy; 2011 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://svn.mantidproject.org/mantid/trunk/Code/Mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport BoxControllerSettingsAlgorithm : public API::Algorithm
{
public:
BoxControllerSettingsAlgorithm();
~BoxControllerSettingsAlgorithm();

protected:
/// Initialise the properties
void initBoxControllerProps(const std::string & SplitInto="5", int SplitThreshold=1000, int MaxRecursionDepth=5);

/// Set the settings in the given box controller
void setBoxController(Mantid::API::BoxController_sptr bc);

std::string getBoxSettingsGroupName()
{ return "Box Splitting Settings"; }

};


} // namespace MDEvents
} // namespace Mantid

#endif /* MANTID_MDEVENTS_BOXCONTROLLERSETTINGSALGORITHM_H_ */

0 comments on commit a88f646

Please sign in to comment.