Commit 4f54beb7 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Extended functionality of DataProcessorAlgorithm::getProcessProperties

parent 87da8133
......@@ -52,6 +52,7 @@ protected:
void setLoadAlg(const std::string &alg);
void setLoadAlgFileProp(const std::string &filePropName);
void setAccumAlg(const std::string &alg);
void setPropManagerPropName(const std::string &propName);
ITableWorkspace_sptr determineChunk();
void loadChunk();
Workspace_sptr load(const std::string &inputData,
......@@ -59,7 +60,7 @@ protected:
std::vector<std::string> splitInput(const std::string &input);
void forwardProperties();
boost::shared_ptr<Kernel::PropertyManager>
getProcessProperties(const std::string &propertyManager);
getProcessProperties(const std::string &propertyManager=std::string());
/// MPI option. If false, we will use one job event if MPI is available
bool m_useMPI;
Workspace_sptr assemble(const std::string &partialWSName,
......@@ -126,6 +127,9 @@ private:
std::string m_accumulateAlg;
/// An alternate filename property for the load algorithm
std::string m_loadAlgFileProp;
/// The name of the parameter that names the property manager. The default
/// value is "ReductionProperties".
std::string m_propertyManagerPropertyName;
};
} // namespace API
......
......@@ -24,11 +24,9 @@ namespace API {
//----------------------------------------------------------------------------------------------
/** Constructor
*/
DataProcessorAlgorithm::DataProcessorAlgorithm() : API::Algorithm() {
m_loadAlg = "Load";
m_accumulateAlg = "Plus";
m_loadAlgFileProp = "Filename";
m_useMPI = false;
DataProcessorAlgorithm::DataProcessorAlgorithm() : API::Algorithm(),
m_useMPI(false), m_loadAlg("Load"), m_accumulateAlg("Plus"),
m_loadAlgFileProp("Filename"), m_propertyManagerPropertyName("ReductionProperties") {
enableHistoryRecordingForChild(true);
}
......@@ -94,6 +92,10 @@ void DataProcessorAlgorithm::setAccumAlg(const std::string &alg) {
m_accumulateAlg = alg;
}
void DataProcessorAlgorithm::setPropManagerPropName(const std::string &propName) {
m_propertyManagerPropertyName = propName;
}
ITableWorkspace_sptr DataProcessorAlgorithm::determineChunk() {
throw std::runtime_error(
"DataProcessorAlgorithm::determineChunk is not implemented");
......@@ -240,19 +242,25 @@ Workspace_sptr DataProcessorAlgorithm::load(const std::string &inputData,
/**
* Get the property manager object of a given name from the property manager
* data service, or create a new one.
* @param propertyManager :: Name of the property manager to retrieve
* data service, or create a new one. If the PropertyManager name is missing (default) this will
* look at m_propertyManagerPropertyName to get the correct value;
*
* @param propertyManager :: Name of the property manager to retrieve.
*/
boost::shared_ptr<PropertyManager> DataProcessorAlgorithm::getProcessProperties(
const std::string &propertyManager) {
std::string propertyManagerName(propertyManager);
if (propertyManager.empty() && (!m_propertyManagerPropertyName.empty())) {
propertyManagerName = this->getPropertyValue(m_propertyManagerPropertyName);
}
boost::shared_ptr<PropertyManager> processProperties;
if (PropertyManagerDataService::Instance().doesExist(propertyManager)) {
if (PropertyManagerDataService::Instance().doesExist(propertyManagerName)) {
processProperties =
PropertyManagerDataService::Instance().retrieve(propertyManager);
PropertyManagerDataService::Instance().retrieve(propertyManagerName);
} else {
getLogger().notice() << "Could not find property manager" << std::endl;
processProperties = boost::make_shared<PropertyManager>();
PropertyManagerDataService::Instance().addOrReplace(propertyManager,
PropertyManagerDataService::Instance().addOrReplace(propertyManagerName,
processProperties);
}
return processProperties;
......
......@@ -253,13 +253,7 @@ double AlignAndFocusPowder::getVecPropertyFromPmOrSelf(
*/
void AlignAndFocusPowder::exec() {
// Get the reduction property manager
const std::string reductionManagerName =
this->getProperty("ReductionProperties");
boost::shared_ptr<PropertyManager> reductionManager;
if (PropertyManagerDataService::Instance().doesExist(reductionManagerName)) {
reductionManager =
PropertyManagerDataService::Instance().retrieve(reductionManagerName);
}
boost::shared_ptr<PropertyManager> reductionManager = getProcessProperties();
// retrieve the properties
m_inputW = getProperty("InputWorkspace");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment