Skip to content
Snippets Groups Projects
Commit 48ee1ecc authored by Michael Whitty's avatar Michael Whitty
Browse files

refs #2192 - fix for SofQw test failure?

parent 6a843aa5
No related branches found
No related tags found
No related merge requests found
...@@ -102,34 +102,36 @@ void WorkspaceFactoryImpl::initializeFromParent(const MatrixWorkspace_const_sptr ...@@ -102,34 +102,36 @@ void WorkspaceFactoryImpl::initializeFromParent(const MatrixWorkspace_const_sptr
{ {
// Only copy mask map if same size for now. Later will need to check continued validity. // Only copy mask map if same size for now. Later will need to check continued validity.
child->m_masks = parent->m_masks; child->m_masks = parent->m_masks;
}
// deal with axis
for (unsigned int i = 0; i < parent->m_axes.size(); ++i)
{
const int newAxisLength = child->getAxis(i)->length();
const int oldAxisLength = parent->getAxis(i)->length();
for (unsigned int i = 0; i < parent->m_axes.size(); ++i) if ( newAxisLength == oldAxisLength )
{ {
// Need to delete the existing axis created in init above // Need to delete the existing axis created in init above
delete child->m_axes[i]; delete child->m_axes[i];
// Now set to a copy of the parent workspace's axis // Now set to a copy of the parent workspace's axis
child->m_axes[i] = parent->m_axes[i]->clone(child.get()); child->m_axes[i] = parent->m_axes[i]->clone(child.get());
} }
} else
else
{
// Just copy the unit and title
for (unsigned int i = 0; i < parent->m_axes.size(); ++i)
{ {
if (! parent->getAxis(i)->isSpectra()) if (! parent->getAxis(i)->isSpectra())
{ {
int length = child->getAxis(i)->length();
if (parent->getAxis(i)->isNumeric()) if (parent->getAxis(i)->isNumeric())
{ {
Mantid::API::NumericAxis* newAxis = new Mantid::API::NumericAxis(length); Mantid::API::NumericAxis* newAxis = new Mantid::API::NumericAxis(newAxisLength);
child->replaceAxis(i, newAxis); child->replaceAxis(i, newAxis);
child->getAxis(i)->unit() = parent->getAxis(i)->unit(); child->getAxis(i)->unit() = parent->getAxis(i)->unit();
} }
if (parent->getAxis(i)->isText()) if (parent->getAxis(i)->isText())
{ {
Mantid::API::TextAxis* newAxis = new Mantid::API::TextAxis(length); Mantid::API::TextAxis* newAxis = new Mantid::API::TextAxis(newAxisLength);
child->replaceAxis(i, newAxis); child->replaceAxis(i, newAxis);
} }
} }
child->getAxis(i)->title() = parent->getAxis(i)->title(); child->getAxis(i)->title() = parent->getAxis(i)->title();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment