Skip to content

Commit

Permalink
refs #10385. Query default property.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Oct 23, 2014
1 parent fdf6281 commit d0ba5d5
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp
Expand Up @@ -71,7 +71,8 @@ namespace Mantid
}

SpectraInfo(int _nSpectra, bool _hasSpectra, IntArray_shared _spectraNumbers,
IntArray_shared _detectorIndex, IntArray_shared _detectorCount, IntArray_shared _detectorList) :
IntArray_shared _detectorIndex, IntArray_shared _detectorCount,
IntArray_shared _detectorList) :
nSpectra(_nSpectra), hasSpectra(_hasSpectra), spectraNumbers(_spectraNumbers), detectorIndex(
_detectorIndex), detectorCount(_detectorCount), detectorList(_detectorList)
{
Expand Down Expand Up @@ -220,22 +221,29 @@ namespace Mantid

// Check for an entry number property
int64_t entrynumber = static_cast<int64_t>(getProperty("EntryNumber"));
Property const * const entryNumberProperty = this->getProperty("EntryNumber");
bool bDefaultEntryNumber = entryNumberProperty->isDefault();

if (entrynumber > 0 && entrynumber > nWorkspaceEntries)
if (!bDefaultEntryNumber && entrynumber > nWorkspaceEntries)
{
g_log.error() << "Invalid entry number specified. File only contains " << nWorkspaceEntries
<< " entries.\n";
throw std::invalid_argument("Invalid entry number specified.");
}

const std::string basename = "mantid_workspace_";
if (nWorkspaceEntries == 1 || entrynumber > 0)

std::ostringstream os;
if (bDefaultEntryNumber)
{
++entrynumber;
}
os << basename << entrynumber;
const std::string targetEntryName = os.str();
if (nWorkspaceEntries == 1 || !bDefaultEntryNumber)
{ // Load one first level entry, specified if there are several
if (entrynumber == 0)
++entrynumber;
std::ostringstream os;
os << entrynumber;
API::Workspace_sptr workspace = loadEntry(root, basename + os.str(), 0, 1);

API::Workspace_sptr workspace = loadEntry(root, targetEntryName, 0, 1);
//API::Workspace_sptr workspace = boost::static_pointer_cast<API::Workspace>(local_workspace);
setProperty("OutputWorkspace", workspace);
}
Expand Down

0 comments on commit d0ba5d5

Please sign in to comment.