Commit aff691e4 authored by gsell's avatar gsell

repo reorganization

parents
This diff is collapsed.
OPAL (Object Oriented Parallel Accelerator Library)
V 1.0.0 22.2.2008
A fusion of MAD9, CLASSIC (V3.3.1 -> 4.0) MAD9p
with the help of IPPL.
Effort started 5/12/2006 by Andreas Adelmann (PSI)
Goto amas.web.psi.ch for more indormations.
Andreas Adelmann
// ------------------------------------------------------------------------
// $RCSfile: AlignWrapper.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AlignWrapper
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamlineVisitor.h"
// Class AlignWrapper
// ------------------------------------------------------------------------
void AlignWrapper::accept(BeamlineVisitor &visitor) const
{
visitor.visitAlignWrapper(*this);
}
AlignWrapper *AlignWrapper::clone() const
{
return new AlignWrapper(*this);
}
ElementBase *AlignWrapper::copyStructure()
{
if (isSharable()) {
return this;
} else {
AlignWrapper *wrap = new AlignWrapper(*this);
wrap->itsElement = itsElement->copyStructure();
return wrap;
}
}
void AlignWrapper::makeSharable()
{
shareFlag = true;
itsElement->makeSharable();
}
Euclid3D AlignWrapper::getEntranceTransform() const
{
if (itsOffset.isIdentity()) {
return itsOffset;
} else {
Euclid3D frame = itsElement->getEntranceFrame();
return frame.inverse() * itsOffset * frame;
}
}
Euclid3D AlignWrapper::getExitTransform() const
{
if (itsOffset.isIdentity()) {
return itsOffset;
} else {
Euclid3D frame = itsElement->getExitFrame();
return frame * Inverse(itsOffset) * Inverse(frame);
}
}
ElementBase *AlignWrapper::getElement() const
{
return &*itsElement;
}
void AlignWrapper::setElement(ElementBase *elem)
{
itsElement = elem;
}
Geometry &AlignWrapper::getGeometry()
{
return itsElement->getGeometry();
}
const Geometry &AlignWrapper::getGeometry() const
{
return itsElement->getGeometry();
}
const string &AlignWrapper::getType() const
{
return itsElement->getType();
}
Euclid3D &AlignWrapper::offset() const
{
return itsOffset;
}
ElementBase *AlignWrapper::makeAlignWrapper()
{
return this;
}
ElementBase *AlignWrapper::makeFieldWrapper()
{
itsElement = itsElement->makeFieldWrapper();
itsElement->setName(itsElement->getName());
return this;
}
ElementBase *AlignWrapper::removeAlignWrapper()
{
return &*itsElement;
}
const ElementBase *AlignWrapper::removeAlignWrapper() const
{
return &*itsElement;
}
ElementBase *AlignWrapper::removeFieldWrapper()
{
return new AlignWrapper(itsElement->removeFieldWrapper());
}
const ElementBase *AlignWrapper::removeFieldWrapper() const
{
return new AlignWrapper(itsElement->removeFieldWrapper());
}
ElementBase *AlignWrapper::removeWrappers()
{
return itsElement->removeWrappers();
}
const ElementBase *AlignWrapper::removeWrappers() const
{
return itsElement->removeWrappers();
}
AlignWrapper::AlignWrapper(const AlignWrapper &rhs):
ElementBase(rhs), itsElement(rhs.itsElement), itsOffset(rhs.itsOffset)
{
shareFlag = false;
}
AlignWrapper::~AlignWrapper()
{}
AlignWrapper::AlignWrapper(ElementBase *elem):
ElementBase(elem->getName()), itsElement(elem), itsOffset()
{
shareFlag = false;
}
#ifndef CLASSIC_AlignWrapper_HH
#define CLASSIC_AlignWrapper_HH
// ------------------------------------------------------------------------
// $RCSfile: AlignWrapper.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AlignWrapper
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/ElementBase.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "MemoryManagement/Pointer.h"
class BeamlineVisitor;
// Class AlignWrapper
// ------------------------------------------------------------------------
/// Define the position of a misaligned element.
// An AlignWrapper is used to store misalignment errors or deliberate
// misalignments. It acts as a wrapper around a component or a complete
// beam line. Rotations and translations are defined about the design
// local frame, which in turn is specified by the position of the element
// on the design geometry. An AlignWrapper is non-sharable by default.
class AlignWrapper: public ElementBase {
friend class ElementBase;
public:
/// Apply BeamlineVisitor.
virtual void accept(BeamlineVisitor &) const;
/// Return clone.
// Return an identical deep copy of the wrapper and its contents.
virtual AlignWrapper *clone() const;
/// Make structural copy.
virtual ElementBase *copyStructure();
/// Set sharable flag.
// The whole structure depending on [b]this[/b] is marked as sharable.
// After this call a [b]copyStructure()[/b] call reuses the element.
virtual void makeSharable();
/// Get entrance patch.
// Returns the entrance patch (transformation) which is used to
// transform the global geometry to the local geometry at entrance
// of the misaligned element.
virtual Euclid3D getEntranceTransform() const;