Skip to content

Commit

Permalink
Merge branch 'master' into feature/10277_indirect_bayes_fit_preview_p…
Browse files Browse the repository at this point in the history
…lots

Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectBayesTab.h
	Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/JumpFit.h
	Code/Mantid/MantidQt/CustomInterfaces/src/IndirectBayesTab.cpp
	Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp

Refs #10277
  • Loading branch information
DanNixon committed Oct 14, 2014
2 parents 3af232b + fe97d5f commit 65486ea
Show file tree
Hide file tree
Showing 142 changed files with 8,613 additions and 5,070 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -162,4 +162,8 @@ Desktop.ini
# Mac OS X Finder
.DS_Store

# Ctags index files
.tags
.tags_sorted_by_file

Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
7 changes: 7 additions & 0 deletions Code/Mantid/Build/CMake/DarwinSetup.cmake
Expand Up @@ -81,6 +81,13 @@ endif ()
###########################################################################
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++0x" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x" )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register" )
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "-Wno-deprecated-register")
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()

if( ${CMAKE_C_COMPILER} MATCHES "icc.*$" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-intel-extensions" )
Expand Down
13 changes: 4 additions & 9 deletions Code/Mantid/Build/CMake/GNUSetup.cmake
Expand Up @@ -6,16 +6,12 @@
# project settings should be included in the relevant CMakeLists.txt file
# for that project.

# Get the GCC version
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version | cut -d \" \" -f 3 OUTPUT_VARIABLE _compiler_output)
STRING(REGEX REPLACE ".*([0-9]\\.[0-9]\\.[0-9]).*" "\\1" GCC_COMPILER_VERSION ${_compiler_output})
MESSAGE(STATUS "gcc version: ${GCC_COMPILER_VERSION}")

# Export the GCC compiler version globally
set(GCC_COMPILER_VERSION ${GCC_COMPILER_VERSION} CACHE INTERNAL "")
# Set our own compiler version flag from the cmake one and export it globally
set( GCC_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION} CACHE INTERNAL "")
message( STATUS "gcc version: ${GCC_COMPILER_VERSION}" )

# Global warning flags.
set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -fno-common" )
set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -fno-common" )
# Disable some warnings about deprecated headers and type conversions that
# we can't do anything about
# -Wno-deprecated: Do not warn about use of deprecated headers.
Expand All @@ -38,4 +34,3 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GNUFLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GNUFLAGS} -Woverloaded-virtual -fno-operator-names -std=c++0x" )
# Cleanup
set ( GNUFLAGS )

12 changes: 8 additions & 4 deletions Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h
Expand Up @@ -338,6 +338,11 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
/// Pointer to the parent history object (if set)
boost::shared_ptr<AlgorithmHistory> m_parentHistory;

/// One vector of workspaces for each input workspace property
std::vector<WorkspaceVector> m_groups;
/// Size of the group(s) being processed
size_t m_groupSize;

private:
/// Private Copy constructor: NO COPY ALLOWED
Algorithm(const Algorithm&);
Expand All @@ -354,6 +359,9 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag

bool executeAsyncImpl(const Poco::Void & i);

// Report that the algorithm has completed.
void reportCompleted(const double& duration, const bool groupProcessing = false);

// --------------------- Private Members -----------------------------------
/// Poco::ActiveMethod used to implement asynchronous execution.
Poco::ActiveMethod<bool, Poco::Void, Algorithm, Poco::ActiveStarter<Algorithm>> *m_executeAsync;
Expand Down Expand Up @@ -387,14 +395,10 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
/// All the WorkspaceProperties that are Output (not inOut). Set in execute()
std::vector<IWorkspaceProperty *> m_pureOutputWorkspaceProps;

/// One vector of workspaces for each input workspace property
std::vector<WorkspaceVector> m_groups;
/// Pointer to the WorkspaceGroup (if any) for each input workspace property
std::vector<boost::shared_ptr<WorkspaceGroup> > m_groupWorkspaces;
/// If only one input is a group, this is its index. -1 if they are all groups
int m_singleGroup;
/// Size of the group(s) being processed
size_t m_groupSize;
/// All the groups have similar names (group_1, group_2 etc.)
bool m_groupsHaveSimilarNames;
/// A non-recursive mutex for thread-safety
Expand Down
83 changes: 59 additions & 24 deletions Code/Mantid/Framework/API/src/Algorithm.cpp
Expand Up @@ -78,13 +78,13 @@ namespace Mantid
Algorithm::Algorithm() :
PropertyManagerOwner(),
m_cancel(false),m_parallelException(false), m_log("Algorithm"), g_log(m_log),
m_groupSize(0),
m_executeAsync(NULL),
m_notificationCenter(NULL),
m_progressObserver(NULL),
m_isInitialized(false), m_isExecuted(false),m_isChildAlgorithm(false), m_recordHistoryForChild(false),
m_alwaysStoreInADS(false),m_runningAsync(false),
m_running(false),m_rethrow(false),m_algorithmID(this),
m_singleGroup(-1), m_groupSize(0), m_groupsHaveSimilarNames(false)
m_running(false), m_rethrow(false), m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false)
{
}

Expand Down Expand Up @@ -550,6 +550,18 @@ namespace Mantid
}
}

if(trackingHistory())
{
// count used for defining the algorithm execution order
// If history is being recorded we need to count this as a separate algorithm
// as the history compares histories by their execution number
++Algorithm::g_execCount;

//populate history record before execution so we can record child algorithms in it
AlgorithmHistory algHist;
m_history = boost::make_shared<AlgorithmHistory>(algHist);
}

// ----- Check for processing groups -------------
// default true so that it has the right value at the check below the catch block should checkGroups throw
bool callProcessGroups = true;
Expand All @@ -560,7 +572,22 @@ namespace Mantid
if (callProcessGroups)
{
// This calls this->execute() again on each member of the group.
return processGroups();
start_time = Mantid::Kernel::DateAndTime::getCurrentTime();
// Start a timer
Timer timer;
// Call the concrete algorithm's exec method
const bool completed = processGroups();
// Check for a cancellation request in case the concrete algorithm doesn't
interruption_point();
// Get how long this algorithm took to run
const float duration = timer.elapsed();

if(completed)
{
// Log that execution has completed.
reportCompleted(duration, true/*indicat that this is for group processing*/);
}
return completed;
}
}
catch(std::exception& ex)
Expand Down Expand Up @@ -593,19 +620,6 @@ namespace Mantid
Poco::FastMutex::ScopedLock _lock(m_mutex);
m_running = true;
}


if(trackingHistory())
{
// count used for defining the algorithm execution order
// If history is being recorded we need to count this as a separate algorithm
// as the history compares histories by their execution number
++Algorithm::g_execCount;

//populate history record before execution so we can record child algorithms in it
AlgorithmHistory algHist;
m_history = boost::make_shared<AlgorithmHistory>(algHist);
}

start_time = Mantid::Kernel::DateAndTime::getCurrentTime();
// Start a timer
Expand All @@ -631,14 +645,9 @@ namespace Mantid

// RJT, 19/3/08: Moved this up from below the catch blocks
setExecuted(true);
if (!m_isChildAlgorithm || m_alwaysStoreInADS)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << std::endl;
}
else
getLogger().debug() << name() << " finished with isChild = " << isChild() << std::endl;
m_running = false;

// Log that execution has completed.
reportCompleted(duration);
}
catch(std::runtime_error& ex)
{
Expand Down Expand Up @@ -1614,6 +1623,32 @@ namespace Mantid
if (m_cancel) throw CancelException();
}

/**
Report that the algorithm has completed.
@param duration : Algorithm duration
@param groupProcessing : We have been processing via processGroups if true.
*/
void Algorithm::reportCompleted(const double& duration, const bool groupProcessing)
{
std::string optionalMessage;
if(groupProcessing)
{
optionalMessage = ". Processed as a workspace group";
}

if (!m_isChildAlgorithm || m_alwaysStoreInADS)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl;
}

else
{
getLogger().debug() << name() << " finished with isChild = " << isChild() << std::endl;
}
m_running = false;
}



} // namespace API
Expand Down
32 changes: 14 additions & 18 deletions Code/Mantid/Framework/Algorithms/src/CheckWorkspacesMatch.cpp
Expand Up @@ -488,7 +488,6 @@ bool CheckWorkspacesMatch::compareEventWorkspaces(DataObjects::EventWorkspace_co
}
else
{
result = "Success!";
wsmatch = true;
}

Expand Down Expand Up @@ -836,27 +835,24 @@ bool CheckWorkspacesMatch::checkRunProperties(const API::Run& run1, const API::R
}

// Now loop over the individual logs
for ( size_t i = 0; i < ws1logs.size(); ++i )
bool matched(true);
int64_t length(static_cast<int64_t>(ws1logs.size()));
PARALLEL_FOR_IF(true)
for ( int64_t i = 0; i < length; ++i )
{
// Check the log name
if ( ws1logs[i]->name() != ws2logs[i]->name() )
{
g_log.debug() << "WS1 log " << i << " name: " << ws1logs[i]->name() << "\n";
g_log.debug() << "WS2 log " << i << " name: " << ws2logs[i]->name() << "\n";
result = "Log name mismatch";
return false;
}

// Now check the log entry itself, using the method that gives it back as a string
if ( ws1logs[i]->value() != ws2logs[i]->value() )
PARALLEL_START_INTERUPT_REGION
if (matched)
{
g_log.debug() << "WS1 log " << ws1logs[i]->name() << ": " << ws1logs[i]->value() << "\n";
g_log.debug() << "WS2 log " << ws2logs[i]->name() << ": " << ws2logs[i]->value() << "\n";
result = "Log value mismatch";
return false;
if ( *(ws1logs[i]) != *(ws2logs[i]))
{
matched = false;
result = "Log mismatch";
}
}
PARALLEL_END_INTERUPT_REGION
}
return true;
PARALLEL_CHECK_INTERUPT_REGION
return matched;
}

//------------------------------------------------------------------------------------------------
Expand Down
Expand Up @@ -688,7 +688,7 @@ class CheckWorkspacesMatchTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace2",ws3) );

TS_ASSERT( checker.execute() );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log name mismatch" );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log mismatch" );

Mantid::API::MatrixWorkspace_sptr ws4 = WorkspaceCreationHelper::Create2DWorkspace123(2,2);
ws4->mutableRun().addLogData(new Mantid::Kernel::PropertyWithValue<int>("Prop1",100));
Expand All @@ -697,7 +697,7 @@ class CheckWorkspacesMatchTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace2",ws4) );

TS_ASSERT( checker.execute() );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log value mismatch" );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log mismatch" );
}

void test_Input_With_Two_Groups_That_Are_The_Same_Matches()
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/test/ExponentialTest.h
@@ -1,4 +1,4 @@
#ifndef EXPONENTAILTEST_H_
#ifndef EXPONENTIALTEST_H_
#define EXPONENTIALTEST_H_

#include <cxxtest/TestSuite.h>
Expand Down
@@ -1,5 +1,5 @@
#ifndef MANTID_CRYSTAL_FIND_UB_USING_MIN_MAX_D_TEST_H_
#define MANTID_CRYSTAL_FIND_UB_USING_MIN_MAX_TEST_H_
#define MANTID_CRYSTAL_FIND_UB_USING_MIN_MAX_D_TEST_H_

#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
Expand Down
Expand Up @@ -37,7 +37,7 @@ of real numbers separated by spaces. The first column are the x-values and the s
If a nexus file is used its first spectrum provides the data for the function. The same is true for
a workspace which must be a MatrixWorkspace.
The function has a signle parameter - a scaling factor "Scaling".
The function has two parameters - a scaling factor "Scaling" and a shift factor along the abscissas 'Shift'
@author Roman Tolchenov, Tessella plc
@date 4/09/2012
Expand Down Expand Up @@ -96,7 +96,7 @@ class DLLExport TabulatedFunction : public API::ParamFunction, public API::IFunc
void clear() const;

/// Evaluate the function for a list of arguments and given scaling factor
void eval(double scaling, double* out, const double* xValues, const size_t nData)const;
void eval(double scaling, double shift, double* out, const double* xValues, const size_t nData)const;

/// Fill in the x and y value containers (m_xData and m_yData)
void setupData() const;
Expand Down

0 comments on commit 65486ea

Please sign in to comment.