Skip to content

Commit

Permalink
Merge branch 'master' into feature/10271_tcmalloc_ldpreload
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/Framework/Kernel/CMakeLists.txt
Refs #10271
  • Loading branch information
martyngigg committed Nov 26, 2014
2 parents b67ee4e + f19c348 commit 19552b9
Show file tree
Hide file tree
Showing 67 changed files with 2,753 additions and 312 deletions.
2 changes: 2 additions & 0 deletions Code/Mantid/Build/CMake/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ include_directories ( SYSTEM ${NEXUS_INCLUDE_DIR} )

find_package ( MuParser REQUIRED )

find_package ( JsonCPP REQUIRED )

find_package ( Doxygen ) # optional

# Need to change search path to find zlib include on Windows.
Expand Down
33 changes: 33 additions & 0 deletions Code/Mantid/Build/CMake/FindJsonCPP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# - Find jsoncpp include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(JsonCPP [required] [quiet] )
#
# The module sets the following variables
# JSONCPP_FOUND - True if headers and libraries were found
# JSONCPP_INCLUDE_DIR - jsoncpp include directories
# JSONCPP_LIBRARY - library files for linking (optimised version)
# JSONCPP_LIBRARY_DEBUG - library files for linking (debug version)
# JSONCPP_LIBRARIES - All required libraries, including the configuration type

# Headers
find_path ( JSONCPP_INCLUDE_DIR jsoncpp/json/json.h )

# Libraries
find_library ( JSONCPP_LIBRARY NAMES jsoncpp ) # optimized
find_library ( JSONCPP_LIBRARY_DEBUG NAMES jsoncpp_d ) # debug

if ( JSONCPP_LIBRARY AND JSONCPP_LIBRARY_DEBUG )
set ( JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARY} debug ${JSONCPP_LIBRARY_DEBUG} )
else()
set ( JSONCPP_LIBRARIES ${JSONCPP_LIBRARY} )
endif()

# Handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( JsonCPP DEFAULT_MSG JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES )

# Advanced variables
mark_as_advanced ( JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES )


2 changes: 1 addition & 1 deletion Code/Mantid/Build/CMake/WindowsSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ set ( PYTHONW_EXECUTABLE "${CMAKE_LIBRARY_PATH}/Python27/pythonw.exe" CACHE FILE
###########################################################################
add_definitions ( -DWIN32 -D_WINDOWS -DMS_VISUAL_STUDIO )
add_definitions ( -D_USE_MATH_DEFINES -DNOMINMAX )
add_definitions ( -DGSL_DLL )
add_definitions ( -DGSL_DLL -DJSON_DLL )
add_definitions ( -DPOCO_NO_UNWINDOWS )
add_definitions ( -D_SCL_SECURE_NO_WARNINGS )
add_definitions ( -D_CRT_SECURE_NO_WARNINGS )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: mantid-developer
Version: 1.5
Version: 1.6
Release: 1%{?dist}
Summary: Meta Package to install dependencies for Mantid Development

Expand Down Expand Up @@ -47,8 +47,12 @@ Requires: sip-devel
Requires: git
Requires: openssl-devel
Requires: texlive-latex
%if 0%{?el6}
# do nothing
%else
Requires: texlive-latex-bin
Requires: texlive-was
%endif
Requires: tex-preview
Requires: dvipng
%if 0%{?el6}
Expand Down
8 changes: 2 additions & 6 deletions Code/Mantid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,8 @@ if ( ENABLE_CPACK )

# rhel requirements
set ( CPACK_RPM_PACKAGE_REQUIRES "boost >= 1.34.1,qt4 >= 4.2,nexus,nexus-python,gsl,glibc,qwtplot3d-qt4,muParser,numpy" )
# OpenCASCADE changed names when packaged for Fedora 20 and RHEL7
if( "${UNIX_CODENAME}" MATCHES "Heisenbug" OR "${UNIX_CODENAME}" MATCHES "Maipo" )
set( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},OCE-devel" )
else()
set( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},OpenCASCADE-libs-modelling >= 6.3.0,OpenCASCADE-libs-foundation >= 6.3.0,OpenCASCADE-libs-visualization >= 6.3.0,OpenCASCADE-libs-ocaf >= 6.3.0,OpenCASCADE-libs-ocaf-lite >= 6.3.0" )
endif()
# OCE
set( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},OCE-draw,OCE-foundation,OCE-modeling,OCE-ocaf,OCE-visualization")
# Qwt is qwt5-qt4 in RHEL7
if( "${UNIX_CODENAME}" MATCHES "Maipo" )
set( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},qwt5-qt4" )
Expand Down
10 changes: 10 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ namespace Mantid
auto rebin = this->createChildAlgorithm("Rebin");
rebin->setProperty("InputWorkspace", input);
rebin->setProperty("Params", params);
std::stringstream ssParams;
ssParams << params[0] << "," << params[1] << "," << params[2];
g_log.information("Rebinning Params: " + ssParams.str());
rebin->execute();
MatrixWorkspace_sptr outWS = rebin->getProperty("OutputWorkspace");

Expand Down Expand Up @@ -366,6 +369,8 @@ namespace Mantid
integration->setProperty("InputWorkspace", input);
integration->setProperty("RangeLower", start);
integration->setProperty("RangeUpper", stop);
g_log.information("Integration RangeLower: " + boost::lexical_cast<std::string>(start));
g_log.information("Integration RangeUpper: " + boost::lexical_cast<std::string>(stop));
integration->execute();
MatrixWorkspace_sptr outWS = integration->getProperty("OutputWorkspace");
return outWS;
Expand All @@ -386,6 +391,9 @@ namespace Mantid
multiplyRange->setProperty("StartBin", startBin);
multiplyRange->setProperty("EndBin", endBin);
multiplyRange->setProperty("Factor", factor);
g_log.information("MultiplyRange StartBin: " + boost::lexical_cast<std::string>(startBin));
g_log.information("MultiplyRange EndBin: " + boost::lexical_cast<std::string>(endBin));
g_log.information("MultiplyRange Factor: " + boost::lexical_cast<std::string>(factor));
multiplyRange->execute();
MatrixWorkspace_sptr outWS = multiplyRange->getProperty("OutputWorkspace");
return outWS;
Expand All @@ -404,6 +412,8 @@ namespace Mantid
multiplyRange->setProperty("InputWorkspace", input);
multiplyRange->setProperty("StartBin", startBin);
multiplyRange->setProperty("Factor", factor);
g_log.information("MultiplyRange StartBin: " + boost::lexical_cast<std::string>(startBin));
g_log.information("MultiplyRange Factor: " + boost::lexical_cast<std::string>(factor));
multiplyRange->execute();
MatrixWorkspace_sptr outWS = multiplyRange->getProperty("OutputWorkspace");
return outWS;
Expand Down
9 changes: 5 additions & 4 deletions Code/Mantid/Framework/DataHandling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set ( SRC_FILES
src/DefineGaugeVolume.cpp
src/DeleteTableRows.cpp
src/DetermineChunking.cpp
src/DownloadFile.cpp
src/ExtractMonitorWorkspace.cpp
src/FilterEventsByLogValuePreNexus.cpp
src/FindDetectorsInShape.cpp
Expand Down Expand Up @@ -126,10 +127,9 @@ set ( SRC_FILES
src/SaveMask.cpp
src/SaveNISTDAT.cpp
src/SaveNXSPE.cpp
src/SaveNXTomo.cpp
src/SaveNexus.cpp
src/SaveNexusProcessed.cpp
src/SaveNXTomo.cpp
src/SaveParameterFile.cpp
src/SavePAR.cpp
src/SavePDFGui.cpp
src/SavePHX.cpp
Expand Down Expand Up @@ -157,6 +157,7 @@ set ( INC_FILES
inc/MantidDataHandling/DefineGaugeVolume.h
inc/MantidDataHandling/DeleteTableRows.h
inc/MantidDataHandling/DetermineChunking.h
inc/MantidDataHandling/DownloadFile.h
inc/MantidDataHandling/ExtractMonitorWorkspace.h
inc/MantidDataHandling/FilterEventsByLogValuePreNexus.h
inc/MantidDataHandling/FindDetectorsInShape.h
Expand Down Expand Up @@ -268,10 +269,9 @@ set ( INC_FILES
inc/MantidDataHandling/SaveMask.h
inc/MantidDataHandling/SaveNISTDAT.h
inc/MantidDataHandling/SaveNXSPE.h
inc/MantidDataHandling/SaveNXTomo.h
inc/MantidDataHandling/SaveNexus.h
inc/MantidDataHandling/SaveNexusProcessed.h
inc/MantidDataHandling/SaveNXTomo.h
inc/MantidDataHandling/SaveParameterFile.h
inc/MantidDataHandling/SavePAR.h
inc/MantidDataHandling/SavePDFGui.h
inc/MantidDataHandling/SavePHX.h
Expand Down Expand Up @@ -303,6 +303,7 @@ set ( TEST_FILES
DefineGaugeVolumeTest.h
DeleteTableRowsTest.h
DetermineChunkingTest.h
DownloadFileTest.h
ExtractMonitorWorkspaceTest.h
FilterEventsByLogValuePreNexusTest.h
FindDetectorsInShapeTest.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#ifndef MANTID_DATAHANDLING_DOWNLOADFILE_H_
#define MANTID_DATAHANDLING_DOWNLOADFILE_H_

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

namespace Mantid
{

namespace Kernel
{
//forward Declaration
class InternetHelper;
}

namespace DataHandling
{

/** DownloadFile : Downloads a file from a url to the file system
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 DownloadFile : public API::Algorithm
{
public:
DownloadFile();
virtual ~DownloadFile();

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

protected:
Kernel::InternetHelper* m_internetHelper;

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



};


} // namespace DataHandling
} // namespace Mantid

#endif /* MANTID_DATAHANDLING_DOWNLOADFILE_H_ */
93 changes: 93 additions & 0 deletions Code/Mantid/Framework/DataHandling/src/DownloadFile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#include "MantidDataHandling/DownloadFile.h"
#include "MantidKernel/InternetHelper.h"
#include "MantidKernel/ListValidator.h"
#include "MantidKernel/MandatoryValidator.h"
#include "MantidAPI/FileProperty.h"

#include "Poco/URI.h"

#include "boost/make_shared.hpp"
#include "boost/algorithm/string/predicate.hpp"

#include <string>
#include <stdexcept>

namespace Mantid
{
namespace DataHandling
{

using Mantid::Kernel::Direction;
using Mantid::Kernel::MandatoryValidator;
using Mantid::Kernel::StringListValidator;
using Mantid::API::WorkspaceProperty;
using Mantid::API::FileProperty;

// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(DownloadFile)



//----------------------------------------------------------------------------------------------
/** Constructor
*/
DownloadFile::DownloadFile():m_internetHelper(new Kernel::InternetHelper())
{
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
DownloadFile::~DownloadFile()
{
delete m_internetHelper;
}


//----------------------------------------------------------------------------------------------

/// Algorithms name for identification. @see Algorithm::name
const std::string DownloadFile::name() const { return "DownloadFile"; }

/// Algorithm's version for identification. @see Algorithm::version
int DownloadFile::version() const { return 1;}

/// Algorithm's category for identification. @see Algorithm::category
const std::string DownloadFile::category() const { return "DataHandling";}

/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary
const std::string DownloadFile::summary() const { return "Downloads a file from a url to the file system";}


//----------------------------------------------------------------------------------------------
/** Initialize the algorithm's properties.
*/
void DownloadFile::init()
{
declareProperty("Address", "", boost::make_shared<MandatoryValidator<std::string> >(),
"The address of the network resource to download. This should start http:// or https:// .", Direction::InOut);
declareProperty(new FileProperty("Filename", "", FileProperty::Save),
"The filename to save the download to.");
}

//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
void DownloadFile::exec()
{
std::string address = getProperty("Address");
if ((!boost::starts_with(address,"http://")) && (!boost::starts_with(address,"https://")))
{
address = "http://" + address;
g_log.information("Address must start http:// or https://, http has been assumed to continue: " + address);
}
std::string filename = getProperty("Filename");

Poco::URI url(address);
m_internetHelper->downloadFile(url.toString(),filename);
setProperty("Address",address);
}


} // namespace DataHandling
} // namespace Mantid

0 comments on commit 19552b9

Please sign in to comment.