Skip to content

Commit

Permalink
Re #8735 Only headers and no functional code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Leal committed Jan 20, 2014
1 parent ec6b13a commit 0392b6e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Expand Up @@ -73,6 +73,8 @@ namespace Mantid
///Virtual destructor
virtual ~Instrument();

void addInstrument(const boost::shared_ptr<const Instrument>, detid_t);

Instrument* clone() const;

IObjComponent_const_sptr getSource() const;
Expand Down
37 changes: 37 additions & 0 deletions Code/Mantid/Framework/Geometry/src/Instrument.cpp
Expand Up @@ -125,6 +125,43 @@ namespace Mantid
return new Instrument(*this);
}

/*
*
*/
void Instrument::addInstrument(const boost::shared_ptr<const Instrument> fromInst,
detid_t detIdOffset) {

CompAssembly *fromCompAssembly = dynamic_cast<CompAssembly *>(this)->clone();


std::vector<IComponent_const_sptr> children;
fromInst->getChildren(children, true);

for (auto it = children.begin(); it != children.end(); ++it) {


// Need to do a deep copy
comp_it it;
for (it = m_children.begin(); it != m_children.end(); ++it)
{
*it = (*it)->clone() ;
// Move copied component object's parent from old to new CompAssembly
(*it)->setParent(this);
}




if (const IDetector* det = dynamic_cast<const Detector*>(it->get())) {
markAsDetector(det);

}

}

}


/// Pointer to the 'real' instrument, for parametrized instruments
Instrument_const_sptr Instrument::baseInstrument() const
{
Expand Down

0 comments on commit 0392b6e

Please sign in to comment.