Skip to content

Commit

Permalink
Re #11619. Cleaner dynamic cast checks. Couple of typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed May 1, 2015
1 parent 349d1bd commit 3f90d28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions Code/Mantid/Framework/Algorithms/src/ExtractSpectra.cpp
Expand Up @@ -127,12 +127,14 @@ void ExtractSpectra::execHistogram() {

// If this is a Workspace2D, get the spectra axes for copying in the spectraNo
// later
Axis *inAxis1(NULL), *outAxis1(NULL);
Axis *inAxis1(NULL);
TextAxis *outTxtAxis(NULL);
NumericAxis *outNumAxis(NULL);
if (m_inputWorkspace->axes() > 1) {
inAxis1 = m_inputWorkspace->getAxis(1);
outAxis1 = outputWorkspace->getAxis(1);
auto outAxis1 = outputWorkspace->getAxis(1);
outTxtAxis = dynamic_cast<TextAxis *>(outAxis1);
if (!outTxtAxis) outNumAxis = dynamic_cast<NumericAxis *>(outAxis1);
}

cow_ptr<MantidVec> newX;
Expand Down Expand Up @@ -163,13 +165,12 @@ void ExtractSpectra::execHistogram() {
// copy over the axis entry for each spectrum, regardless of the type of
// axes present
if (inAxis1) {
if (outAxis1->isText()) {
if (outTxtAxis) {
outTxtAxis->setLabel(j, inAxis1->label(i));
} else if (!outAxis1->isSpectra()) // handled by copyInfoFrom line
{
dynamic_cast<NumericAxis *>(outAxis1)
->setValue(j, inAxis1->operator()(i));
} else if (outNumAxis) {
outNumAxis->setValue(j, inAxis1->operator()(i));
}
// spectra axis is handled by copyInfoFrom line
}
// Copy spectrum number & detectors
outputWorkspace->getSpectrum(j)
Expand Down
Expand Up @@ -10,7 +10,7 @@ Description
-----------

Removes all masked spectra from a workspace and stores all unmasked ones in the output workspace.
The mask is taken either form the optional MaskedWorkspace property or form the input workspace
The mask is taken either from the optional MaskedWorkspace property or from the input workspace
if it is the only input. The MaskedWorkspace property can either be a masked MatrixWorkspace or
a specialised MaskWorkspace.

Expand Down

0 comments on commit 3f90d28

Please sign in to comment.