Skip to content

Commit

Permalink
Refs #4024 merging master
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Nov 14, 2011
2 parents ef4ecea + cdb61fd commit 3ccff22
Show file tree
Hide file tree
Showing 315 changed files with 9,395 additions and 2,399 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ Thumbs.db

# Folder config file
Desktop.ini

/Code/Mantid/Build/CMake/OutputBinaryTo.cmake
5 changes: 0 additions & 5 deletions Code/Mantid/Build/CMake/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ else()
message (STATUS "Could NOT find PyUnitTest - unit testing of python not available" )
endif()

###########################################################################
# Allow binaries to be put into subdirectories.
###########################################################################
include(OutputBinaryTo)

###########################################################################
# Set a flag to indicate that this script has been called
###########################################################################
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/Build/CMake/GNUSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qua
# we can't do anything about
# -Wno-deprecated: Do not warn about use of deprecated headers.
# -Wno-write-strings: Do not warn about deprecated conversions of char*->const char*
set( GNUFLAGS "${GNUFLAGS} -Wno-deprecated -Wno-write-strings")
# -Wno-unused-result: Do not warn about unused return values in some C functions
set( GNUFLAGS "${GNUFLAGS} -Wno-deprecated -Wno-write-strings -Wno-unused-result")

# Set the options fo gcc and g++
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GNUFLAGS}" )
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Build/CMake/MantidUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function( SET_TARGET_OUTPUT_DIRECTORY TARGET OUTPUT_DIR )
${OUTPUT_DIR} )
add_custom_command ( TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E echo
"Moving \"$(TargetName)${LIB_EXT}\" to ${OUTPUT_DIR}/$(TargetName)${LIB_EXT}"
COMMAND ${CMAKE_COMMAND} ARGS -E rename
"Copying \"$(TargetName)${LIB_EXT}\" to ${OUTPUT_DIR}/$(TargetName)${LIB_EXT}"
COMMAND ${CMAKE_COMMAND} ARGS -E copy
${SRC_DIR}/$(TargetName)${LIB_EXT}
${OUTPUT_DIR}/$(TargetName)${LIB_EXT} )
# Clean up
Expand Down
30 changes: 0 additions & 30 deletions Code/Mantid/Build/CMake/OutputBinaryTo.cmake

This file was deleted.

1 change: 1 addition & 0 deletions Code/Mantid/Build/wiki_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def make_property_table_line(propnum, p):
defaultstr = str(default)
# Replace the ugly default values with "optional"
if (defaultstr == "8.9884656743115785e+307") or \
(defaultstr == "1.7976931348623157e+308") or \
(defaultstr == "2147483647"):
defaultstr = "Optional"

Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set ( SRC_FILES
src/IFunctionMD.cpp
src/IFunctionMW.cpp
src/IMDEventWorkspace.cpp
src/IMDHistoWorkspace.cpp
src/IMDIterator.cpp
src/IMDWorkspace.cpp
src/IPeak.cpp
Expand Down Expand Up @@ -137,6 +138,7 @@ set ( INC_FILES
inc/MantidAPI/IFunctionWithLocation.h
inc/MantidAPI/ILocatedData.h
inc/MantidAPI/IMDEventWorkspace.h
inc/MantidAPI/IMDHistoWorkspace.h
inc/MantidAPI/IMDIterator.h
inc/MantidAPI/IMDWorkspace.h
inc/MantidAPI/IPeak.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ namespace API
EnabledWhenWorkspaceIsType * out = new EnabledWhenWorkspaceIsType<T>(this->m_propertyManager, m_otherPropName, m_enabledSetting);
return out;
}

protected:
protected:
/// Name of the OTHER property that we will check.
std::string m_otherPropName;
/// Set Enabled to this.
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ namespace API
// Helper methods (made public for tests)
std::string getWorkspaceStartDate();
static void getValidFromTo(const std::string& IDFfilename, std::string& outValidFrom, std::string& outValidTo);
/// Get the IDF using the instrument name and date
static std::string getInstrumentFilename(const std::string& instrumentName, const std::string& date);
/// Get the IDF using the instrument name
static std::string getInstrumentFilename(const std::string& instrumentName);

protected:

Expand Down
87 changes: 87 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDHistoWorkspace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#ifndef MANTID_API_IMDHISTOWORKSPACE_H_
#define MANTID_API_IMDHISTOWORKSPACE_H_

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


namespace Mantid
{
namespace API
{

/** Abstract interface to MDHistoWorkspace,
for use in exposing to Python.
@date 2011-11-09
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 IMDHistoWorkspace : public IMDWorkspace
{
public:
IMDHistoWorkspace();
virtual ~IMDHistoWorkspace();

/// See the MDHistoWorkspace definition for descriptions of these
virtual coord_t getInverseVolume() const = 0;
virtual signal_t * getSignalArray() = 0;
virtual signal_t * getErrorSquaredArray() = 0;
virtual void setTo(signal_t signal, signal_t errorSquared) = 0;
virtual Mantid::Kernel::VMD getCenter(size_t linearIndex) const = 0;
virtual void setSignalAt(size_t index, signal_t value) = 0;
virtual void setErrorSquaredAt(size_t index, signal_t value) = 0;
virtual signal_t getErrorAt(size_t index) const = 0;
virtual signal_t getErrorAt(size_t index1, size_t index2) const = 0;
virtual signal_t getErrorAt(size_t index1, size_t index2, size_t index3) const = 0;
virtual signal_t getErrorAt(size_t index1, size_t index2, size_t index3, size_t index4) const = 0;
virtual signal_t getSignalAt(size_t index) const = 0;
virtual signal_t getSignalAt(size_t index1, size_t index2) const = 0;
virtual signal_t getSignalAt(size_t index1, size_t index2, size_t index3) const = 0;
virtual signal_t getSignalAt(size_t index1, size_t index2, size_t index3, size_t index4) const = 0;
virtual signal_t getSignalNormalizedAt(size_t index) const = 0;
virtual signal_t getSignalNormalizedAt(size_t index1, size_t index2) const = 0;
virtual signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3) const = 0;
virtual signal_t getSignalNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const = 0;
virtual signal_t getErrorNormalizedAt(size_t index) const = 0;
virtual signal_t getErrorNormalizedAt(size_t index1, size_t index2) const = 0;
virtual signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3) const = 0;
virtual signal_t getErrorNormalizedAt(size_t index1, size_t index2, size_t index3, size_t index4) const = 0;

virtual signal_t & errorSquaredAt(size_t index) = 0;
virtual signal_t & signalAt(size_t index) = 0;
virtual size_t getLinearIndex(size_t index1, size_t index2) const = 0;
virtual size_t getLinearIndex(size_t index1, size_t index2, size_t index3) const = 0;
virtual size_t getLinearIndex(size_t index1, size_t index2, size_t index3, size_t index4) const = 0;

virtual double & operator [](const size_t & index) = 0;
};

/// Shared pointer to the IMDWorkspace base class
typedef boost::shared_ptr<IMDHistoWorkspace> IMDHistoWorkspace_sptr;
/// Shared pointer to the IMDWorkspace base class (const version)
typedef boost::shared_ptr<const IMDHistoWorkspace> IMDHistoWorkspace_const_sptr;


} // namespace API
} // namespace Mantid

#endif /* MANTID_API_IMDHISTOWORKSPACE_H_ */
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ namespace Mantid

};

/// Shared pointer to the matrix workspace base class
/// Shared pointer to the IMDWorkspace base class
typedef boost::shared_ptr<IMDWorkspace> IMDWorkspace_sptr;
/// Shared pointer to the matrix workspace base class (const version)
/// Shared pointer to the IMDWorkspace base class (const version)
typedef boost::shared_ptr<const IMDWorkspace> IMDWorkspace_const_sptr;
}
}
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace API

virtual void setWavelength(double wavelength) = 0;
virtual double getWavelength() const = 0;
virtual double getScattering() const = 0;
virtual double getDSpacing() const = 0;
virtual double getTOF() const = 0;

Expand Down
34 changes: 22 additions & 12 deletions Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Mantid
* @param validator :: The (optional) validator to use for this property
* @throw std::out_of_range if the direction argument is not a member of the Direction enum (i.e. 0-2)
*/
WorkspaceProperty( const std::string &name, const std::string &wsName, const unsigned int direction,
explicit WorkspaceProperty( const std::string &name, const std::string &wsName, const unsigned int direction,
Kernel::IValidator<boost::shared_ptr<TYPE> > *validator = new Kernel::NullValidator<boost::shared_ptr<TYPE> > ) :
Kernel::PropertyWithValue <boost::shared_ptr<TYPE> >( name, boost::shared_ptr<TYPE>( ), validator, direction ),
m_workspaceName( wsName ), m_initialWSName( wsName ), m_optional(false)
Expand Down Expand Up @@ -341,22 +341,32 @@ namespace Mantid
std::string memberWsName = *it;
boost::shared_ptr<Workspace> memberWs = AnalysisDataService::Instance().retrieve(memberWsName);

// ... and if it is a workspace of incorrect type, exclude the group by returning an error.
if( NULL == boost::dynamic_pointer_cast<TYPE>(memberWs) )
// Table Workspaces are ignored
if ("TableWorkspace" == memberWs->id())
{
error = "Workspace " + memberWsName + " is not of type " + Kernel::PropertyWithValue< boost::shared_ptr<TYPE> >::type() + ".";

error = "Workspace " + memberWsName + " is of type TableWorkspace and will therefore be ignored as part of the GroupedWorkspace.";
g_log.debug() << error << std::endl;

return error;
}
// If it is of the correct type, it may still be invalid. Check.
else
{
Mantid::API::WorkspaceProperty<TYPE> memberWsProperty(*this);
std::string memberError = memberWsProperty.setValue(memberWsName);
if( !memberError.empty() )
return memberError; // Since if this member is invalid, then the whole group is invalid.
// ... and if it is a workspace of incorrect type, exclude the group by returning an error.
if( NULL == boost::dynamic_pointer_cast<TYPE>(memberWs) )
{
error = "Workspace " + memberWsName + " is not of type " + Kernel::PropertyWithValue< boost::shared_ptr<TYPE> >::type() + ".";

g_log.debug() << error << std::endl;

return error;
}
// If it is of the correct type, it may still be invalid. Check.
else
{
Mantid::API::WorkspaceProperty<TYPE> memberWsProperty(*this);
std::string memberError = memberWsProperty.setValue(memberWsName);
if( !memberError.empty() )
return memberError; // Since if this member is invalid, then the whole group is invalid.
}
}
}

Expand Down

0 comments on commit 3ccff22

Please sign in to comment.