From 086f2b701e95bf0d6c836700f950038239c6ce9f Mon Sep 17 00:00:00 2001 From: Matthias Frey <matthias.frey@psi.ch> Date: Fri, 19 Jun 2020 13:39:54 +0200 Subject: [PATCH] remove ComponentWrappers --- src/Classic/AbsBeamline/BeamlineVisitor.h | 40 ---- src/Classic/AbsBeamline/Component.h | 3 +- src/Classic/AbsBeamline/ElementBase.cpp | 62 +----- src/Classic/AbsBeamline/ElementBase.h | 58 +----- .../AbsBeamline/SpecificElementVisitor.h | 47 ----- src/Classic/Algorithms/DefaultVisitor.cpp | 32 +--- src/Classic/Algorithms/DefaultVisitor.h | 18 +- src/Classic/BeamlineCore/CorrectorRep.cpp | 43 ++--- src/Classic/BeamlineCore/CorrectorRep.h | 44 ++--- src/Classic/BeamlineCore/CyclotronRep.cpp | 39 ++-- src/Classic/BeamlineCore/CyclotronRep.h | 41 ++-- src/Classic/BeamlineCore/MultipoleRep.cpp | 42 ++-- src/Classic/BeamlineCore/MultipoleRep.h | 42 ++-- src/Classic/BeamlineCore/RBendRep.cpp | 42 ++-- src/Classic/BeamlineCore/RBendRep.h | 45 ++--- src/Classic/BeamlineCore/SBendRep.cpp | 47 ++--- src/Classic/BeamlineCore/SBendRep.h | 45 ++--- src/Classic/BeamlineCore/SingleMultipole.h | 75 ++++---- src/Classic/CMakeLists.txt | 1 - src/Classic/ComponentWrappers/CMakeLists.txt | 32 ---- .../ComponentWrappers/CorrectorWrapper.cpp | 152 --------------- .../ComponentWrappers/CorrectorWrapper.h | 131 ------------- .../ComponentWrappers/CyclotronWrapper.cpp | 169 ---------------- .../ComponentWrappers/CyclotronWrapper.h | 136 ------------- .../ComponentWrappers/MultipoleWrapper.cpp | 149 -------------- .../ComponentWrappers/MultipoleWrapper.h | 128 ------------- .../ComponentWrappers/RBendWrapper.cpp | 181 ------------------ src/Classic/ComponentWrappers/RBendWrapper.h | 161 ---------------- .../ComponentWrappers/SBendWrapper.cpp | 181 ------------------ src/Classic/ComponentWrappers/SBendWrapper.h | 161 ---------------- src/Classic/Solvers/BeamStrippingPhysics.cpp | 2 +- src/Elements/OpalBeamStripping.cpp | 6 +- src/Elements/OpalBeamStripping.h | 2 +- src/Elements/OpalBeamline.h | 4 +- src/Elements/OpalCCollimator.cpp | 6 +- src/Elements/OpalCCollimator.h | 2 +- src/Elements/OpalCavity.cpp | 22 +-- src/Elements/OpalCavity.h | 2 +- src/Elements/OpalCyclotron.cpp | 6 +- src/Elements/OpalCyclotron.h | 2 +- src/Elements/OpalDegrader.cpp | 6 +- src/Elements/OpalDegrader.h | 2 +- src/Elements/OpalECollimator.cpp | 8 +- src/Elements/OpalECollimator.h | 2 +- src/Elements/OpalElement.cpp | 4 +- src/Elements/OpalElement.h | 9 +- src/Elements/OpalFlexibleCollimator.cpp | 8 +- src/Elements/OpalFlexibleCollimator.h | 2 +- src/Elements/OpalHKicker.cpp | 25 +-- src/Elements/OpalHKicker.h | 2 +- src/Elements/OpalHMonitor.cpp | 2 +- src/Elements/OpalKicker.cpp | 26 +-- src/Elements/OpalKicker.h | 2 +- src/Elements/OpalMonitor.cpp | 2 +- src/Elements/OpalMultipole.cpp | 25 +-- src/Elements/OpalMultipole.h | 2 +- src/Elements/OpalMultipoleT.cpp | 13 +- src/Elements/OpalMultipoleT.h | 2 +- .../OpalMultipoleTCurvedConstRadius.cpp | 13 +- .../OpalMultipoleTCurvedConstRadius.h | 2 +- .../OpalMultipoleTCurvedVarRadius.cpp | 13 +- src/Elements/OpalMultipoleTCurvedVarRadius.h | 2 +- src/Elements/OpalMultipoleTStraight.cpp | 13 +- src/Elements/OpalMultipoleTStraight.h | 2 +- src/Elements/OpalOctupole.cpp | 26 +-- src/Elements/OpalOctupole.h | 2 +- .../OpalOffset/OpalGlobalCartesianOffset.cpp | 4 +- .../OpalOffset/OpalGlobalCartesianOffset.h | 2 +- .../OpalGlobalCylindricalOffset.cpp | 4 +- .../OpalOffset/OpalGlobalCylindricalOffset.h | 2 +- .../OpalOffset/OpalLocalCartesianOffset.cpp | 6 +- .../OpalOffset/OpalLocalCartesianOffset.h | 2 +- .../OpalOffset/OpalLocalCylindricalOffset.cpp | 4 +- .../OpalOffset/OpalLocalCylindricalOffset.h | 2 +- src/Elements/OpalParallelPlate.cpp | 22 +-- src/Elements/OpalParallelPlate.h | 2 +- src/Elements/OpalPepperPot.cpp | 8 +- src/Elements/OpalPepperPot.h | 2 +- src/Elements/OpalPolynomialTimeDependence.cpp | 4 +- src/Elements/OpalPolynomialTimeDependence.h | 2 +- src/Elements/OpalProbe.cpp | 6 +- src/Elements/OpalProbe.h | 2 +- src/Elements/OpalQuadrupole.cpp | 22 +-- src/Elements/OpalQuadrupole.h | 2 +- src/Elements/OpalRBend.cpp | 26 +-- src/Elements/OpalRBend.h | 2 +- src/Elements/OpalRBend3D.cpp | 10 +- src/Elements/OpalRBend3D.h | 2 +- src/Elements/OpalRCollimator.cpp | 8 +- src/Elements/OpalRCollimator.h | 2 +- src/Elements/OpalRingDefinition.cpp | 8 +- src/Elements/OpalRingDefinition.h | 2 +- src/Elements/OpalSBend.cpp | 22 +-- src/Elements/OpalSBend.h | 2 +- src/Elements/OpalSBend3D.cpp | 6 +- src/Elements/OpalSBend3D.h | 2 +- src/Elements/OpalSRot.cpp | 4 +- src/Elements/OpalSRot.h | 2 +- src/Elements/OpalScalingFFAMagnet.cpp | 6 +- src/Elements/OpalScalingFFAMagnet.h | 2 +- src/Elements/OpalSeparator.cpp | 19 +- src/Elements/OpalSeparator.h | 2 +- src/Elements/OpalSeptum.cpp | 6 +- src/Elements/OpalSeptum.h | 2 +- src/Elements/OpalSextupole.cpp | 26 +-- src/Elements/OpalSextupole.h | 2 +- src/Elements/OpalSlit.cpp | 8 +- src/Elements/OpalSlit.h | 2 +- src/Elements/OpalSolenoid.cpp | 20 +- src/Elements/OpalSolenoid.h | 2 +- src/Elements/OpalSource.cpp | 6 +- src/Elements/OpalSource.h | 2 +- src/Elements/OpalSplineTimeDependence.cpp | 4 +- src/Elements/OpalSplineTimeDependence.h | 2 +- src/Elements/OpalStripper.cpp | 6 +- src/Elements/OpalStripper.h | 2 +- src/Elements/OpalTravelingWave.cpp | 26 ++- src/Elements/OpalTravelingWave.h | 2 +- src/Elements/OpalVKicker.cpp | 26 +-- src/Elements/OpalVKicker.h | 2 +- src/Elements/OpalVMonitor.cpp | 2 +- src/Elements/OpalVariableRFCavity.cpp | 8 +- src/Elements/OpalVariableRFCavity.h | 2 +- .../OpalVariableRFCavityFringeField.cpp | 8 +- .../OpalVariableRFCavityFringeField.h | 2 +- src/Elements/OpalVerticalFFAMagnet.cpp | 6 +- src/Elements/OpalVerticalFFAMagnet.h | 2 +- src/Elements/OpalYRot.cpp | 4 +- src/Elements/OpalYRot.h | 2 +- src/Lines/Line.cpp | 2 +- src/Lines/Sequence.cpp | 4 +- src/Tables/AttList.cpp | 51 ++--- src/Tables/AttList.h | 34 ++-- src/Tables/AttWriter.cpp | 8 +- src/Tables/AttWriter.h | 4 - src/Tables/RangeSelector.cpp | 30 ++- src/Tables/RangeSelector.h | 37 ++-- .../OpalPolynomialTimeDependenceTest.cpp | 2 +- .../Elements/OpalVariableRFCavityTest.cpp | 5 +- 139 files changed, 539 insertions(+), 2661 deletions(-) delete mode 100644 src/Classic/ComponentWrappers/CMakeLists.txt delete mode 100644 src/Classic/ComponentWrappers/CorrectorWrapper.cpp delete mode 100644 src/Classic/ComponentWrappers/CorrectorWrapper.h delete mode 100644 src/Classic/ComponentWrappers/CyclotronWrapper.cpp delete mode 100644 src/Classic/ComponentWrappers/CyclotronWrapper.h delete mode 100644 src/Classic/ComponentWrappers/MultipoleWrapper.cpp delete mode 100644 src/Classic/ComponentWrappers/MultipoleWrapper.h delete mode 100644 src/Classic/ComponentWrappers/RBendWrapper.cpp delete mode 100644 src/Classic/ComponentWrappers/RBendWrapper.h delete mode 100644 src/Classic/ComponentWrappers/SBendWrapper.cpp delete mode 100644 src/Classic/ComponentWrappers/SBendWrapper.h diff --git a/src/Classic/AbsBeamline/BeamlineVisitor.h b/src/Classic/AbsBeamline/BeamlineVisitor.h index a5b46bfb8..485edbba4 100644 --- a/src/Classic/AbsBeamline/BeamlineVisitor.h +++ b/src/Classic/AbsBeamline/BeamlineVisitor.h @@ -33,37 +33,12 @@ #ifndef CLASSIC_BeamlineVisitor_HH #define CLASSIC_BeamlineVisitor_HH -// ------------------------------------------------------------------------ -// $RCSfile: BeamlineVisitor.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: BeamlineVisitor -// -// -// ------------------------------------------------------------------------ -// Class category: AbsBeamline -// ------------------------------------------------------------------------ -// -// $Date: 2000/03/27 09:32:31 $ -// $Author: fci $ -// -// ------------------------------------------------------------------------ - // Generic element classes interacting with a BeamlineVisitor. class Component; // Beam line structure classes. class Beamline; -class CorrectorWrapper; class FlaggedElmPtr; -class MultipoleWrapper; -class RBendWrapper; -class SBendWrapper; -class CyclotronWrapper; // Specific element classes interacting with a BeamlineVisitor class BeamBeam; @@ -233,21 +208,6 @@ public: /// Apply the algorithm to a FlaggedElmPtr. virtual void visitFlaggedElmPtr(const FlaggedElmPtr &) = 0; - /// Apply the algorithm to an corrector wrapper. - virtual void visitCorrectorWrapper(const CorrectorWrapper &) = 0; - - /// Apply the algorithm to an corrector wrapper. - virtual void visitCyclotronWrapper(const CyclotronWrapper &) = 0; - - /// Apply the algorithm to an multipole wrapper. - virtual void visitMultipoleWrapper(const MultipoleWrapper &) = 0; - - /// Apply the algorithm to an RBend wrapper. - virtual void visitRBendWrapper(const RBendWrapper &) = 0; - - /// Apply the algorithm to an SBend wrapper. - virtual void visitSBendWrapper(const SBendWrapper &) = 0; - /// Apply the algorithm to an ParallelPlate. virtual void visitParallelPlate(const ParallelPlate &) = 0; diff --git a/src/Classic/AbsBeamline/Component.h b/src/Classic/AbsBeamline/Component.h index 172d05838..8f9f5fa13 100644 --- a/src/Classic/AbsBeamline/Component.h +++ b/src/Classic/AbsBeamline/Component.h @@ -166,8 +166,7 @@ public: virtual std::string getComponentType() const { return ""; }; /// Return design element. - // If a component is a wrapper, this method returns a pointer to - // its underlying design element, otherwise a pointer to this component. + // If this method returns a pointer to this component. // The default version returns ``this''. virtual const ElementBase &getDesign() const; diff --git a/src/Classic/AbsBeamline/ElementBase.cpp b/src/Classic/AbsBeamline/ElementBase.cpp index 6bb134666..fe4fde06c 100644 --- a/src/Classic/AbsBeamline/ElementBase.cpp +++ b/src/Classic/AbsBeamline/ElementBase.cpp @@ -14,29 +14,9 @@ // A set of concrete accelerator element classes, which compose the standard // accelerator component library (SACL). // [LI] -// A second hierarchy which parallels the SACL, acting as container or -// wrapper-like objects. These latter classes are used to construct -// beam-lines composed of referenced ``design'' components, together with -// beam-line position dependent extrinsic state (e. g. errors). These wrapper -// objects are by default unique. // [/OL] -// Any element can have only one FieldWrapper. To be -// processed in the correct order. -// [pre] -// FieldWrapper --> Element -// [/pre] -// To ensure this structure, wrapper elements cannot be constructed directly, -// one should rather call one of: -// [dl] -// [dt]makeFieldWrapper() [dd]make a field wrapper. -// [dt]makeWrappers() [dd]make both wrappers. -// [/dl] -// An existing wrapper can be removed by -// [dl] -// [dt]removeFieldWrapper()[dd]remove field wrapper. -// [/dl] // Instances of the concrete classes for single elements are by default -// sharable. Instances of beam lines, wrappers and integrators are by +// sharable. Instances of beam lines and integrators are by // default non-sharable, but they may be made sharable by a call to // [b]makeSharable()[/b]. // [p] @@ -221,12 +201,8 @@ std::string ElementBase::getTypeString(ElementBase::ElementType type) { return "CCollimator"; case CORRECTOR: return "Corrector"; - case CORRECTORWRAPPER: - return "Correctorwrapper"; case CYCLOTRON: return "Cyclotron"; - case CYCLOTRONWRAPPER: - return "Cyclotronwrapper"; case DEGRADER: return "Degrader"; case DIAGNOSTIC: @@ -243,8 +219,6 @@ std::string ElementBase::getTypeString(ElementBase::ElementType type) { return "Monitor"; case MULTIPOLE: return "Multipole"; - case MULTIPOLEWRAPPER: - return "Multipolewrapper"; case OFFSET: return "Offset"; case PARALLELPLATE: @@ -255,8 +229,6 @@ std::string ElementBase::getTypeString(ElementBase::ElementType type) { return "Probe"; case RBEND: return "RBend"; - case RBENDWRAPPER: - return "RBendwrapper"; case RFCAVITY: return "RFCavity"; case RFQUADRUPOLE: @@ -267,8 +239,6 @@ std::string ElementBase::getTypeString(ElementBase::ElementType type) { return "SBend3D"; case SBEND: return "SBend"; - case SBENDWRAPPER: - return "SBendwrapper"; case SEPARATOR: return "Separator"; case SEPTUM: @@ -307,36 +277,6 @@ void ElementBase::makeSharable() { } -ElementBase *ElementBase::makeFieldWrapper() { - return this; -} - - -ElementBase *ElementBase::makeWrappers() { - return makeFieldWrapper(); -} - - -ElementBase *ElementBase::removeFieldWrapper() { - return this; -} - - -const ElementBase *ElementBase::removeFieldWrapper() const { - return this; -} - - -ElementBase *ElementBase::removeWrappers() { - return this; -} - - -const ElementBase *ElementBase::removeWrappers() const { - return this; -} - - bool ElementBase::update(const AttributeSet &set) { for(AttributeSet::const_iterator i = set.begin(); i != set.end(); ++i) { setAttribute(i->first, i->second); diff --git a/src/Classic/AbsBeamline/ElementBase.h b/src/Classic/AbsBeamline/ElementBase.h index 751f4524f..b7fc610bd 100644 --- a/src/Classic/AbsBeamline/ElementBase.h +++ b/src/Classic/AbsBeamline/ElementBase.h @@ -14,29 +14,9 @@ // A set of concrete accelerator element classes, which compose the standard // accelerator component library (SACL). // [LI] -// A second hierarchy which parallels the SACL, acting as container or -// wrapper-like objects. These latter classes are used to construct -// beam-lines composed of referenced ``design'' components, together with -// beam-line position dependent extrinsic state (e. g. errors). These wrapper -// objects are by default unique. // [/OL] -// Any element can have only one FieldWrapper. To be -// processed in the correct order. -// [pre] -// FieldWrapper --> Element -// [/pre] -// To ensure this structure, wrapper elements cannot be constructed directly, -// one should rather call one of: -// [dl] -// [dt]makeFieldWrapper() [dd]make a field wrapper. -// [dt]makeWrappers() [dd]make both wrappers. -// [/dl] -// An existing wrapper can be removed by -// [dl] -// [dt]removeFieldWrapper()[dd]remove field wrapper. -// [/dl] // Instances of the concrete classes for single elements are by default -// sharable. Instances of beam lines, wrappers and integrators are by +// sharable. Instances of beam lines and integrators are by // default non-sharable, but they may be made sharable by a call to // [b]makeSharable()[/b]. // [p] @@ -130,9 +110,7 @@ public: , BEAMSTRIPPING , CCOLLIMATOR , CORRECTOR - , CORRECTORWRAPPER , CYCLOTRON - , CYCLOTRONWRAPPER , DEGRADER , DIAGNOSTIC , DRIFT @@ -144,20 +122,17 @@ public: , MPSPLITINTEGRATOR , MULTIPOLE , MULTIPOLET - , MULTIPOLEWRAPPER , OFFSET , PARALLELPLATE , PATCH , PROBE , RBEND , RBEND3D - , RBENDWRAPPER , RFCAVITY , RFQUADRUPOLE , RING , SBEND3D , SBEND - , SBENDWRAPPER , SEPARATOR , SEPTUM , SOLENOID @@ -318,37 +293,6 @@ public: // After this call a [b]copyStructure()[/b] call reuses the element. virtual void makeSharable(); - /// Allow field errors. - // Build a FieldWrapper pointing to the element and return a pointer to - // that wrapper. If the element cannot have field errors, or already has - // a FieldWrapper, return a pointer to the element. - // Wrappers are non-sharable, unless otherwise defined. - virtual ElementBase *makeFieldWrapper(); - - /// Allow errors. - // Equivalent to the calls - // [pre] - // makeFieldWrapper() - // [/pre]. - // Wrappers are non-sharable, unless otherwise defined. - virtual ElementBase *makeWrappers(); - - /// Remove field wrapper. - // Remove the field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - // Remove the field wrapper for constant object. - virtual const ElementBase *removeFieldWrapper() const; - - /// Return the design element. - // Return [b]this[/b], if the element is not wrapped. - virtual ElementBase *removeWrappers(); - - /// Return the design element. - // Return [b]this[/b], if the element is not wrapped. - virtual const ElementBase *removeWrappers() const ; - /// Update element. // This method stores all attributes contained in the AttributeSet to // "*this". The return value [b]true[/b] indicates success. diff --git a/src/Classic/AbsBeamline/SpecificElementVisitor.h b/src/Classic/AbsBeamline/SpecificElementVisitor.h index 2e3dae54e..9ff6f1645 100644 --- a/src/Classic/AbsBeamline/SpecificElementVisitor.h +++ b/src/Classic/AbsBeamline/SpecificElementVisitor.h @@ -64,12 +64,6 @@ #include "Beamlines/Beamline.h" #include "Beamlines/FlaggedElmPtr.h" -#include "ComponentWrappers/CorrectorWrapper.h" -#include "ComponentWrappers/CyclotronWrapper.h" -#include "ComponentWrappers/MultipoleWrapper.h" -#include "ComponentWrappers/RBendWrapper.h" -#include "ComponentWrappers/SBendWrapper.h" - template <class ELEM1, class ELEM2> struct CastsTrait { typedef std::list<const ELEM1*> ElementList_t; @@ -219,22 +213,6 @@ public: /// Apply the algorithm to a FlaggedElmPtr. virtual void visitFlaggedElmPtr(const FlaggedElmPtr &); - /// Apply the algorithm to an corrector wrapper.. - virtual void visitCorrectorWrapper(const CorrectorWrapper &); - - /// Apply the algorithm to an cyclotron wrapper.. - virtual void visitCyclotronWrapper(const CyclotronWrapper &); - - /// Apply the algorithm to an multipole wrapper.. - virtual void visitMultipoleWrapper(const MultipoleWrapper &); - - /// Apply the algorithm to an RBend wrapper.. - virtual void visitRBendWrapper(const RBendWrapper &); - - /// Apply the algorithm to an SBend wrapper.. - virtual void visitSBendWrapper(const SBendWrapper &); - - /// Apply the algorithm to a generic integrator. virtual void visitIntegrator(const Integrator &); @@ -481,31 +459,6 @@ void SpecificElementVisitor<ELEM>::visitFlaggedElmPtr(const FlaggedElmPtr &eleme wrappedElement->accept(*this); } -template<class ELEM> -void SpecificElementVisitor<ELEM>::visitCorrectorWrapper(const CorrectorWrapper &element) { - CastsTrait<ELEM, CorrectorWrapper>::apply(allElementsOfTypeE, element); -} - -template<class ELEM> -void SpecificElementVisitor<ELEM>::visitCyclotronWrapper(const CyclotronWrapper &element) { - CastsTrait<ELEM, CyclotronWrapper>::apply(allElementsOfTypeE, element); -} - -template<class ELEM> -void SpecificElementVisitor<ELEM>::visitMultipoleWrapper(const MultipoleWrapper &element) { - CastsTrait<ELEM, MultipoleWrapper>::apply(allElementsOfTypeE, element); -} - -template<class ELEM> -void SpecificElementVisitor<ELEM>::visitRBendWrapper(const RBendWrapper &element) { - CastsTrait<ELEM, RBendWrapper>::apply(allElementsOfTypeE, element); -} - -template<class ELEM> -void SpecificElementVisitor<ELEM>::visitSBendWrapper(const SBendWrapper &element) { - CastsTrait<ELEM, SBendWrapper>::apply(allElementsOfTypeE, element); -} - template<class ELEM> void SpecificElementVisitor<ELEM>::visitIntegrator(const Integrator & /*elem*/) { } diff --git a/src/Classic/Algorithms/DefaultVisitor.cpp b/src/Classic/Algorithms/DefaultVisitor.cpp index 17a3510e7..dac6d0994 100644 --- a/src/Classic/Algorithms/DefaultVisitor.cpp +++ b/src/Classic/Algorithms/DefaultVisitor.cpp @@ -4,7 +4,7 @@ // A default implementation for all visitors that can iterate over a // beam line representation. // This abstract base class implements the default behaviour for the -// structural classes Beamline and FlaggedElmPtr, and for all wrappers. +// structural classes Beamline and FlaggedElmPtr. // It also holds the data required for all visitors in a protected area. // // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland @@ -65,12 +65,6 @@ #include "Beamlines/Beamline.h" #include "Beamlines/FlaggedElmPtr.h" -#include "ComponentWrappers/CorrectorWrapper.h" -#include "ComponentWrappers/MultipoleWrapper.h" -#include "ComponentWrappers/RBendWrapper.h" -#include "ComponentWrappers/SBendWrapper.h" -#include "ComponentWrappers/CyclotronWrapper.h" - #include "AbsBeamline/Ring.h" // OPAL file // Class DefaultVisitor @@ -280,30 +274,6 @@ void DefaultVisitor::visitFlaggedElmPtr(const FlaggedElmPtr &fep) { } -void DefaultVisitor::visitCorrectorWrapper(const CorrectorWrapper &wrap) { - visitCorrector(wrap); -} - -void DefaultVisitor::visitCyclotronWrapper(const CyclotronWrapper &wrap) { - visitCyclotron(wrap); -} - - -void DefaultVisitor::visitMultipoleWrapper(const MultipoleWrapper &wrap) { - visitMultipole(wrap); -} - - -void DefaultVisitor::visitRBendWrapper(const RBendWrapper &wrap) { - visitRBend(wrap); -} - - -void DefaultVisitor::visitSBendWrapper(const SBendWrapper &wrap) { - visitSBend(wrap); -} - - void DefaultVisitor::visitIntegrator(const Integrator &i) { // Default: cannot use integrator. i.getElement()->accept(*this); diff --git a/src/Classic/Algorithms/DefaultVisitor.h b/src/Classic/Algorithms/DefaultVisitor.h index f6c0c52ad..153c00362 100644 --- a/src/Classic/Algorithms/DefaultVisitor.h +++ b/src/Classic/Algorithms/DefaultVisitor.h @@ -4,7 +4,7 @@ // A default implementation for all visitors that can iterate over a // beam line representation. // This abstract base class implements the default behaviour for the -// structural classes Beamline and FlaggedElmPtr, and for all wrappers. +// structural classes Beamline and FlaggedElmPtr. // It also holds the data required for all visitors in a protected area. // // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland @@ -168,22 +168,6 @@ public: /// Apply the algorithm to a FlaggedElmPtr. virtual void visitFlaggedElmPtr(const FlaggedElmPtr &); - /// Apply the algorithm to an corrector wrapper.. - virtual void visitCorrectorWrapper(const CorrectorWrapper &); - - /// Apply the algorithm to an cyclotron wrapper.. - virtual void visitCyclotronWrapper(const CyclotronWrapper &); - - /// Apply the algorithm to an multipole wrapper.. - virtual void visitMultipoleWrapper(const MultipoleWrapper &); - - /// Apply the algorithm to an RBend wrapper.. - virtual void visitRBendWrapper(const RBendWrapper &); - - /// Apply the algorithm to an SBend wrapper.. - virtual void visitSBendWrapper(const SBendWrapper &); - - /// Apply the algorithm to a generic integrator. virtual void visitIntegrator(const Integrator &); diff --git a/src/Classic/BeamlineCore/CorrectorRep.cpp b/src/Classic/BeamlineCore/CorrectorRep.cpp index bf3878677..26978d154 100644 --- a/src/Classic/BeamlineCore/CorrectorRep.cpp +++ b/src/Classic/BeamlineCore/CorrectorRep.cpp @@ -1,28 +1,24 @@ -// ------------------------------------------------------------------------ -// $RCSfile: CorrectorRep.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: CorrectorRep -// Defines a concrete representation for an orbit corrector acting on -// both planes. +// Class CorrectorRep +// Representation of a closed orbit corrector. +// The base class acts on both planes. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2000/03/27 09:32:33 $ -// $Author: fci $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "BeamlineCore/CorrectorRep.h" #include "AbsBeamline/ElementImage.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/CorrectorWrapper.h" // Attribute access table. @@ -56,9 +52,6 @@ namespace { } -// Class CorrectorRep -// ------------------------------------------------------------------------ - CorrectorRep::CorrectorRep(): Corrector(), geometry(), field(), active(true) {} @@ -149,14 +142,6 @@ void CorrectorRep::setBy(double By) { field.setBy(By); } - -ElementBase *CorrectorRep::makeFieldWrapper() { - ElementBase *wrap = new CorrectorWrapper(this); - wrap->setName(getName()); - return wrap; -} - - void CorrectorRep::setActive(bool flag) { active = flag; } diff --git a/src/Classic/BeamlineCore/CorrectorRep.h b/src/Classic/BeamlineCore/CorrectorRep.h index 24528a24c..9955dd7e2 100644 --- a/src/Classic/BeamlineCore/CorrectorRep.h +++ b/src/Classic/BeamlineCore/CorrectorRep.h @@ -1,35 +1,28 @@ -#ifndef CLASSIC_CorrectorRep_HH -#define CLASSIC_CorrectorRep_HH - -// ------------------------------------------------------------------------ -// $RCSfile: CorrectorRep.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: CorrectorRep +// Class CorrectorRep +// Representation of a closed orbit corrector. +// The base class acts on both planes. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved +// +// This file is part of OPAL. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// $Date: 2000/03/27 09:32:33 $ -// $Author: fci $ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ +#ifndef CLASSIC_CorrectorRep_HH +#define CLASSIC_CorrectorRep_HH #include "AbsBeamline/Corrector.h" #include "BeamlineGeometry/StraightGeometry.h" #include "Fields/BDipoleField.h" - -// Class CorrectorRep -// ------------------------------------------------------------------------ -/// Representation of a closed orbit corrector. -// The base class acts on both planes. - class CorrectorRep: public Corrector { public: @@ -87,11 +80,6 @@ public: /// Set vertical field component in Teslas. virtual void setBy(double); - /// Allow field errors. - // Build a FieldWrapper pointing to the corrector and return a pointer to - // that wrapper. - virtual ElementBase *makeFieldWrapper(); - /// Set active flag. // If [b]flag[/b] is true, the corrector is activated, // otherwise deactivated. diff --git a/src/Classic/BeamlineCore/CyclotronRep.cpp b/src/Classic/BeamlineCore/CyclotronRep.cpp index 4dc503eb4..1d5505fa6 100644 --- a/src/Classic/BeamlineCore/CyclotronRep.cpp +++ b/src/Classic/BeamlineCore/CyclotronRep.cpp @@ -1,27 +1,23 @@ -// ------------------------------------------------------------------------ -// $RCSfile: CyclotronRep.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.2.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: CyclotronRep -// Defines a concrete representation for a cyclotron. +// Class CyclotronRep +// Representation for a cyclotron magnet system // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2004/11/12 18:57:53 $ -// $Author: adelmann $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "BeamlineCore/CyclotronRep.h" #include "AbsBeamline/ElementImage.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/CyclotronWrapper.h" // Attribute access table. // ------------------------------------------------------------------------ @@ -44,9 +40,6 @@ namespace { } -// Class CyclotronRep -// ------------------------------------------------------------------------ - CyclotronRep::CyclotronRep(): Cyclotron(), geometry(0.0, 0.0), @@ -139,9 +132,3 @@ void CyclotronRep::setField(const BMultipoleField &f) { field = f; } -ElementBase *CyclotronRep::makeFieldWrapper() { - ElementBase *wrap = new CyclotronWrapper(this); - wrap->setName(getName()); - return wrap; -} - diff --git a/src/Classic/BeamlineCore/CyclotronRep.h b/src/Classic/BeamlineCore/CyclotronRep.h index 6a419f618..bfc5e4303 100644 --- a/src/Classic/BeamlineCore/CyclotronRep.h +++ b/src/Classic/BeamlineCore/CyclotronRep.h @@ -1,34 +1,28 @@ -#ifndef CLASSIC_CyclotronRep_HH -#define CLASSIC_CyclotronRep_HH - -// ------------------------------------------------------------------------ -// $RCSfile: CyclotronRep.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: CyclotronRep +// Class CyclotronRep +// Representation for a cyclotron magnet system +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved +// +// This file is part of OPAL. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ +#ifndef CLASSIC_CyclotronRep_HH +#define CLASSIC_CyclotronRep_HH #include "AbsBeamline/Cyclotron.h" #include "BeamlineGeometry/PlanarArcGeometry.h" #include "Fields/BMultipoleField.h" -// Class CyclotronRep -// ------------------------------------------------------------------------ -/// Representation for a cyclotron magnet system - class CyclotronRep: public Cyclotron { public: @@ -58,11 +52,6 @@ public: // Assign the vertical component of the field in Teslas. // virtual void setRadius(double r); - /// Allow field errors. - // Build a FieldWrapper pointing to the bend and return a pointer to - // that wrapper. - virtual ElementBase *makeFieldWrapper(); - /// Get number of slices. virtual double getSlices() const; diff --git a/src/Classic/BeamlineCore/MultipoleRep.cpp b/src/Classic/BeamlineCore/MultipoleRep.cpp index 8ee0f82fe..f829af6b0 100644 --- a/src/Classic/BeamlineCore/MultipoleRep.cpp +++ b/src/Classic/BeamlineCore/MultipoleRep.cpp @@ -1,28 +1,24 @@ -// ------------------------------------------------------------------------ -// $RCSfile: MultipoleRep.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.2 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: MultipoleRep -// Defines a concrete representation for a general multipole. +// Class MultipoleRep +// Representation for a general multipole. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2001/08/24 19:31:20 $ -// $Author: jsberg $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "BeamlineCore/MultipoleRep.h" #include "AbsBeamline/ElementImage.h" #include "Channels/IndexedChannel.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include <cctype> // Attribute access table. @@ -46,9 +42,6 @@ namespace { } -// Class MultipoleRep -// ------------------------------------------------------------------------ - MultipoleRep::MultipoleRep(): Multipole(), geometry(), @@ -171,11 +164,4 @@ const BMultipoleField &MultipoleRep::getField() const { void MultipoleRep::setField(const BMultipoleField &aField) { field = aField; -} - - -ElementBase *MultipoleRep::makeFieldWrapper() { - ElementBase *wrap = new MultipoleWrapper(this); - wrap->setName(getName()); - return wrap; -} +} \ No newline at end of file diff --git a/src/Classic/BeamlineCore/MultipoleRep.h b/src/Classic/BeamlineCore/MultipoleRep.h index 10f2eac7a..6c6690219 100644 --- a/src/Classic/BeamlineCore/MultipoleRep.h +++ b/src/Classic/BeamlineCore/MultipoleRep.h @@ -1,33 +1,26 @@ -#ifndef CLASSIC_MultipoleRep_HH -#define CLASSIC_MultipoleRep_HH - -// ------------------------------------------------------------------------ -// $RCSfile: MultipoleRep.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: MultipoleRep +// Class MultipoleRep +// Representation for a general multipole. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved +// +// This file is part of OPAL. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// $Date: 2000/03/27 09:32:33 $ -// $Author: fci $ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ +#ifndef CLASSIC_MultipoleRep_HH +#define CLASSIC_MultipoleRep_HH #include "AbsBeamline/Multipole.h" #include "BeamlineGeometry/StraightGeometry.h" - -// Class MultipoleRep -// ------------------------------------------------------------------------ -/// Representation for a general multipole. - class MultipoleRep: public Multipole { public: @@ -75,11 +68,6 @@ public: /// Set mulitpole field. virtual void setField(const BMultipoleField &field); - /// Allow field errors. - // Build a FieldWrapper pointing to the multipole and return a pointer to - // that wrapper. - virtual ElementBase *makeFieldWrapper(); - private: /// Multipole geometry. diff --git a/src/Classic/BeamlineCore/RBendRep.cpp b/src/Classic/BeamlineCore/RBendRep.cpp index 76ea92f9f..8096f02c7 100644 --- a/src/Classic/BeamlineCore/RBendRep.cpp +++ b/src/Classic/BeamlineCore/RBendRep.cpp @@ -1,28 +1,26 @@ -// ------------------------------------------------------------------------ -// $RCSfile: RBendRep.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.2.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: RBendRep -// Defines a concrete representation for rectangular (straight) bend. +// Class RBendRep +// Representation for a rectangular bend magnet. +// A rectangular bend magnet has a rectilinear geometry about which its +// multipole components are specified. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2004/11/12 18:57:53 $ -// $Author: adelmann $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "BeamlineCore/RBendRep.h" #include "AbsBeamline/ElementImage.h" #include "Channels/IndexedChannel.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/RBendWrapper.h" #include <cctype> // Attribute access table. @@ -46,9 +44,6 @@ namespace { } -// Class RBendRep -// ------------------------------------------------------------------------ - RBendRep::RBendRep(): RBend(), geometry(0.0, 0.0), @@ -181,11 +176,4 @@ void RBendRep::setStepsize(double ds) { void RBendRep::setField(const BMultipoleField &f) { field = f; -} - - -ElementBase *RBendRep::makeFieldWrapper() { - ElementBase *wrap = new RBendWrapper(this); - wrap->setName(getName()); - return wrap; } \ No newline at end of file diff --git a/src/Classic/BeamlineCore/RBendRep.h b/src/Classic/BeamlineCore/RBendRep.h index e90e9c77e..48d128ce6 100644 --- a/src/Classic/BeamlineCore/RBendRep.h +++ b/src/Classic/BeamlineCore/RBendRep.h @@ -1,36 +1,30 @@ -#ifndef CLASSIC_RBendRep_HH -#define CLASSIC_RBendRep_HH - -// ------------------------------------------------------------------------ -// $RCSfile: RBendRep.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: RBendRep +// Class RBendRep +// Representation for a rectangular bend magnet. +// A rectangular bend magnet has a rectilinear geometry about which its +// multipole components are specified. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved +// +// This file is part of OPAL. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// $Date: 2004/11/12 18:57:53 $ -// $Author: adelmann $ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ +#ifndef CLASSIC_RBendRep_HH +#define CLASSIC_RBendRep_HH #include "AbsBeamline/RBend.h" #include "BeamlineGeometry/RBendGeometry.h" #include "Fields/BMultipoleField.h" -// Class RBendRep -// ------------------------------------------------------------------------ -/// Representation for a rectangular bend magnet. -// A rectangular bend magnet has a rectilinear geometry about which its -// multipole components are specified. - class RBendRep: public RBend { public: @@ -85,11 +79,6 @@ public: // Assign the multipole expansion. virtual void setField(const BMultipoleField &field); - /// Allow field errors. - // Build a FieldWrapper pointing to the bend and return a pointer to - // that wrapper. - virtual ElementBase *makeFieldWrapper(); - /// Get pole entry face rotation. // Return the rotation of the entry pole face with respect to the x-axis. // A positive angle rotates the pole face normal away from the centre diff --git a/src/Classic/BeamlineCore/SBendRep.cpp b/src/Classic/BeamlineCore/SBendRep.cpp index 5b859f5b8..f18e19547 100644 --- a/src/Classic/BeamlineCore/SBendRep.cpp +++ b/src/Classic/BeamlineCore/SBendRep.cpp @@ -1,33 +1,28 @@ -// ------------------------------------------------------------------------ -// $RCSfile: SBendRep.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.2.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: SBendRep -// Defines a concrete representation for a sector (curved) bend. +// Class SBendRep +// Representation for a sector bend magnet. +// A sector bend magnet has a planar arc geometry about which its +// multipole components are specified. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2004/11/12 18:57:53 $ -// $Author: adelmann $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "BeamlineCore/SBendRep.h" #include "AbsBeamline/ElementImage.h" #include "Channels/IndexedChannel.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/SBendWrapper.h" #include <cctype> -// Attribute access table. -// ------------------------------------------------------------------------ - namespace { struct Entry { const char *name; @@ -71,9 +66,6 @@ namespace { } -// Class SBendRep -// ------------------------------------------------------------------------ - SBendRep::SBendRep(): SBend(), geometry(0.0, 0.0), @@ -260,11 +252,4 @@ void SBendRep::setStepsize(double ds) { void SBendRep::setField(const BMultipoleField &f) { field = f; -} - - -ElementBase *SBendRep::makeFieldWrapper() { - ElementBase *wrap = new SBendWrapper(this); - wrap->setName(getName()); - return wrap; -} +} \ No newline at end of file diff --git a/src/Classic/BeamlineCore/SBendRep.h b/src/Classic/BeamlineCore/SBendRep.h index eba1362e3..575f758fe 100644 --- a/src/Classic/BeamlineCore/SBendRep.h +++ b/src/Classic/BeamlineCore/SBendRep.h @@ -1,36 +1,30 @@ -#ifndef CLASSIC_SBendRep_HH -#define CLASSIC_SBendRep_HH - -// ------------------------------------------------------------------------ -// $RCSfile: SBendRep.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: SBendRep +// Class SBendRep +// Representation for a sector bend magnet. +// A sector bend magnet has a planar arc geometry about which its +// multipole components are specified. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved +// +// This file is part of OPAL. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ +#ifndef CLASSIC_SBendRep_HH +#define CLASSIC_SBendRep_HH #include "AbsBeamline/SBend.h" #include "BeamlineGeometry/PlanarArcGeometry.h" #include "Fields/BMultipoleField.h" -// Class SBendRep -// ------------------------------------------------------------------------ -/// Representation for a sector bend magnet. -// A sector bend magnet has a planar arc geometry about which its -// multipole components are specified. - class SBendRep: public SBend { public: @@ -85,11 +79,6 @@ public: // Assign the multipole expansion. virtual void setField(const BMultipoleField &field); - /// Allow field errors. - // Build a FieldWrapper pointing to the bend and return a pointer to - // that wrapper. - virtual ElementBase *makeFieldWrapper(); - /// Get pole entry face rotation. // Return the rotation of the entry pole face with respect to the x-axis. // A positive angle rotates the pole face normal away from the centre diff --git a/src/Classic/BeamlineCore/SingleMultipole.h b/src/Classic/BeamlineCore/SingleMultipole.h index bc7a2a62e..5117d8d3d 100644 --- a/src/Classic/BeamlineCore/SingleMultipole.h +++ b/src/Classic/BeamlineCore/SingleMultipole.h @@ -1,56 +1,49 @@ -#ifndef CLASSIC_SingleMultipole_HH -#define CLASSIC_SingleMultipole_HH - -// ------------------------------------------------------------------------ -// $RCSfile: SingleMultipole.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Template class: SingleMultipole +// Class SingleMultipole +// Representation for single multipoles. +// Template for representation of single multipoles. +// Represents all the basic (design) multipole magnets found in an +// accelerator. A single multipole has only one multipole component, +// the pole-number of which cannot be changed (once a quadrupole, always +// a quadrupole). This differs from a MultipoleRep object which can +// have an arbitrary number of multipole components. +// [P] +// This template class can be used to instantiate classes like: +// [UL] +// [LI]Quadrupole (order = 2), +// [LI]Sextupole (order = 3), +// [LI]Octupole (order = 4), +// [LI]SkewQuadrupole (order = -2), +// [LI]SkewSextupole (order = -3), +// [LI]SkewOctupole (order = -4). +// [/UL] +// The order and the skew flag are encoded in the template parameter. +// A positive [b]order[/b] implies a normal multipole, +// A negative [b]order[/b] implies a skew multipole. // -// ------------------------------------------------------------------------ -// Class category: BeamlineCore -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2000/03/27 09:32:34 $ -// $Author: fci $ +// This file is part of OPAL. // -// ------------------------------------------------------------------------ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. +// +#ifndef CLASSIC_SingleMultipole_HH +#define CLASSIC_SingleMultipole_HH #include "AbsBeamline/Multipole.h" #include "AbsBeamline/ElementImage.h" #include "BeamlineGeometry/StraightGeometry.h" #include "Channels/IndirectChannel.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Fields/BSingleMultipoleField.h" -// Template class SingleMultipole -// ------------------------------------------------------------------------ -/// Representation for single multipoles. -// Template for representation of single multipoles. -// Represents all the basic (design) multipole magnets found in an -// accelerator. A single multipole has only one multipole component, -// the pole-number of which cannot be changed (once a quadrupole, always -// a quadrupole). This differs from a MultipoleRep object which can -// have an arbitrary number of multipole components. -// [P] -// This template class can be used to instantiate classes like: -// [UL] -// [LI]Quadrupole (order = 2), -// [LI]Sextupole (order = 3), -// [LI]Octupole (order = 4), -// [LI]SkewQuadrupole (order = -2), -// [LI]SkewSextupole (order = -3), -// [LI]SkewOctupole (order = -4). -// [/UL] -// The order and the skew flag are encoded in the template parameter. -// A positive [b]order[/b] implies a normal multipole, -// A negative [b]order[/b] implies a skew multipole. - template <int order> class SingleMultipole: public Multipole { diff --git a/src/Classic/CMakeLists.txt b/src/Classic/CMakeLists.txt index ca30bd751..954849b84 100644 --- a/src/Classic/CMakeLists.txt +++ b/src/Classic/CMakeLists.txt @@ -7,7 +7,6 @@ add_subdirectory(BeamlineCore) add_subdirectory(BeamlineGeometry) add_subdirectory(Beamlines) add_subdirectory(Channels) -add_subdirectory(ComponentWrappers) add_subdirectory(Construction) add_subdirectory(Fields) add_subdirectory(Filters) diff --git a/src/Classic/ComponentWrappers/CMakeLists.txt b/src/Classic/ComponentWrappers/CMakeLists.txt deleted file mode 100644 index 601805fc5..000000000 --- a/src/Classic/ComponentWrappers/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -set (_SRCS - CorrectorWrapper.cpp - MultipoleWrapper.cpp - SBendWrapper.cpp - RBendWrapper.cpp - CyclotronWrapper.cpp - ) - -include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR} - ) - -add_opal_sources (${_SRCS}) - -set (HDRS - CorrectorWrapper.h - CyclotronWrapper.h - MultipoleWrapper.h - RBendWrapper.h - SBendWrapper.h - ) - -install (FILES ${HDRS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/ComponentWrappers") - -# vi: set et ts=4 sw=4 sts=4: - -# Local Variables: -# mode: cmake -# cmake-tab-width: 4 -# indent-tabs-mode: nil -# require-final-newline: nil -# End: diff --git a/src/Classic/ComponentWrappers/CorrectorWrapper.cpp b/src/Classic/ComponentWrappers/CorrectorWrapper.cpp deleted file mode 100644 index f9489bfd8..000000000 --- a/src/Classic/ComponentWrappers/CorrectorWrapper.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// ------------------------------------------------------------------------ -// $RCSfile: CorrectorWrapper.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: CorrectorWrapper -// Defines a representation for a modified corrector. -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2000/03/27 09:32:35 $ -// $Author: fci $ -// -// ------------------------------------------------------------------------ - -#include "ComponentWrappers/CorrectorWrapper.h" -#include "AbsBeamline/BeamlineVisitor.h" - - -// Class CorrectorWrapper -// A CorrectorWrapper represents a unique instance of a corrector magnet -// in the accelerator model. -// ------------------------------------------------------------------------ - -CorrectorWrapper::CorrectorWrapper(Corrector *corr): - Corrector(*corr), - itsDesign(corr), - itsError(), - tempField() { - shareFlag = false; -} - - -CorrectorWrapper::CorrectorWrapper(const CorrectorWrapper &rhs): - Corrector(rhs), - itsDesign(rhs.itsDesign), - itsError(rhs.itsError), - tempField() { - shareFlag = false; -} - - -CorrectorWrapper::~CorrectorWrapper() -{} - - -void CorrectorWrapper::accept(BeamlineVisitor &visitor) const { - visitor.visitCorrectorWrapper(*this); -} - - -ElementBase *CorrectorWrapper::clone() const { - CorrectorWrapper *cw = new CorrectorWrapper(*this); - cw->itsDesign = dynamic_cast<Corrector *>(itsDesign->clone()); - return cw; -} - - -ElementBase *CorrectorWrapper::copyStructure() { - if(isSharable()) { - return this; - } else { - CorrectorWrapper *cw = new CorrectorWrapper(*this); - cw->itsDesign = dynamic_cast<Corrector *>(itsDesign->copyStructure()); - return cw; - } -} - - -void CorrectorWrapper::makeSharable() { - shareFlag = true; - itsDesign->makeSharable(); -} - - -StraightGeometry &CorrectorWrapper::getGeometry() { - return itsDesign->getGeometry(); -} - - -const StraightGeometry &CorrectorWrapper::getGeometry() const { - return itsDesign->getGeometry(); -} - - -Corrector::Plane CorrectorWrapper::getPlane() const { - return itsDesign->getPlane(); -} - - -ElementBase::ElementType CorrectorWrapper::getType() const { - return CORRECTORWRAPPER; -} - - -const Corrector &CorrectorWrapper::getDesign() const { - return *itsDesign; -} - - -Corrector &CorrectorWrapper::getDesign() { - return *itsDesign; -} - - -BDipoleField &CorrectorWrapper::errorField() const { - return itsError; -} - - -ElementBase *CorrectorWrapper::makeFieldWrapper() { - return this; -} - - -ElementBase *CorrectorWrapper::removeFieldWrapper() { - return &*itsDesign; -} - - -const ElementBase *CorrectorWrapper::removeFieldWrapper() const { - return &*itsDesign; -} - - -ElementBase *CorrectorWrapper::removeWrappers() { - return &*itsDesign; -} - - -const ElementBase *CorrectorWrapper::removeWrappers() const { - return &*itsDesign; -} - - -BDipoleField &CorrectorWrapper::getField() { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -const BDipoleField &CorrectorWrapper::getField() const { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/CorrectorWrapper.h b/src/Classic/ComponentWrappers/CorrectorWrapper.h deleted file mode 100644 index 7929de27f..000000000 --- a/src/Classic/ComponentWrappers/CorrectorWrapper.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef CLASSIC_CorrectorWrapper_HH -#define CLASSIC_CorrectorWrapper_HH - -// ------------------------------------------------------------------------ -// $RCSfile: CorrectorWrapper.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: CorrectorWrapper -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2000/03/27 09:32:35 $ -// $Author: fci $ -// -// ------------------------------------------------------------------------ - -#include "AbsBeamline/Corrector.h" -#include "Fields/BDipoleField.h" -#include "MemoryManagement/Pointer.h" - -class BDipoleField; - - -// Class CorrectorWrapper -// ------------------------------------------------------------------------ -/// Representation for a perturbed closed orbit corrector. -// A CorrectorWrapper represents a unique instance of a corrector magnet -// in the accelerator model. It defines imperfections of the field, -// related to an ``ideal'' magnet contained in the wrapper. - -class CorrectorWrapper: public Corrector { - -public: - - /// Constructor. - // Construct a wrapper for the argument. - // The wrapper is not sharable by default. - CorrectorWrapper(Corrector *); - - CorrectorWrapper(const CorrectorWrapper &); - virtual ~CorrectorWrapper(); - - - /// Apply visitor to modified corrector. - virtual void accept(BeamlineVisitor &) const; - - /// Make clone. - virtual ElementBase *clone() const; - - /// Make structural copy. - virtual ElementBase *copyStructure(); - - /// Get corrector field error. - // This method can be used to get or set the error field. The error field - // offset is mutable, so as to allow changing it in a constant structure. - virtual BDipoleField &errorField() const; - - /// 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 corrector field. - // Version for non-constant object. - virtual BDipoleField &getField(); - - /// Get corrector field. - // Version for constant object. - virtual const BDipoleField &getField() const; - - /// Get geometry. - // Version for non-constant object. - virtual StraightGeometry &getGeometry(); - - /// Get geometry. - // Version for constant object. - virtual const StraightGeometry &getGeometry() const; - - /// Get plane of action. - virtual Plane getPlane() const; - - /// Get element type string. - virtual ElementBase::ElementType getType() const; - - /// Get design corrector. - // Version for constant object. - virtual const Corrector &getDesign() const; - - /// Get design corrector. - // Version for non-constant object. - virtual Corrector &getDesign(); - - /// Make wrapper for this corrector. - // Return [b]this[/b], since this is already a field wrapper. - virtual ElementBase *makeFieldWrapper(); - - /// Remove field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - virtual const ElementBase *removeFieldWrapper() const; - - /// Remove all wrappers. - virtual ElementBase *removeWrappers(); - - /// Remove all wrappers. - virtual const ElementBase *removeWrappers() const; - -private: - - // Not implemented. - CorrectorWrapper(); - void operator=(const CorrectorWrapper &); - - // The pointer to the ``design'' magnet. - Pointer<Corrector> itsDesign; - - /// The field modifiers. - mutable BDipoleField itsError; - - // The magnetic field after application of error. - mutable BDipoleField tempField; -}; - -#endif // CLASSIC_CorrectorWrapper_HH \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/CyclotronWrapper.cpp b/src/Classic/ComponentWrappers/CyclotronWrapper.cpp deleted file mode 100644 index c145fcb5c..000000000 --- a/src/Classic/ComponentWrappers/CyclotronWrapper.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// ------------------------------------------------------------------------ -// $RCSfile: CyclotronWrapper.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: CyclotronWrapper -// Defines a representation for a modified Cyclotron. -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "ComponentWrappers/CyclotronWrapper.h" -#include "AbsBeamline/BeamlineVisitor.h" - - -// Class CyclotronWrapper -// ------------------------------------------------------------------------ - -CyclotronWrapper::CyclotronWrapper(Cyclotron *ideal): - Cyclotron(*ideal), - itsDesign(ideal), - itsError(), - tempField() { - shareFlag = false; -} - - -CyclotronWrapper::CyclotronWrapper(const CyclotronWrapper &rhs): - Cyclotron(rhs), - itsDesign(rhs.itsDesign), - itsError(rhs.itsError), - tempField() { - shareFlag = false; -} - - -CyclotronWrapper::~CyclotronWrapper() -{} - - -void CyclotronWrapper::accept(BeamlineVisitor &visitor) const { - visitor.visitCyclotronWrapper(*this); -} - - -ElementBase *CyclotronWrapper::clone() const { - CyclotronWrapper *sbw = new CyclotronWrapper(*this); - sbw->itsDesign = dynamic_cast<Cyclotron *>(itsDesign->clone()); - return sbw; -} - - -ElementBase *CyclotronWrapper::copyStructure() { - if(isSharable()) { - return this; - } else { - CyclotronWrapper *sbw = new CyclotronWrapper(*this); - sbw->itsDesign = dynamic_cast<Cyclotron *>(itsDesign->copyStructure()); - return sbw; - } -} - - -BMultipoleField &CyclotronWrapper::errorField() const { - return itsError; -} - - -void CyclotronWrapper::makeSharable() { - shareFlag = true; - itsDesign->makeSharable(); -} - - -BMultipoleField &CyclotronWrapper::getField() { - /* - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; - */ - // BMultipoleField tf; - return tempField; -} - - -const BMultipoleField &CyclotronWrapper::getField() const { - /* - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; - */ - // BMultipoleField tf; - return tempField; -} - - -PlanarArcGeometry &CyclotronWrapper::getGeometry() { - - return static_cast<PlanarArcGeometry &>(itsDesign->getGeometry()); - - // PlanarArcGeometry gm(.0); - // return gm; -} - - -const PlanarArcGeometry &CyclotronWrapper::getGeometry() const { - return static_cast<PlanarArcGeometry &>(itsDesign->getGeometry()); - // PlanarArcGeometry gm(.0); - // return gm; -} - - -double CyclotronWrapper::getSlices() const { - return itsDesign->getSlices(); -} - - -double CyclotronWrapper::getStepsize() const { - return itsDesign->getStepsize(); -} - - -ElementBase::ElementType CyclotronWrapper::getType() const { - return CYCLOTRONWRAPPER; -} - - -const Cyclotron &CyclotronWrapper::getDesign() const { - return *itsDesign; -} - - -Cyclotron &CyclotronWrapper::getDesign() { - return *itsDesign; -} - - -ElementBase *CyclotronWrapper::makeFieldWrapper() { - return this; -} - - -ElementBase *CyclotronWrapper::removeFieldWrapper() { - return &*itsDesign; -} - - -const ElementBase *CyclotronWrapper::removeFieldWrapper() const { - return &*itsDesign; -} - - -ElementBase *CyclotronWrapper::removeWrappers() { - return &*itsDesign; -} - - -const ElementBase *CyclotronWrapper::removeWrappers() const { - return &*itsDesign; -} \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/CyclotronWrapper.h b/src/Classic/ComponentWrappers/CyclotronWrapper.h deleted file mode 100644 index 769cfe01c..000000000 --- a/src/Classic/ComponentWrappers/CyclotronWrapper.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef CLASSIC_CyclotronWrapper_HH -#define CLASSIC_CyclotronWrapper_HH - -// ------------------------------------------------------------------------ -// $RCSfile: CyclotronWrapper.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: CyclotronWrapper -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "AbsBeamline/Cyclotron.h" -#include "BeamlineGeometry/PlanarArcGeometry.h" -#include "Fields/BMultipoleField.h" -#include "MemoryManagement/Pointer.h" - -class BMultipoleField; - -// Class CyclotronWrapper -// ------------------------------------------------------------------------ -/// Representation of a perturbed cyclotron. -// A CyclotronWrapper represents a unique instance of a cyclotron -// in the accelerator model. It defines imperfections of the field, -// related to an ``ideal'' magnet contained in the wrapper. - -class CyclotronWrapper: public Cyclotron { - -public: - - /// Constructor. - // Constructs a wrapper for its argument. - // The wrapper is not sharable by default. - explicit CyclotronWrapper(Cyclotron *); - - CyclotronWrapper(const CyclotronWrapper &); - virtual ~CyclotronWrapper(); - - - /// Apply visitor to modified bend. - virtual void accept(BeamlineVisitor &) const; - - /// Make clone. - virtual ElementBase *clone() const; - - /// Make structural copy. - virtual ElementBase *copyStructure(); - - /// Get multipole field error. - // This method can be used to get or set the error field. The error field - // offset is mutable, so as to allow changing it in a constant structure. - virtual BMultipoleField &errorField() const ; - - /// 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 field. - // Return the perturbed field. - // Version for non-constant object. - virtual BMultipoleField &getField(); - - /// Get field. - // Return the perturbed field. - // Version for constant object. - virtual const BMultipoleField &getField() const; - - /// Get geometry. - // Version for non-constant object. - virtual PlanarArcGeometry &getGeometry(); - - /// Get geometry. - // Version for constant object. - virtual const PlanarArcGeometry &getGeometry() const; - - /// Get number of slices. - virtual double getSlices() const; - - /// Get stepsize. - virtual double getStepsize() const; - - /// Get element type string. - virtual ElementBase::ElementType getType() const; - - /// Get design Cyclotron. - // Version for constant object. - virtual const Cyclotron &getDesign() const; - - /// Get design Cyclotron. - // Version for non-constant object. - virtual Cyclotron &getDesign(); - - /// Make wrapper for this bend. - // Return [b]this[/b], since this is already a field wrapper. - virtual ElementBase *makeFieldWrapper(); - - /// Remove field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - virtual const ElementBase *removeFieldWrapper() const; - - /// Remove all wrappers. - virtual ElementBase *removeWrappers(); - - /// Remove all wrappers. - virtual const ElementBase *removeWrappers() const; - -private: - - // Not implemented. - CyclotronWrapper(); - void operator=(const CyclotronWrapper &); - - // The ``design'' magnet. - Pointer<Cyclotron> itsDesign; - - /// The error field. - mutable BMultipoleField itsError; - - // The magnetic field after application of all modifiers. - mutable BMultipoleField tempField; -}; - -#endif // CLASSIC_CyclotronWrapper_HH \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/MultipoleWrapper.cpp b/src/Classic/ComponentWrappers/MultipoleWrapper.cpp deleted file mode 100644 index 8cdcc488c..000000000 --- a/src/Classic/ComponentWrappers/MultipoleWrapper.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// ------------------------------------------------------------------------ -// $RCSfile: MultipoleWrapper.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: MultipoleWrapper -// Defines a representation for a modified multipole. -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2000/03/27 09:32:35 $ -// $Author: fci $ -// -// ------------------------------------------------------------------------ - -#include "ComponentWrappers/MultipoleWrapper.h" -#include "AbsBeamline/BeamlineVisitor.h" - - -// Class MultipoleWrapper -// A MultipoleWrapper represents a unique instance of a multipole magnet -// in the accelerator model. -// ------------------------------------------------------------------------ - -MultipoleWrapper::MultipoleWrapper(Multipole *ideal): - Multipole(*ideal), - itsDesign(ideal), - itsError(), - tempField() { - setName(ideal->getName()); - shareFlag = false; -} - - -MultipoleWrapper::MultipoleWrapper(const MultipoleWrapper &rhs): - Multipole(rhs), - itsDesign(rhs.itsDesign), - itsError(rhs.itsError), - tempField() { - shareFlag = false; -} - - -MultipoleWrapper::~MultipoleWrapper() -{} - - -void MultipoleWrapper::accept(BeamlineVisitor &visitor) const { - visitor.visitMultipoleWrapper(*this); -} - - -ElementBase *MultipoleWrapper::clone() const { - MultipoleWrapper *mw = new MultipoleWrapper(*this); - mw->itsDesign = dynamic_cast<Multipole *>(itsDesign->clone()); - return mw; -} - - -ElementBase *MultipoleWrapper::copyStructure() { - if(isSharable()) { - return this; - } else { - MultipoleWrapper *mw = new MultipoleWrapper(*this); - mw->itsDesign = dynamic_cast<Multipole *>(itsDesign->copyStructure()); - return mw; - } -} - - -BMultipoleField &MultipoleWrapper::errorField() const { - return itsError; - -} - - -void MultipoleWrapper::makeSharable() { - shareFlag = true; - itsDesign->makeSharable(); -} - - -BMultipoleField &MultipoleWrapper::getField() { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -const BMultipoleField &MultipoleWrapper::getField() const { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -StraightGeometry &MultipoleWrapper::getGeometry() { - return itsDesign->getGeometry(); -} - - -const StraightGeometry &MultipoleWrapper::getGeometry() const { - return itsDesign->getGeometry(); -} - - -ElementBase::ElementType MultipoleWrapper::getType() const { - return MULTIPOLEWRAPPER; -} - - -const Multipole &MultipoleWrapper::getDesign() const { - return *itsDesign; -} - - -Multipole &MultipoleWrapper::getDesign() { - return *itsDesign; -} - - -ElementBase *MultipoleWrapper::makeFieldWrapper() { - return this; -} - - -ElementBase *MultipoleWrapper::removeFieldWrapper() { - return &*itsDesign; -} - - -const ElementBase *MultipoleWrapper::removeFieldWrapper() const { - return &*itsDesign; -} - - -ElementBase *MultipoleWrapper::removeWrappers() { - return &*itsDesign; -} - - -const ElementBase *MultipoleWrapper::removeWrappers() const { - return &*itsDesign; -} \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/MultipoleWrapper.h b/src/Classic/ComponentWrappers/MultipoleWrapper.h deleted file mode 100644 index ad23866ae..000000000 --- a/src/Classic/ComponentWrappers/MultipoleWrapper.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef CLASSIC_MultipoleWrapper_HH -#define CLASSIC_MultipoleWrapper_HH - -// ------------------------------------------------------------------------ -// $RCSfile: MultipoleWrapper.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: MultipoleWrapper -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2000/03/27 09:32:35 $ -// $Author: fci $ -// -// ------------------------------------------------------------------------ - -#include "AbsBeamline/Multipole.h" -#include "Fields/BMultipoleField.h" -#include "MemoryManagement/Pointer.h" - - -// Class MultipoleWrapper -// ------------------------------------------------------------------------ -/// Representation of a perturbed multipole. -// A MultipoleWrapper represents a unique instance of a multipole magnet -// in the accelerator model. It defines imperfections of the field, -// related to an ``ideal'' magnet contained in the wrapper. - -class MultipoleWrapper: public Multipole { - -public: - - /// Constructor. - // Constructs a wrapper for its argument. - // The wrapper is not sharable by default. - explicit MultipoleWrapper(Multipole *); - - MultipoleWrapper(const MultipoleWrapper &); - virtual ~MultipoleWrapper(); - - - /// Apply visitor to modified multipole. - virtual void accept(BeamlineVisitor &) const; - - /// Make clone. - virtual ElementBase *clone() const; - - /// Make structural copy. - virtual ElementBase *copyStructure(); - - /// Get multipole field error. - // This method can be used to get or set the error field. The error field - // offset is mutable, so as to allow changing it in a constant structure. - virtual BMultipoleField &errorField() const; - - /// 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 field. - // Return the perturbed field. - // Version for non-constant object. - virtual BMultipoleField &getField(); - - /// Get field. - // Return the perturbed field. - // Version for constant object. - virtual const BMultipoleField &getField() const; - - /// Get geometry. - // Version for non-constant object. - virtual StraightGeometry &getGeometry(); - - /// Get geometry. - // Version for constant object. - virtual const StraightGeometry &getGeometry() const; - - /// Get element type string. - virtual ElementBase::ElementType getType() const; - - /// Get design corrector. - // Version for constant object. - virtual const Multipole &getDesign() const; - - /// Get design corrector. - // Version for non-constant object. - virtual Multipole &getDesign(); - - /// Make wrapper for this multipole. - // Return [b]this[/b], since this is already a field wrapper. - virtual ElementBase *makeFieldWrapper(); - - /// Remove field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - virtual const ElementBase *removeFieldWrapper() const; - - /// Remove all wrappers. - virtual ElementBase *removeWrappers(); - - /// Remove all wrappers. - virtual const ElementBase *removeWrappers() const; - -private: - - // Not implemented. - MultipoleWrapper(); - void operator=(const MultipoleWrapper &); - - // The pointer to the ``design'' magnet. - Pointer<Multipole> itsDesign; - - // The error field. - mutable BMultipoleField itsError; - - // The magnetic field after application of all modifiers. - mutable BMultipoleField tempField; -}; - -#endif // CLASSIC_MultipoleWrapper_HH \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/RBendWrapper.cpp b/src/Classic/ComponentWrappers/RBendWrapper.cpp deleted file mode 100644 index fbf2afe32..000000000 --- a/src/Classic/ComponentWrappers/RBendWrapper.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// ------------------------------------------------------------------------ -// $RCSfile: RBendWrapper.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: RBendWrapper -// Defines a representation for a modified RBend. -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "ComponentWrappers/RBendWrapper.h" -#include "AbsBeamline/BeamlineVisitor.h" - - -// Class RBendWrapper -// ------------------------------------------------------------------------ - -RBendWrapper::RBendWrapper(RBend *ideal): - RBend(*ideal), - itsDesign(ideal), - itsError(), - tempField() { - shareFlag = false; -} - - -RBendWrapper::RBendWrapper(const RBendWrapper &rhs): - RBend(rhs), - itsDesign(rhs.itsDesign), - itsError(rhs.itsError), - tempField() { - shareFlag = false; -} - - -RBendWrapper::~RBendWrapper() -{} - - -void RBendWrapper::accept(BeamlineVisitor &visitor) const { - visitor.visitRBendWrapper(*this); -} - - -ElementBase *RBendWrapper::clone() const { - RBendWrapper *rbw = new RBendWrapper(*this); - rbw->itsDesign = dynamic_cast<RBend *>(itsDesign->clone()); - return rbw; -} - - -ElementBase *RBendWrapper::copyStructure() { - if(isSharable()) { - return this; - } else { - RBendWrapper *rbw = new RBendWrapper(*this); - rbw->itsDesign = dynamic_cast<RBend *>(itsDesign->copyStructure()); - return rbw; - } -} - - -BMultipoleField &RBendWrapper::errorField() const { - return itsError; -} - - -void RBendWrapper::makeSharable() { - shareFlag = true; - itsDesign->makeSharable(); -} - - -BMultipoleField &RBendWrapper::getField() { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -const BMultipoleField &RBendWrapper::getField() const { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -RBendGeometry &RBendWrapper::getGeometry() { - return itsDesign->getGeometry(); -} - - -const RBendGeometry &RBendWrapper::getGeometry() const { - return itsDesign->getGeometry(); -} - - -double RBendWrapper::getB() const { - getField(); - return tempField.getNormalComponent(1); -} - - -double RBendWrapper::getEntryFaceRotation() const { - return itsDesign->getEntryFaceRotation(); -} - - -double RBendWrapper::getExitFaceRotation() const { - return itsDesign->getExitFaceRotation(); -} - - -double RBendWrapper::getEntryFaceCurvature() const { - return itsDesign->getEntryFaceCurvature(); -} - - -double RBendWrapper::getExitFaceCurvature() const { - return itsDesign->getExitFaceCurvature(); -} - - -double RBendWrapper::getSlices() const { - return itsDesign->getSlices(); -} - - -double RBendWrapper::getStepsize() const { - return itsDesign->getStepsize(); -} - - -ElementBase::ElementType RBendWrapper::getType() const { - return RBENDWRAPPER; -} - - -const RBend &RBendWrapper::getDesign() const { - return *itsDesign; -} - - -RBend &RBendWrapper::getDesign() { - return *itsDesign; -} - - -ElementBase *RBendWrapper::makeFieldWrapper() { - return this; -} - - -ElementBase *RBendWrapper::removeFieldWrapper() { - return &*itsDesign; -} - - -const ElementBase *RBendWrapper::removeFieldWrapper() const { - return &*itsDesign; -} - - -ElementBase *RBendWrapper::removeWrappers() { - return &*itsDesign; -} - - -const ElementBase *RBendWrapper::removeWrappers() const { - return &*itsDesign; -} \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/RBendWrapper.h b/src/Classic/ComponentWrappers/RBendWrapper.h deleted file mode 100644 index d5d12e9ec..000000000 --- a/src/Classic/ComponentWrappers/RBendWrapper.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef CLASSIC_RBendWrapper_HH -#define CLASSIC_RBendWrapper_HH - -// ------------------------------------------------------------------------ -// $RCSfile: RBendWrapper.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: RBendWrapper -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "AbsBeamline/RBend.h" -#include "Fields/BMultipoleField.h" -#include "MemoryManagement/Pointer.h" - -class BMultipoleField; - - -// Class RBendWrapper -// ------------------------------------------------------------------------ -/// Representation of a perturbed rectangular bend. -// A RBendWrapper represents a unique instance of a bend magnet -// in the accelerator model. It defines imperfections of the field, -// related to an ``ideal'' magnet contained in the wrapper. - -class RBendWrapper: public RBend { - -public: - - /// Constructor. - // Constructs a wrapper for its argument. - // The wrapper is not sharable by default. - explicit RBendWrapper(RBend *); - - RBendWrapper(const RBendWrapper &right); - virtual ~RBendWrapper(); - - - /// Apply visitor to modified bend. - virtual void accept(BeamlineVisitor &) const; - - /// Make clone. - virtual ElementBase *clone() const; - - /// Make structural copy. - virtual ElementBase *copyStructure(); - - /// Get multipole field error. - // This method can be used to get or set the error field. The error field - // offset is mutable, so as to allow changing it in a constant structure. - virtual BMultipoleField &errorField() const; - - /// 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 field. - // Return the perturbed field. - // Version for non-constant object. - virtual BMultipoleField &getField(); - - /// Get field. - // Return the perturbed field. - // Version for constant object. - virtual const BMultipoleField &getField() const; - - /// Get geometry. - // Version for non-constant object. - virtual RBendGeometry &getGeometry(); - - /// Get geometry. - // Version for constant object. - virtual const RBendGeometry &getGeometry() const; - - /// Get dipole component. - virtual double getB() const; - - /// Get pole face rotation. - // Return the rotation of the entry pole face with respect to the x-axis. - // A positive angle rotates the pole face normal away from the centre - // of the machine. - virtual double getEntryFaceRotation() const; - - /// Get pole face rotation. - // Return the rotation of the exit pole face with respect to the x-axis. - // A positive angle rotates the pole face normal away from the centre - // of the machine. - virtual double getExitFaceRotation() const; - - /// Get pole face curvature. - // Return the curvature of the entry pole face. - // A positive curvature creates a convex pole face. - virtual double getEntryFaceCurvature() const; - - /// Get pole face curvature. - // Return the curvature of the exit pole face. - // A positive curvature creates a convex pole face. - virtual double getExitFaceCurvature() const; - - /// Get number of slices. - virtual double getSlices() const; - - /// Get stepsize. - virtual double getStepsize() const; - - /// Get element type string. - virtual ElementBase::ElementType getType() const; - - /// Get design RBend. - // Version for constant object. - virtual const RBend &getDesign() const; - - /// Get design RBend. - // Version for non-constant object. - virtual RBend &getDesign(); - - /// Make wrapper for this bend. - // Return [b]this[/b], since this is already a field wrapper. - virtual ElementBase *makeFieldWrapper(); - - /// Remove field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - virtual const ElementBase *removeFieldWrapper() const; - - /// Remove all wrappers. - virtual ElementBase *removeWrappers(); - - /// Remove all wrappers. - virtual const ElementBase *removeWrappers() const; - -private: - - // Not implemented. - RBendWrapper(); - void operator=(const RBendWrapper &); - - // The ``design'' magnet. - Pointer<RBend> itsDesign; - - /// The error field. - mutable BMultipoleField itsError; - - // The magnetic field after application of all modifiers. - mutable BMultipoleField tempField; -}; - -#endif // CLASSIC_RBendWrapper_HH \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/SBendWrapper.cpp b/src/Classic/ComponentWrappers/SBendWrapper.cpp deleted file mode 100644 index b655034f1..000000000 --- a/src/Classic/ComponentWrappers/SBendWrapper.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// ------------------------------------------------------------------------ -// $RCSfile: SBendWrapper.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: SBendWrapper -// Defines a representation for a modified SBend. -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "ComponentWrappers/SBendWrapper.h" -#include "AbsBeamline/BeamlineVisitor.h" - - -// Class SBendWrapper -// ------------------------------------------------------------------------ - -SBendWrapper::SBendWrapper(SBend *ideal): - SBend(*ideal), - itsDesign(ideal), - itsError(), - tempField() { - shareFlag = false; -} - - -SBendWrapper::SBendWrapper(const SBendWrapper &rhs): - SBend(rhs), - itsDesign(rhs.itsDesign), - itsError(rhs.itsError), - tempField() { - shareFlag = false; -} - - -SBendWrapper::~SBendWrapper() -{} - - -void SBendWrapper::accept(BeamlineVisitor &visitor) const { - visitor.visitSBendWrapper(*this); -} - - -ElementBase *SBendWrapper::clone() const { - SBendWrapper *sbw = new SBendWrapper(*this); - sbw->itsDesign = dynamic_cast<SBend *>(itsDesign->clone()); - return sbw; -} - - -ElementBase *SBendWrapper::copyStructure() { - if(isSharable()) { - return this; - } else { - SBendWrapper *sbw = new SBendWrapper(*this); - sbw->itsDesign = dynamic_cast<SBend *>(itsDesign->copyStructure()); - return sbw; - } -} - - -BMultipoleField &SBendWrapper::errorField() const { - return itsError; -} - - -void SBendWrapper::makeSharable() { - shareFlag = true; - itsDesign->makeSharable(); -} - - -BMultipoleField &SBendWrapper::getField() { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -const BMultipoleField &SBendWrapper::getField() const { - tempField = itsDesign->getField(); - tempField.addField(itsError); - return tempField; -} - - -PlanarArcGeometry &SBendWrapper::getGeometry() { - return itsDesign->getGeometry(); -} - - -const PlanarArcGeometry &SBendWrapper::getGeometry() const { - return itsDesign->getGeometry(); -} - - -double SBendWrapper::getB() const { - getField(); - return tempField.getNormalComponent(1); -} - - -double SBendWrapper::getEntryFaceRotation() const { - return itsDesign->getEntryFaceRotation(); -} - - -double SBendWrapper::getExitFaceRotation() const { - return itsDesign->getExitFaceRotation(); -} - - -double SBendWrapper::getEntryFaceCurvature() const { - return itsDesign->getEntryFaceCurvature(); -} - - -double SBendWrapper::getExitFaceCurvature() const { - return itsDesign->getExitFaceCurvature(); -} - - -double SBendWrapper::getSlices() const { - return itsDesign->getSlices(); -} - - -double SBendWrapper::getStepsize() const { - return itsDesign->getStepsize(); -} - - -ElementBase::ElementType SBendWrapper::getType() const { - return SBENDWRAPPER; -} - - -const SBend &SBendWrapper::getDesign() const { - return *itsDesign; -} - - -SBend &SBendWrapper::getDesign() { - return *itsDesign; -} - - -ElementBase *SBendWrapper::makeFieldWrapper() { - return this; -} - - -ElementBase *SBendWrapper::removeFieldWrapper() { - return &*itsDesign; -} - - -const ElementBase *SBendWrapper::removeFieldWrapper() const { - return &*itsDesign; -} - - -ElementBase *SBendWrapper::removeWrappers() { - return &*itsDesign; -} - - -const ElementBase *SBendWrapper::removeWrappers() const { - return &*itsDesign; -} \ No newline at end of file diff --git a/src/Classic/ComponentWrappers/SBendWrapper.h b/src/Classic/ComponentWrappers/SBendWrapper.h deleted file mode 100644 index 1744e1b7a..000000000 --- a/src/Classic/ComponentWrappers/SBendWrapper.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef CLASSIC_SBendWrapper_HH -#define CLASSIC_SBendWrapper_HH - -// ------------------------------------------------------------------------ -// $RCSfile: SBendWrapper.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1.2.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ -// -// Class: SBendWrapper -// -// ------------------------------------------------------------------------ -// Class category: ComponentWrappers -// ------------------------------------------------------------------------ -// -// $Date: 2004/11/12 18:57:54 $ -// $Author: adelmann $ -// -// ------------------------------------------------------------------------ - -#include "AbsBeamline/SBend.h" -#include "Fields/BMultipoleField.h" -#include "MemoryManagement/Pointer.h" - -class BMultipoleField; - - -// Class SBendWrapper -// ------------------------------------------------------------------------ -/// Representation of a perturbed sector bend. -// A SBendWrapper represents a unique instance of a bend magnet -// in the accelerator model. It defines imperfections of the field, -// related to an ``ideal'' magnet contained in the wrapper. - -class SBendWrapper: public SBend { - -public: - - /// Constructor. - // Constructs a wrapper for its argument. - // The wrapper is not sharable by default. - explicit SBendWrapper(SBend *); - - SBendWrapper(const SBendWrapper &); - virtual ~SBendWrapper(); - - - /// Apply visitor to modified bend. - virtual void accept(BeamlineVisitor &) const; - - /// Make clone. - virtual ElementBase *clone() const; - - /// Make structural copy. - virtual ElementBase *copyStructure(); - - /// Get multipole field error. - // This method can be used to get or set the error field. The error field - // offset is mutable, so as to allow changing it in a constant structure. - virtual BMultipoleField &errorField() const ; - - /// 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 field. - // Return the perturbed field. - // Version for non-constant object. - virtual BMultipoleField &getField(); - - /// Get field. - // Return the perturbed field. - // Version for constant object. - virtual const BMultipoleField &getField() const; - - /// Get geometry. - // Version for non-constant object. - virtual PlanarArcGeometry &getGeometry(); - - /// Get geometry. - // Version for constant object. - virtual const PlanarArcGeometry &getGeometry() const; - - /// Get dipole component. - virtual double getB() const; - - /// Get pole face rotation. - // Return the rotation of the entry pole face with respect to the x-axis. - // A positive angle rotates the pole face normal away from the centre - // of the machine. - virtual double getEntryFaceRotation() const; - - /// Get pole face rotation. - // Return the rotation of the exit pole face with respect to the x-axis. - // A positive angle rotates the pole face normal away from the centre - // of the machine. - virtual double getExitFaceRotation() const; - - /// Get pole face curvature. - // Return the curvature of the entry pole face. - // A positive curvature creates a convex pole face. - virtual double getEntryFaceCurvature() const; - - /// Get pole face curvature. - // Return the curvature of the exit pole face. - // A positive curvature creates a convex pole face. - virtual double getExitFaceCurvature() const; - - /// Get number of slices. - virtual double getSlices() const; - - /// Get stepsize. - virtual double getStepsize() const; - - /// Get element type string. - virtual ElementBase::ElementType getType() const; - - /// Get design SBend. - // Version for constant object. - virtual const SBend &getDesign() const; - - /// Get design SBend. - // Version for non-constant object. - virtual SBend &getDesign(); - - /// Make wrapper for this bend. - // Return [b]this[/b], since this is already a field wrapper. - virtual ElementBase *makeFieldWrapper(); - - /// Remove field wrapper. - virtual ElementBase *removeFieldWrapper(); - - /// Remove field wrapper. - virtual const ElementBase *removeFieldWrapper() const; - - /// Remove all wrappers. - virtual ElementBase *removeWrappers(); - - /// Remove all wrappers. - virtual const ElementBase *removeWrappers() const; - -private: - - // Not implemented. - SBendWrapper(); - void operator=(const SBendWrapper &); - - // The ``design'' magnet. - Pointer<SBend> itsDesign; - - /// The error field. - mutable BMultipoleField itsError; - - // The magnetic field after application of all modifiers. - mutable BMultipoleField tempField; -}; - -#endif // CLASSIC_SBendWrapper_HH \ No newline at end of file diff --git a/src/Classic/Solvers/BeamStrippingPhysics.cpp b/src/Classic/Solvers/BeamStrippingPhysics.cpp index c71f16a07..f94dce5be 100644 --- a/src/Classic/Solvers/BeamStrippingPhysics.cpp +++ b/src/Classic/Solvers/BeamStrippingPhysics.cpp @@ -86,7 +86,7 @@ BeamStrippingPhysics::BeamStrippingPhysics(const std::string &name, ElementBase rediffusedStat_m(0), locPartsInMat_m(0) { - bstp_m = dynamic_cast<BeamStripping *>(getElement()->removeWrappers()); + bstp_m = dynamic_cast<BeamStripping *>(getElement()); bstpshape_m = element_ref_m->getType(); lossDs_m = std::unique_ptr<LossDataSink>(new LossDataSink(element_ref_m->getName(), !Options::asciidump)); diff --git a/src/Elements/OpalBeamStripping.cpp b/src/Elements/OpalBeamStripping.cpp index ee1fbf9e9..59db360f6 100644 --- a/src/Elements/OpalBeamStripping.cpp +++ b/src/Elements/OpalBeamStripping.cpp @@ -76,8 +76,8 @@ OpalBeamStripping *OpalBeamStripping::clone(const std::string &name) { } -void OpalBeamStripping::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalBeamStripping::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -85,7 +85,7 @@ void OpalBeamStripping::update() { OpalElement::update(); BeamStrippingRep *bstp = - dynamic_cast<BeamStrippingRep *>(getElement()->removeWrappers()); + dynamic_cast<BeamStrippingRep *>(getElement()); double pressure = Attributes::getReal(itsAttr[PRESSURE]); double temperature = Attributes::getReal(itsAttr[TEMPERATURE]); diff --git a/src/Elements/OpalBeamStripping.h b/src/Elements/OpalBeamStripping.h index acc490692..7776d2166 100644 --- a/src/Elements/OpalBeamStripping.h +++ b/src/Elements/OpalBeamStripping.h @@ -53,7 +53,7 @@ public: virtual OpalBeamStripping *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC beam stripping. virtual void update(); diff --git a/src/Elements/OpalBeamline.h b/src/Elements/OpalBeamline.h index 11a2e6b0c..f452faf72 100644 --- a/src/Elements/OpalBeamline.h +++ b/src/Elements/OpalBeamline.h @@ -112,7 +112,7 @@ void OpalBeamline::visit(const T &element, BeamlineVisitor &, PartBunchBase<doub Inform msg("OPAL "); double startField = 0.0; double endField = 0.0; - std::shared_ptr<T> elptr(dynamic_cast<T *>(element.removeWrappers()->clone())); + std::shared_ptr<T> elptr(dynamic_cast<T *>(element.clone())); if (elptr->isElementPositionSet()) startField = elptr->getElementPosition(); @@ -126,7 +126,7 @@ void OpalBeamline::visit<Source>(const Source &element, BeamlineVisitor &, PartB containsSource_m = true; double startField = 0.0; double endField = 0.0; - std::shared_ptr<Source> elptr(dynamic_cast<Source *>(element.removeWrappers()->clone())); + std::shared_ptr<Source> elptr(dynamic_cast<Source *>(element.clone())); if (elptr->isElementPositionSet()) startField = elptr->getElementPosition(); diff --git a/src/Elements/OpalCCollimator.cpp b/src/Elements/OpalCCollimator.cpp index 7fbff03b3..635cfe6a9 100644 --- a/src/Elements/OpalCCollimator.cpp +++ b/src/Elements/OpalCCollimator.cpp @@ -79,8 +79,8 @@ OpalCCollimator *OpalCCollimator::clone(const std::string &name) { } -void OpalCCollimator::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalCCollimator::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -88,7 +88,7 @@ void OpalCCollimator::update() { OpalElement::update(); CCollimatorRep *coll = - dynamic_cast<CCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<CCollimatorRep *>(getElement()); const double mm2m = 1e-3; double xstart = mm2m * Attributes::getReal(itsAttr[XSTART]); double xend = mm2m * Attributes::getReal(itsAttr[XEND]); diff --git a/src/Elements/OpalCCollimator.h b/src/Elements/OpalCCollimator.h index 1758c092f..b97263f31 100644 --- a/src/Elements/OpalCCollimator.h +++ b/src/Elements/OpalCCollimator.h @@ -48,7 +48,7 @@ public: virtual OpalCCollimator *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalCavity.cpp b/src/Elements/OpalCavity.cpp index 045adf54e..d7548d322 100644 --- a/src/Elements/OpalCavity.cpp +++ b/src/Elements/OpalCavity.cpp @@ -125,17 +125,15 @@ OpalCavity *OpalCavity::clone(const std::string &name) { } -void OpalCavity::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - - if(flag != ERROR_FLAG) { - const RFCavityRep *rfc = - dynamic_cast<const RFCavityRep *>(base.removeWrappers()); - attributeRegistry["VOLT"]->setReal(rfc->getAmplitude()); - attributeRegistry["FREQ"]->setReal(rfc->getFrequency()); - attributeRegistry["LAG"]->setReal(rfc->getPhase()); - attributeRegistry["FMAPFN"]->setString(rfc->getFieldMapFN()); - } +void OpalCavity::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const RFCavityRep *rfc = + dynamic_cast<const RFCavityRep *>(&base); + attributeRegistry["VOLT"]->setReal(rfc->getAmplitude()); + attributeRegistry["FREQ"]->setReal(rfc->getFrequency()); + attributeRegistry["LAG"]->setReal(rfc->getPhase()); + attributeRegistry["FMAPFN"]->setString(rfc->getFieldMapFN()); } @@ -143,7 +141,7 @@ void OpalCavity::update() { OpalElement::update(); RFCavityRep *rfc = - dynamic_cast<RFCavityRep *>(getElement()->removeWrappers()); + dynamic_cast<RFCavityRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double peak = Attributes::getReal(itsAttr[VOLT]); diff --git a/src/Elements/OpalCavity.h b/src/Elements/OpalCavity.h index 88613e780..6eefff28d 100644 --- a/src/Elements/OpalCavity.h +++ b/src/Elements/OpalCavity.h @@ -65,7 +65,7 @@ public: virtual OpalCavity *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC cavity. virtual void update(); diff --git a/src/Elements/OpalCyclotron.cpp b/src/Elements/OpalCyclotron.cpp index d17d9c8d7..b6aee7821 100644 --- a/src/Elements/OpalCyclotron.cpp +++ b/src/Elements/OpalCyclotron.cpp @@ -161,14 +161,14 @@ OpalCyclotron *OpalCyclotron::clone(const std::string &name) { void OpalCyclotron:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalCyclotron::update() { CyclotronRep *cycl = - dynamic_cast<CyclotronRep *>(getElement()->removeWrappers()); + dynamic_cast<CyclotronRep *>(getElement()); std::string fmapfm = Attributes::getString(itsAttr[FMAPFN]); diff --git a/src/Elements/OpalCyclotron.h b/src/Elements/OpalCyclotron.h index 561ea5d31..28d908919 100644 --- a/src/Elements/OpalCyclotron.h +++ b/src/Elements/OpalCyclotron.h @@ -71,7 +71,7 @@ public: virtual OpalCyclotron *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC cavity. virtual void update(); diff --git a/src/Elements/OpalDegrader.cpp b/src/Elements/OpalDegrader.cpp index 6c7b7a753..8da696c82 100644 --- a/src/Elements/OpalDegrader.cpp +++ b/src/Elements/OpalDegrader.cpp @@ -58,8 +58,8 @@ OpalDegrader *OpalDegrader::clone(const std::string &name) { } -void OpalDegrader::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalDegrader::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -67,7 +67,7 @@ void OpalDegrader::update() { OpalElement::update(); DegraderRep *deg = - dynamic_cast<DegraderRep *>(getElement()->removeWrappers()); + dynamic_cast<DegraderRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); deg->setElementLength(length); diff --git a/src/Elements/OpalDegrader.h b/src/Elements/OpalDegrader.h index 3f9b82e88..fac710f98 100644 --- a/src/Elements/OpalDegrader.h +++ b/src/Elements/OpalDegrader.h @@ -43,7 +43,7 @@ public: virtual OpalDegrader *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalECollimator.cpp b/src/Elements/OpalECollimator.cpp index 3112a3147..53329d657 100644 --- a/src/Elements/OpalECollimator.cpp +++ b/src/Elements/OpalECollimator.cpp @@ -63,11 +63,11 @@ OpalECollimator *OpalECollimator::clone(const std::string &name) { } -void OpalECollimator::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalECollimator::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const FlexibleCollimatorRep *coll = - dynamic_cast<const FlexibleCollimatorRep *>(base.removeWrappers()); + dynamic_cast<const FlexibleCollimatorRep *>(&base); std::string Double("(-?[0-9]+\\.?[0-9]*([Ee][+-]?[0-9]+)?)"); std::string desc = coll->getDescription(); @@ -87,7 +87,7 @@ void OpalECollimator::update() { OpalElement::update(); FlexibleCollimatorRep *coll = - dynamic_cast<FlexibleCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<FlexibleCollimatorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); coll->setElementLength(length); diff --git a/src/Elements/OpalECollimator.h b/src/Elements/OpalECollimator.h index c00b28dbb..10ade1dd0 100644 --- a/src/Elements/OpalECollimator.h +++ b/src/Elements/OpalECollimator.h @@ -43,7 +43,7 @@ public: virtual OpalECollimator *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalElement.cpp b/src/Elements/OpalElement.cpp index d72467f76..63bf8b771 100644 --- a/src/Elements/OpalElement.cpp +++ b/src/Elements/OpalElement.cpp @@ -140,7 +140,7 @@ OpalElement::~OpalElement() void OpalElement:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag) { +fillRegisteredAttributes(const ElementBase &base) { // Fill in the common data for all elements. attributeRegistry["NAME"]->setString(getOpalName()); attributeRegistry["TYPE"]->setString(getTypeName()); @@ -550,7 +550,7 @@ void OpalElement::printMultipoleStrength } void OpalElement::update() { - ElementBase *base = getElement()->removeWrappers(); + ElementBase *base = getElement(); auto apert = getApert(); base->setAperture(apert.first, apert.second); diff --git a/src/Elements/OpalElement.h b/src/Elements/OpalElement.h index 04d70f376..10b4e9ec9 100644 --- a/src/Elements/OpalElement.h +++ b/src/Elements/OpalElement.h @@ -63,17 +63,10 @@ public: COMMON }; - /// Switch for value desired on ATTLIST command. - enum ValueFlag { - ACTUAL_FLAG, // Actual field values (design + error). - IDEAL_FLAG, // Ideal field values (design only). - ERROR_FLAG // Field errors. - }; - virtual ~OpalElement(); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Find a registered attribute. // Return a pointer to the AttCell for a named attribute. diff --git a/src/Elements/OpalFlexibleCollimator.cpp b/src/Elements/OpalFlexibleCollimator.cpp index ec96f93b6..20a3b70ca 100644 --- a/src/Elements/OpalFlexibleCollimator.cpp +++ b/src/Elements/OpalFlexibleCollimator.cpp @@ -64,11 +64,11 @@ OpalFlexibleCollimator *OpalFlexibleCollimator::clone(const std::string &name) { } -void OpalFlexibleCollimator::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalFlexibleCollimator::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const FlexibleCollimatorRep *coll = - dynamic_cast<const FlexibleCollimatorRep *>(base.removeWrappers()); + dynamic_cast<const FlexibleCollimatorRep *>(&base); attributeRegistry["DESCRIPTION"]->setString(coll->getDescription()); } @@ -77,7 +77,7 @@ void OpalFlexibleCollimator::update() { OpalElement::update(); FlexibleCollimatorRep *coll = - dynamic_cast<FlexibleCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<FlexibleCollimatorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); coll->setElementLength(length); diff --git a/src/Elements/OpalFlexibleCollimator.h b/src/Elements/OpalFlexibleCollimator.h index dff47c073..f11ceff8c 100644 --- a/src/Elements/OpalFlexibleCollimator.h +++ b/src/Elements/OpalFlexibleCollimator.h @@ -44,7 +44,7 @@ public: virtual OpalFlexibleCollimator *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalHKicker.cpp b/src/Elements/OpalHKicker.cpp index fb18edc95..d4e561d25 100644 --- a/src/Elements/OpalHKicker.cpp +++ b/src/Elements/OpalHKicker.cpp @@ -21,7 +21,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/XCorrectorRep.h" -#include "ComponentWrappers/CorrectorWrapper.h" #include "Physics/Physics.h" OpalHKicker::OpalHKicker(): @@ -41,13 +40,13 @@ OpalHKicker::OpalHKicker(): registerOwnership(); - setElement((new XCorrectorRep("HKICKER"))->makeWrappers()); + setElement(new XCorrectorRep("HKICKER")); } OpalHKicker::OpalHKicker(const std::string &name, OpalHKicker *parent): OpalElement(name, parent) { - setElement((new XCorrectorRep(name))->makeWrappers()); + setElement(new XCorrectorRep(name)); } @@ -61,19 +60,11 @@ OpalHKicker *OpalHKicker::clone(const std::string &name) { void OpalHKicker:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - const CorrectorWrapper *corr = - dynamic_cast<const CorrectorWrapper *>(&base); - BDipoleField field; - - if(flag == ERROR_FLAG) { - field = corr->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = corr->getField(); - } else if(flag == IDEAL_FLAG) { - field = corr->getDesign().getField(); - } +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const XCorrectorRep *corr = dynamic_cast<const XCorrectorRep *>(&base); + BDipoleField field = corr->getField(); double scale = Physics::c / OpalData::getInstance()->getP0(); attributeRegistry["HKICK"]->setReal(- field.getBy() * scale); @@ -85,7 +76,7 @@ void OpalHKicker::update() { OpalElement::update(); XCorrectorRep *corr = - dynamic_cast<XCorrectorRep *>(getElement()->removeWrappers()); + dynamic_cast<XCorrectorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double factor = OpalData::getInstance()->getP0() / Physics::c; double kick = Attributes::getReal(itsAttr[KICK]); diff --git a/src/Elements/OpalHKicker.h b/src/Elements/OpalHKicker.h index 8136d2fe1..c7ca2f633 100644 --- a/src/Elements/OpalHKicker.h +++ b/src/Elements/OpalHKicker.h @@ -42,7 +42,7 @@ public: virtual OpalHKicker *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC corrector. virtual void update(); diff --git a/src/Elements/OpalHMonitor.cpp b/src/Elements/OpalHMonitor.cpp index 0949d5bf3..bce6380f1 100644 --- a/src/Elements/OpalHMonitor.cpp +++ b/src/Elements/OpalHMonitor.cpp @@ -48,7 +48,7 @@ void OpalHMonitor::update() { OpalElement::update(); XMonitorRep *mon = - dynamic_cast<XMonitorRep *>(getElement()->removeWrappers()); + dynamic_cast<XMonitorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); mon->setElementLength(length); diff --git a/src/Elements/OpalKicker.cpp b/src/Elements/OpalKicker.cpp index 2f72e6430..33cfd409c 100644 --- a/src/Elements/OpalKicker.cpp +++ b/src/Elements/OpalKicker.cpp @@ -24,7 +24,6 @@ // JMJ 18/12/2000 no longer need this, see code commented out below. //#include "Utilities/Options.h" #include "BeamlineCore/CorrectorRep.h" -#include "ComponentWrappers/CorrectorWrapper.h" #include "Physics/Physics.h" @@ -51,13 +50,13 @@ OpalKicker::OpalKicker(): registerOwnership(); - setElement((new CorrectorRep("KICKER"))->makeWrappers()); + setElement(new CorrectorRep("KICKER")); } OpalKicker::OpalKicker(const std::string &name, OpalKicker *parent): OpalElement(name, parent) { - setElement((new CorrectorRep(name))->makeWrappers()); + setElement(new CorrectorRep(name)); } @@ -71,21 +70,14 @@ OpalKicker *OpalKicker::clone(const std::string &name) { void OpalKicker:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { +fillRegisteredAttributes(const ElementBase &base) { Inform m("fillRegisteredAttributes "); - OpalElement::fillRegisteredAttributes(base, flag); - const CorrectorWrapper *corr = - dynamic_cast<const CorrectorWrapper *>(&base); - BDipoleField field; - - if(flag == ERROR_FLAG) { - field = corr->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = corr->getField(); - } else if(flag == IDEAL_FLAG) { - field = corr->getDesign().getField(); - } + OpalElement::fillRegisteredAttributes(base); + + const CorrectorRep *corr = dynamic_cast<const CorrectorRep *>(&base); + + BDipoleField field = corr->getField(); double scale = Physics::c / OpalData::getInstance()->getP0(); attributeRegistry["HKICK"]->setReal(- field.getBy() * scale); @@ -101,7 +93,7 @@ void OpalKicker::update() { OpalElement::update(); CorrectorRep *corr = - dynamic_cast<CorrectorRep *>(getElement()->removeWrappers()); + dynamic_cast<CorrectorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double factor = OpalData::getInstance()->getP0() / Physics::c; double hKick = Attributes::getReal(itsAttr[HKICK]); diff --git a/src/Elements/OpalKicker.h b/src/Elements/OpalKicker.h index cee91dd4a..e0eaa8eae 100644 --- a/src/Elements/OpalKicker.h +++ b/src/Elements/OpalKicker.h @@ -54,7 +54,7 @@ public: //END JMJ 15/12/2000, adding missing print method /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC corrector. virtual void update(); diff --git a/src/Elements/OpalMonitor.cpp b/src/Elements/OpalMonitor.cpp index 0e4bb0658..d3c03265c 100644 --- a/src/Elements/OpalMonitor.cpp +++ b/src/Elements/OpalMonitor.cpp @@ -56,7 +56,7 @@ void OpalMonitor::update() { OpalElement::update(); MonitorRep *mon = - dynamic_cast<MonitorRep *>(getElement()->removeWrappers()); + dynamic_cast<MonitorRep *>(getElement()); double length = std::max(0.01, Attributes::getReal(itsAttr[LENGTH])); mon->setElementLength(length); mon->setOutputFN(Attributes::getString(itsAttr[OUTFN])); diff --git a/src/Elements/OpalMultipole.cpp b/src/Elements/OpalMultipole.cpp index fbac71006..64f197f9a 100644 --- a/src/Elements/OpalMultipole.cpp +++ b/src/Elements/OpalMultipole.cpp @@ -21,7 +21,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/MultipoleRep.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Expressions/SValue.h" #include "Expressions/SRefExpr.h" #include "Physics/Physics.h" @@ -48,13 +47,13 @@ OpalMultipole::OpalMultipole(): registerOwnership(); - setElement((new MultipoleRep("MULTIPOLE"))->makeWrappers()); + setElement(new MultipoleRep("MULTIPOLE")); } OpalMultipole::OpalMultipole(const std::string &name, OpalMultipole *parent): OpalElement(name, parent) { - setElement((new MultipoleRep(name))->makeWrappers()); + setElement(new MultipoleRep(name)); } @@ -73,20 +72,12 @@ void OpalMultipole::print(std::ostream &os) const { void OpalMultipole:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - const MultipoleWrapper *mult = - dynamic_cast<const MultipoleWrapper *>(&base); - BMultipoleField field; +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - if(flag == ERROR_FLAG) { - field = mult->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = mult->getField(); - } else if(flag == IDEAL_FLAG) { - field = mult->getDesign().getField(); - } + const MultipoleRep *mult = dynamic_cast<const MultipoleRep *>(&base); + + BMultipoleField field = mult->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -113,7 +104,7 @@ void OpalMultipole::update() { // Magnet length. MultipoleRep *mult = - dynamic_cast<MultipoleRep *>(getElement()->removeWrappers()); + dynamic_cast<MultipoleRep *>(getElement()); double length = getLength(); mult->setElementLength(length); diff --git a/src/Elements/OpalMultipole.h b/src/Elements/OpalMultipole.h index 1517ed285..765080edc 100644 --- a/src/Elements/OpalMultipole.h +++ b/src/Elements/OpalMultipole.h @@ -47,7 +47,7 @@ public: virtual void print(std::ostream &) const; /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC multipole. virtual void update(); diff --git a/src/Elements/OpalMultipoleT.cpp b/src/Elements/OpalMultipoleT.cpp index f22337522..7e5925f70 100644 --- a/src/Elements/OpalMultipoleT.cpp +++ b/src/Elements/OpalMultipoleT.cpp @@ -31,7 +31,6 @@ #include "AbstractObjects/Expressions.h" #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Expressions/SValue.h" #include "Expressions/SRefExpr.h" #include "Physics/Physics.h" @@ -79,14 +78,14 @@ OpalMultipoleT::OpalMultipoleT(): registerOwnership(); - setElement((new MultipoleT("MULTIPOLET"))->makeWrappers()); + setElement(new MultipoleT("MULTIPOLET")); } OpalMultipoleT::OpalMultipoleT(const std::string &name, OpalMultipoleT *parent): OpalElement(name, parent) { - setElement((new MultipoleT(name))->makeWrappers()); + setElement(new MultipoleT(name)); } @@ -105,8 +104,8 @@ void OpalMultipoleT::print(std::ostream &os) const { void OpalMultipoleT:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const MultipoleT *multT = dynamic_cast<const MultipoleT*>(&base); for(unsigned int order = 1; order <= multT->getTransMaxOrder(); order++) { @@ -136,7 +135,7 @@ void OpalMultipoleT::update() { // Magnet length. double mm = 1000.; MultipoleT *multT = - dynamic_cast<MultipoleT*>(getElement()->removeWrappers()); + dynamic_cast<MultipoleT*>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH])*mm; double angle = Attributes::getReal(itsAttr[ANGLE]); multT->setElementLength(length); @@ -173,5 +172,5 @@ void OpalMultipoleT::update() { OpalElement::updateUnknown(multT); multT->initialise(); - setElement(multT->makeWrappers()); + setElement(multT); } diff --git a/src/Elements/OpalMultipoleT.h b/src/Elements/OpalMultipoleT.h index 63313b1da..d024da231 100644 --- a/src/Elements/OpalMultipoleT.h +++ b/src/Elements/OpalMultipoleT.h @@ -70,7 +70,7 @@ public: * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the MultipoleT with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalMultipoleTCurvedConstRadius.cpp b/src/Elements/OpalMultipoleTCurvedConstRadius.cpp index e141018ac..c22814344 100644 --- a/src/Elements/OpalMultipoleTCurvedConstRadius.cpp +++ b/src/Elements/OpalMultipoleTCurvedConstRadius.cpp @@ -32,7 +32,6 @@ #include "AbstractObjects/Expressions.h" #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Expressions/SValue.h" #include "Expressions/SRefExpr.h" #include "Physics/Physics.h" @@ -78,14 +77,14 @@ OpalMultipoleTCurvedConstRadius::OpalMultipoleTCurvedConstRadius(): registerOwnership(); - setElement((new MultipoleTCurvedConstRadius("MULTIPOLETCURVEDCONSTRADIUS"))->makeWrappers()); + setElement(new MultipoleTCurvedConstRadius("MULTIPOLETCURVEDCONSTRADIUS")); } OpalMultipoleTCurvedConstRadius::OpalMultipoleTCurvedConstRadius(const std::string &name, OpalMultipoleTCurvedConstRadius *parent): OpalElement(name, parent) { - setElement((new MultipoleTCurvedConstRadius(name))->makeWrappers()); + setElement(new MultipoleTCurvedConstRadius(name)); } @@ -104,8 +103,8 @@ void OpalMultipoleTCurvedConstRadius::print(std::ostream &os) const { void OpalMultipoleTCurvedConstRadius:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const MultipoleTCurvedConstRadius *multT = dynamic_cast<const MultipoleTCurvedConstRadius*>(&base); @@ -136,7 +135,7 @@ void OpalMultipoleTCurvedConstRadius::update() { // Magnet length. MultipoleTCurvedConstRadius *multT = - dynamic_cast<MultipoleTCurvedConstRadius*>(getElement()->removeWrappers()); + dynamic_cast<MultipoleTCurvedConstRadius*>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double angle = Attributes::getReal(itsAttr[ANGLE]); double boundingBoxLength = Attributes::getReal(itsAttr[BBLENGTH]); @@ -178,5 +177,5 @@ void OpalMultipoleTCurvedConstRadius::update() { // Transmit "unknown" attributes. OpalElement::updateUnknown(multT); - setElement(multT->makeWrappers()); + setElement(multT); } \ No newline at end of file diff --git a/src/Elements/OpalMultipoleTCurvedConstRadius.h b/src/Elements/OpalMultipoleTCurvedConstRadius.h index 1ed272dd7..3ddfc592f 100644 --- a/src/Elements/OpalMultipoleTCurvedConstRadius.h +++ b/src/Elements/OpalMultipoleTCurvedConstRadius.h @@ -70,7 +70,7 @@ public: * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the MultipoleTCurvedConstRadius with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalMultipoleTCurvedVarRadius.cpp b/src/Elements/OpalMultipoleTCurvedVarRadius.cpp index 6b6842a96..1fbe0989b 100644 --- a/src/Elements/OpalMultipoleTCurvedVarRadius.cpp +++ b/src/Elements/OpalMultipoleTCurvedVarRadius.cpp @@ -32,7 +32,6 @@ #include "AbstractObjects/Expressions.h" #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Expressions/SValue.h" #include "Expressions/SRefExpr.h" #include "Physics/Physics.h" @@ -77,14 +76,14 @@ OpalMultipoleTCurvedVarRadius::OpalMultipoleTCurvedVarRadius(): registerOwnership(); - setElement((new MultipoleTCurvedVarRadius("MULTIPOLETCURVEDVARRADIUS"))->makeWrappers()); + setElement(new MultipoleTCurvedVarRadius("MULTIPOLETCURVEDVARRADIUS")); } OpalMultipoleTCurvedVarRadius::OpalMultipoleTCurvedVarRadius(const std::string &name, OpalMultipoleTCurvedVarRadius *parent): OpalElement(name, parent) { - setElement((new MultipoleTCurvedVarRadius(name))->makeWrappers()); + setElement(new MultipoleTCurvedVarRadius(name)); } @@ -103,8 +102,8 @@ void OpalMultipoleTCurvedVarRadius::print(std::ostream &os) const { void OpalMultipoleTCurvedVarRadius:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const MultipoleTCurvedVarRadius *multT = dynamic_cast<const MultipoleTCurvedVarRadius*>(&base); @@ -134,7 +133,7 @@ void OpalMultipoleTCurvedVarRadius::update() { // Magnet length. MultipoleTCurvedVarRadius *multT = - dynamic_cast<MultipoleTCurvedVarRadius*>(getElement()->removeWrappers()); + dynamic_cast<MultipoleTCurvedVarRadius*>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double angle = Attributes::getReal(itsAttr[ANGLE]); double boundingBoxLength = Attributes::getReal(itsAttr[BBLENGTH]); @@ -176,5 +175,5 @@ void OpalMultipoleTCurvedVarRadius::update() { // Transmit "unknown" attributes. OpalElement::updateUnknown(multT); - setElement(multT->makeWrappers()); + setElement(multT); } \ No newline at end of file diff --git a/src/Elements/OpalMultipoleTCurvedVarRadius.h b/src/Elements/OpalMultipoleTCurvedVarRadius.h index b8949b33a..5e2637973 100644 --- a/src/Elements/OpalMultipoleTCurvedVarRadius.h +++ b/src/Elements/OpalMultipoleTCurvedVarRadius.h @@ -70,7 +70,7 @@ public: * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the MultipoleTCurvedVarRadius with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalMultipoleTStraight.cpp b/src/Elements/OpalMultipoleTStraight.cpp index 634dd5731..9312206e3 100644 --- a/src/Elements/OpalMultipoleTStraight.cpp +++ b/src/Elements/OpalMultipoleTStraight.cpp @@ -32,7 +32,6 @@ #include "AbstractObjects/Expressions.h" #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Expressions/SValue.h" #include "Expressions/SRefExpr.h" #include "Physics/Physics.h" @@ -72,14 +71,14 @@ OpalMultipoleTStraight::OpalMultipoleTStraight(): registerOwnership(); - setElement((new MultipoleTStraight("MULTIPOLETSTRAIGHT"))->makeWrappers()); + setElement(new MultipoleTStraight("MULTIPOLETSTRAIGHT")); } OpalMultipoleTStraight::OpalMultipoleTStraight(const std::string &name, OpalMultipoleTStraight *parent): OpalElement(name, parent) { - setElement((new MultipoleTStraight(name))->makeWrappers()); + setElement(new MultipoleTStraight(name)); } @@ -98,8 +97,8 @@ void OpalMultipoleTStraight::print(std::ostream &os) const { void OpalMultipoleTStraight:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const MultipoleTStraight *multT = dynamic_cast<const MultipoleTStraight*>(&base); @@ -128,7 +127,7 @@ void OpalMultipoleTStraight::update() { // Magnet length. MultipoleTStraight *multT = - dynamic_cast<MultipoleTStraight*>(getElement()->removeWrappers()); + dynamic_cast<MultipoleTStraight*>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double boundingBoxLength = Attributes::getReal(itsAttr[BBLENGTH]); multT->setElementLength(length); @@ -159,5 +158,5 @@ void OpalMultipoleTStraight::update() { // Transmit "unknown" attributes. OpalElement::updateUnknown(multT); - setElement(multT->makeWrappers()); + setElement(multT); } \ No newline at end of file diff --git a/src/Elements/OpalMultipoleTStraight.h b/src/Elements/OpalMultipoleTStraight.h index dda14c3bb..8f379c6cf 100644 --- a/src/Elements/OpalMultipoleTStraight.h +++ b/src/Elements/OpalMultipoleTStraight.h @@ -68,7 +68,7 @@ public: * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the MultipoleT with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalOctupole.cpp b/src/Elements/OpalOctupole.cpp index 9f2df2f17..d4276a71d 100644 --- a/src/Elements/OpalOctupole.cpp +++ b/src/Elements/OpalOctupole.cpp @@ -19,7 +19,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/MultipoleRep.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Fields/BMultipoleField.h" #include "Physics/Physics.h" #include "Utilities/Options.h" @@ -42,13 +41,13 @@ OpalOctupole::OpalOctupole(): registerOwnership(); - setElement((new MultipoleRep("OCTUPOLE"))->makeWrappers()); + setElement(new MultipoleRep("OCTUPOLE")); } OpalOctupole::OpalOctupole(const std::string &name, OpalOctupole *parent): OpalElement(name, parent) { - setElement((new MultipoleRep(name))->makeWrappers()); + setElement(new MultipoleRep(name)); } @@ -67,22 +66,11 @@ void OpalOctupole::print(std::ostream &os) const { void OpalOctupole:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - const MultipoleWrapper *mult = - dynamic_cast<const MultipoleWrapper *>(&base); - BMultipoleField field; - - // Get the desired field. - if(flag == ERROR_FLAG) { - field = mult->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = mult->getField(); - } else if(flag == IDEAL_FLAG) { - field = mult->getDesign().getField(); - } + const MultipoleRep *oct = dynamic_cast<const MultipoleRep *>(&base); + BMultipoleField field = oct->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -108,7 +96,7 @@ void OpalOctupole::update() { OpalElement::update(); MultipoleRep *oct = - dynamic_cast<MultipoleRep *>(getElement()->removeWrappers()); + dynamic_cast<MultipoleRep *>(getElement()); oct->setElementLength(Attributes::getReal(itsAttr[LENGTH])); double factor = OpalData::getInstance()->getP0() / (Physics::c * 6.0); BMultipoleField field; diff --git a/src/Elements/OpalOctupole.h b/src/Elements/OpalOctupole.h index d57efd6b0..0a7800e7e 100644 --- a/src/Elements/OpalOctupole.h +++ b/src/Elements/OpalOctupole.h @@ -48,7 +48,7 @@ public: virtual void print(std::ostream &) const; /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC multipole. virtual void update(); diff --git a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp index 9c7acc614..9e2185829 100644 --- a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp +++ b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.cpp @@ -76,8 +76,8 @@ OpalGlobalCartesianOffset::OpalGlobalCartesianOffset(const std::string &name, Op OpalGlobalCartesianOffset::~OpalGlobalCartesianOffset() {} void OpalGlobalCartesianOffset::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalGlobalCartesianOffset::update() { diff --git a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.h b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.h index e01f9f628..2191e01db 100644 --- a/src/Elements/OpalOffset/OpalGlobalCartesianOffset.h +++ b/src/Elements/OpalOffset/OpalGlobalCartesianOffset.h @@ -62,7 +62,7 @@ class OpalGlobalCartesianOffset : public OpalElement { virtual OpalGlobalCartesianOffset *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * OpalCylindricalOffset diff --git a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp index 0638ccf9a..bc6aa09c1 100644 --- a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp +++ b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.cpp @@ -73,8 +73,8 @@ OpalGlobalCylindricalOffset::OpalGlobalCylindricalOffset(const std::string &name OpalGlobalCylindricalOffset::~OpalGlobalCylindricalOffset() {} void OpalGlobalCylindricalOffset::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalGlobalCylindricalOffset::update() { diff --git a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.h b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.h index 3da3ad95e..a9dd909ee 100644 --- a/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.h +++ b/src/Elements/OpalOffset/OpalGlobalCylindricalOffset.h @@ -57,7 +57,7 @@ class OpalGlobalCylindricalOffset : public OpalElement { virtual OpalGlobalCylindricalOffset *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * OpalCylindricalOffset diff --git a/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp b/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp index 807a5d619..49d4b5b53 100644 --- a/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp +++ b/src/Elements/OpalOffset/OpalLocalCartesianOffset.cpp @@ -85,8 +85,8 @@ OpalLocalCartesianOffset::OpalLocalCartesianOffset(const std::string &name, Opal OpalLocalCartesianOffset::~OpalLocalCartesianOffset() {} void OpalLocalCartesianOffset::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const Offset* offset = dynamic_cast<const Offset*>(&base); if (offset == NULL) { throw OpalException("OpalVariableRFCavity::fillRegisteredAttributes", @@ -103,7 +103,7 @@ void OpalLocalCartesianOffset::fillRegisteredAttributes void OpalLocalCartesianOffset::update() { // getOpalName() comes from AbstractObjects/Object.h - Offset *offset = dynamic_cast<Offset*>(getElement()->removeWrappers()); + Offset *offset = dynamic_cast<Offset*>(getElement()); std::string name = getOpalName(); Vector_t pos(Attributes::getReal(itsAttr[END_POSITION_X]), Attributes::getReal(itsAttr[END_POSITION_Y]), 0.); diff --git a/src/Elements/OpalOffset/OpalLocalCartesianOffset.h b/src/Elements/OpalOffset/OpalLocalCartesianOffset.h index 14f28969c..07f3dbd7c 100644 --- a/src/Elements/OpalOffset/OpalLocalCartesianOffset.h +++ b/src/Elements/OpalOffset/OpalLocalCartesianOffset.h @@ -64,7 +64,7 @@ class OpalLocalCartesianOffset : public OpalElement { virtual OpalLocalCartesianOffset *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * OpalCylindricalOffset diff --git a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp index 6fc000cc8..bed08e52c 100644 --- a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp +++ b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.cpp @@ -72,8 +72,8 @@ OpalLocalCylindricalOffset::OpalLocalCylindricalOffset(const std::string &name, OpalLocalCylindricalOffset::~OpalLocalCylindricalOffset() {} void OpalLocalCylindricalOffset::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalLocalCylindricalOffset::update() { diff --git a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.h b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.h index 732f77cb4..29822f53e 100644 --- a/src/Elements/OpalOffset/OpalLocalCylindricalOffset.h +++ b/src/Elements/OpalOffset/OpalLocalCylindricalOffset.h @@ -61,7 +61,7 @@ class OpalLocalCylindricalOffset : public OpalElement { virtual OpalLocalCylindricalOffset *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * OpalCylindricalOffset diff --git a/src/Elements/OpalParallelPlate.cpp b/src/Elements/OpalParallelPlate.cpp index 8cd04c46c..9140886db 100644 --- a/src/Elements/OpalParallelPlate.cpp +++ b/src/Elements/OpalParallelPlate.cpp @@ -73,17 +73,15 @@ OpalParallelPlate *OpalParallelPlate::clone(const std::string &name) { } -void OpalParallelPlate::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - - if(flag != ERROR_FLAG) { - const ParallelPlateRep *pplate = - dynamic_cast<const ParallelPlateRep *>(base.removeWrappers()); - attributeRegistry["VOLT"]->setReal(pplate->getAmplitude()); - attributeRegistry["FREQ"]->setReal(pplate->getFrequency()); - attributeRegistry["LAG"]->setReal(pplate->getPhase()); - attributeRegistry["PLENGTH"]->setReal(pplate->getElementLength()); - } +void OpalParallelPlate::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const ParallelPlateRep *pplate = + dynamic_cast<const ParallelPlateRep *>(&base); + attributeRegistry["VOLT"]->setReal(pplate->getAmplitude()); + attributeRegistry["FREQ"]->setReal(pplate->getFrequency()); + attributeRegistry["LAG"]->setReal(pplate->getPhase()); + attributeRegistry["PLENGTH"]->setReal(pplate->getElementLength()); } @@ -91,7 +89,7 @@ void OpalParallelPlate::update() { OpalElement::update(); ParallelPlateRep *pplate = - dynamic_cast<ParallelPlateRep *>(getElement()->removeWrappers()); + dynamic_cast<ParallelPlateRep *>(getElement()); double vPeak = Attributes::getReal(itsAttr[VOLT]); // double phase = two_pi * Attributes::getReal(itsAttr[LAG]); diff --git a/src/Elements/OpalParallelPlate.h b/src/Elements/OpalParallelPlate.h index d17d611c8..665685013 100644 --- a/src/Elements/OpalParallelPlate.h +++ b/src/Elements/OpalParallelPlate.h @@ -46,7 +46,7 @@ public: virtual OpalParallelPlate *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC cavity. virtual void update(); diff --git a/src/Elements/OpalPepperPot.cpp b/src/Elements/OpalPepperPot.cpp index 556ec9331..5543d7a19 100644 --- a/src/Elements/OpalPepperPot.cpp +++ b/src/Elements/OpalPepperPot.cpp @@ -70,12 +70,12 @@ OpalPepperPot *OpalPepperPot::clone(const std::string &name) { } -void OpalPepperPot::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalPepperPot::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); // const FlexibleCollimatorRep *ppo = - // dynamic_cast<const FlexibleCollimatorRep *>(base.removeWrappers()); + // dynamic_cast<const FlexibleCollimatorRep *>(&base); // attributeRegistry["XSIZE"]->setReal(ppo->getXsize()); // attributeRegistry["YSIZE"]->setReal(ppo->getYsize()); @@ -85,7 +85,7 @@ void OpalPepperPot::update() { OpalElement::update(); FlexibleCollimatorRep *ppo = - dynamic_cast<FlexibleCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<FlexibleCollimatorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); ppo->setElementLength(length); ppo->setOutputFN(Attributes::getString(itsAttr[OUTFN])); diff --git a/src/Elements/OpalPepperPot.h b/src/Elements/OpalPepperPot.h index 7647a0e64..820e11cf4 100644 --- a/src/Elements/OpalPepperPot.h +++ b/src/Elements/OpalPepperPot.h @@ -48,7 +48,7 @@ public: virtual OpalPepperPot *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalPolynomialTimeDependence.cpp b/src/Elements/OpalPolynomialTimeDependence.cpp index 1b0a60e9a..aad8501ef 100644 --- a/src/Elements/OpalPolynomialTimeDependence.cpp +++ b/src/Elements/OpalPolynomialTimeDependence.cpp @@ -76,8 +76,8 @@ OpalPolynomialTimeDependence::OpalPolynomialTimeDependence(const std::string &na OpalPolynomialTimeDependence::~OpalPolynomialTimeDependence() {} void OpalPolynomialTimeDependence::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalPolynomialTimeDependence::update() { diff --git a/src/Elements/OpalPolynomialTimeDependence.h b/src/Elements/OpalPolynomialTimeDependence.h index f6df68961..175ea7256 100644 --- a/src/Elements/OpalPolynomialTimeDependence.h +++ b/src/Elements/OpalPolynomialTimeDependence.h @@ -55,7 +55,7 @@ class OpalPolynomialTimeDependence : public OpalElement { virtual OpalPolynomialTimeDependence *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * PolynomialTimeDependence diff --git a/src/Elements/OpalProbe.cpp b/src/Elements/OpalProbe.cpp index c48d040c1..ba927c533 100644 --- a/src/Elements/OpalProbe.cpp +++ b/src/Elements/OpalProbe.cpp @@ -74,8 +74,8 @@ OpalProbe *OpalProbe::clone(const std::string &name) { } -void OpalProbe::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalProbe::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -83,7 +83,7 @@ void OpalProbe::update() { OpalElement::update(); ProbeRep *prob = - dynamic_cast<ProbeRep *>(getElement()->removeWrappers()); + dynamic_cast<ProbeRep *>(getElement()); const double mm2m = 0.001; double xstart = mm2m * Attributes::getReal(itsAttr[XSTART]); double xend = mm2m * Attributes::getReal(itsAttr[XEND]); diff --git a/src/Elements/OpalProbe.h b/src/Elements/OpalProbe.h index eb4dc29aa..3ee47889c 100644 --- a/src/Elements/OpalProbe.h +++ b/src/Elements/OpalProbe.h @@ -46,7 +46,7 @@ public: virtual OpalProbe *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC probe. virtual void update(); diff --git a/src/Elements/OpalQuadrupole.cpp b/src/Elements/OpalQuadrupole.cpp index 4decff3e6..a42b0f490 100644 --- a/src/Elements/OpalQuadrupole.cpp +++ b/src/Elements/OpalQuadrupole.cpp @@ -19,7 +19,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/MultipoleRep.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Fields/BMultipoleField.h" #include "Physics/Physics.h" #include "Utilities/Options.h" @@ -84,22 +83,11 @@ void OpalQuadrupole::print(std::ostream &os) const { void OpalQuadrupole:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - const MultipoleWrapper *mult = - dynamic_cast<const MultipoleWrapper *>(&base); - BMultipoleField field; - - // Get the desired field. - if(flag == ERROR_FLAG) { - field = mult->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = mult->getField(); - } else if(flag == IDEAL_FLAG) { - field = mult->getDesign().getField(); - } + const MultipoleRep *quad = dynamic_cast<const MultipoleRep *>(&base); + BMultipoleField field = quad->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -125,7 +113,7 @@ void OpalQuadrupole::update() { OpalElement::update(); MultipoleRep *quad = - dynamic_cast<MultipoleRep *>(getElement()->removeWrappers()); + dynamic_cast<MultipoleRep *>(getElement()); quad->setElementLength(Attributes::getReal(itsAttr[LENGTH])); double factor = OpalData::getInstance()->getP0() / Physics::c; diff --git a/src/Elements/OpalQuadrupole.h b/src/Elements/OpalQuadrupole.h index b632f2443..fa0abaabb 100644 --- a/src/Elements/OpalQuadrupole.h +++ b/src/Elements/OpalQuadrupole.h @@ -49,7 +49,7 @@ public: virtual void print(std::ostream &) const; /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC multipole. virtual void update(); diff --git a/src/Elements/OpalRBend.cpp b/src/Elements/OpalRBend.cpp index aa52d7c36..dec75dc88 100644 --- a/src/Elements/OpalRBend.cpp +++ b/src/Elements/OpalRBend.cpp @@ -20,7 +20,6 @@ #include "Attributes/Attributes.h" #include "BeamlineCore/RBendRep.h" #include "Fields/BMultipoleField.h" -#include "ComponentWrappers/RBendWrapper.h" #include "Physics/Physics.h" #include "Structure/OpalWake.h" #include "Structure/ParticleMatterInteraction.h" @@ -35,7 +34,7 @@ OpalRBend::OpalRBend(): registerOwnership(); - setElement((new RBendRep("RBEND"))->makeWrappers()); + setElement(new RBendRep("RBEND")); } @@ -43,7 +42,7 @@ OpalRBend::OpalRBend(const std::string &name, OpalRBend *parent): OpalBend(name, parent), owk_m(0), parmatint_m(NULL) { - setElement((new RBendRep(name))->makeWrappers()); + setElement(new RBendRep(name)); } @@ -61,22 +60,11 @@ OpalRBend *OpalRBend::clone(const std::string &name) { void OpalRBend:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - const RBendWrapper *bend = - dynamic_cast<const RBendWrapper *>(&base); - BMultipoleField field; - - // Get the desired field. - if(flag == ERROR_FLAG) { - field = bend->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = bend->getField(); - } else if(flag == IDEAL_FLAG) { - field = bend->getDesign().getField(); - } + const RBendRep *bend = dynamic_cast<const RBendRep *>(&base); + BMultipoleField field = bend->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -110,7 +98,7 @@ void OpalRBend::update() { // Define geometry. RBendRep *bend = - dynamic_cast<RBendRep *>(getElement()->removeWrappers()); + dynamic_cast<RBendRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double angle = Attributes::getReal(itsAttr[ANGLE]); double e1 = Attributes::getReal(itsAttr[E1]); diff --git a/src/Elements/OpalRBend.h b/src/Elements/OpalRBend.h index 526d9643c..2bc1c527f 100644 --- a/src/Elements/OpalRBend.h +++ b/src/Elements/OpalRBend.h @@ -36,7 +36,7 @@ public: virtual OpalRBend *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC bend. virtual void update(); diff --git a/src/Elements/OpalRBend3D.cpp b/src/Elements/OpalRBend3D.cpp index 0c5954f8f..f64500bfd 100644 --- a/src/Elements/OpalRBend3D.cpp +++ b/src/Elements/OpalRBend3D.cpp @@ -60,7 +60,7 @@ OpalRBend3D::OpalRBend3D(): registerOwnership(); - setElement((new RBend3D("RBEND3D"))->makeWrappers()); + setElement(new RBend3D("RBEND3D")); } OpalRBend3D::OpalRBend3D(const std::string &name, OpalRBend3D *parent): @@ -68,7 +68,7 @@ OpalRBend3D::OpalRBend3D(const std::string &name, OpalRBend3D *parent): owk_m(0), parmatint_m(NULL) { - setElement((new RBend3D(name))->makeWrappers()); + setElement(new RBend3D(name)); } OpalRBend3D::~OpalRBend3D() { @@ -84,8 +84,8 @@ OpalRBend3D *OpalRBend3D::clone(const std::string &name) { void OpalRBend3D:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalRBend3D::update() { @@ -93,7 +93,7 @@ void OpalRBend3D::update() { // Define geometry. RBend3D *bend = - dynamic_cast<RBend3D *>(getElement()->removeWrappers()); + dynamic_cast<RBend3D *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double angle = Attributes::getReal(itsAttr[ANGLE]); double e1 = Attributes::getReal(itsAttr[E1]); diff --git a/src/Elements/OpalRBend3D.h b/src/Elements/OpalRBend3D.h index c1e8a5b8f..650fddc22 100644 --- a/src/Elements/OpalRBend3D.h +++ b/src/Elements/OpalRBend3D.h @@ -52,7 +52,7 @@ public: virtual OpalRBend3D *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC bend. virtual void update(); diff --git a/src/Elements/OpalRCollimator.cpp b/src/Elements/OpalRCollimator.cpp index 61508f502..cec559076 100644 --- a/src/Elements/OpalRCollimator.cpp +++ b/src/Elements/OpalRCollimator.cpp @@ -63,11 +63,11 @@ OpalRCollimator *OpalRCollimator::clone(const std::string &name) { void OpalRCollimator:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const FlexibleCollimatorRep *coll = - dynamic_cast<const FlexibleCollimatorRep *>(base.removeWrappers()); + dynamic_cast<const FlexibleCollimatorRep *>(&base); std::string Double("(-?[0-9]+\\.?[0-9]*([Ee][+-]?[0-9]+)?)"); std::string desc = coll->getDescription(); @@ -88,7 +88,7 @@ void OpalRCollimator::update() { OpalElement::update(); FlexibleCollimatorRep *coll = - dynamic_cast<FlexibleCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<FlexibleCollimatorRep *>(getElement()); coll->setElementLength(Attributes::getReal(itsAttr[LENGTH])); if (getOpalName() != "RCOLLIMATOR") { diff --git a/src/Elements/OpalRCollimator.h b/src/Elements/OpalRCollimator.h index 7d3e46960..12dfbf436 100644 --- a/src/Elements/OpalRCollimator.h +++ b/src/Elements/OpalRCollimator.h @@ -43,7 +43,7 @@ public: virtual OpalRCollimator *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalRingDefinition.cpp b/src/Elements/OpalRingDefinition.cpp index 95180a951..b99b160cf 100644 --- a/src/Elements/OpalRingDefinition.cpp +++ b/src/Elements/OpalRingDefinition.cpp @@ -100,12 +100,12 @@ OpalRingDefinition::OpalRingDefinition(const std::string &name, OpalRingDefiniti OpalRingDefinition::~OpalRingDefinition() {} void OpalRingDefinition::fillRegisteredAttributes -(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalRingDefinition::update() { - Ring *ring = dynamic_cast<Ring*>(getElement()->removeWrappers()); + Ring *ring = dynamic_cast<Ring*>(getElement()); double degree = Physics::pi/180.; double metres = 1e3; ring->setBeamPhiInit(Attributes::getReal(itsAttr[BEAM_PHIINIT])); @@ -138,5 +138,5 @@ void OpalRingDefinition::update() { ring->setRingAperture(minR, maxR); } - setElement(ring->makeWrappers()); + setElement(ring); } diff --git a/src/Elements/OpalRingDefinition.h b/src/Elements/OpalRingDefinition.h index c903a142e..7fe2755e4 100644 --- a/src/Elements/OpalRingDefinition.h +++ b/src/Elements/OpalRingDefinition.h @@ -68,7 +68,7 @@ class OpalRingDefinition: public OpalElement { virtual OpalRingDefinition *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the Ring */ void update(); diff --git a/src/Elements/OpalSBend.cpp b/src/Elements/OpalSBend.cpp index 06af04b37..785c1bf3d 100644 --- a/src/Elements/OpalSBend.cpp +++ b/src/Elements/OpalSBend.cpp @@ -20,7 +20,6 @@ #include "Attributes/Attributes.h" #include "BeamlineCore/SBendRep.h" #include "Fields/BMultipoleField.h" -#include "ComponentWrappers/SBendWrapper.h" #include "Physics/Physics.h" #include "Structure/OpalWake.h" #include "Structure/ParticleMatterInteraction.h" @@ -61,22 +60,11 @@ OpalSBend *OpalSBend::clone(const std::string &name) { void OpalSBend:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - const SBendWrapper *bend = - dynamic_cast<const SBendWrapper *>(&base); - BMultipoleField field; - - // Get the desired field. - if(flag == ERROR_FLAG) { - field = bend->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = bend->getField(); - } else if(flag == IDEAL_FLAG) { - field = bend->getDesign().getField(); - } + const SBendRep *bend = dynamic_cast<const SBendRep *>(&base); + BMultipoleField field = bend->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -110,7 +98,7 @@ void OpalSBend::update() { OpalElement::update(); // Define geometry. - SBendRep *bend = dynamic_cast<SBendRep *>(getElement()->removeWrappers()); + SBendRep *bend = dynamic_cast<SBendRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double angle = Attributes::getReal(itsAttr[ANGLE]); double e1 = Attributes::getReal(itsAttr[E1]); diff --git a/src/Elements/OpalSBend.h b/src/Elements/OpalSBend.h index d1e4fa857..007d8dd18 100644 --- a/src/Elements/OpalSBend.h +++ b/src/Elements/OpalSBend.h @@ -36,7 +36,7 @@ public: virtual OpalSBend *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC bend. virtual void update(); diff --git a/src/Elements/OpalSBend3D.cpp b/src/Elements/OpalSBend3D.cpp index 02aab26dd..f668c8fa4 100644 --- a/src/Elements/OpalSBend3D.cpp +++ b/src/Elements/OpalSBend3D.cpp @@ -68,13 +68,13 @@ OpalSBend3D *OpalSBend3D::clone(const std::string &name) { void OpalSBend3D:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalSBend3D::update() { - SBend3D *bend = dynamic_cast<SBend3D*>(getElement()->removeWrappers()); + SBend3D *bend = dynamic_cast<SBend3D*>(getElement()); if (itsAttr[FIELD_UNITS]) bend->setFieldUnits(Attributes::getReal(itsAttr[FIELD_UNITS])); if (itsAttr[LENGTH_UNITS]) diff --git a/src/Elements/OpalSBend3D.h b/src/Elements/OpalSBend3D.h index 23c0378ac..61c53dd3d 100644 --- a/src/Elements/OpalSBend3D.h +++ b/src/Elements/OpalSBend3D.h @@ -57,7 +57,7 @@ class OpalSBend3D: public OpalElement { * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the SBend3D with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalSRot.cpp b/src/Elements/OpalSRot.cpp index 0d549f4f1..61d3ef9f2 100644 --- a/src/Elements/OpalSRot.cpp +++ b/src/Elements/OpalSRot.cpp @@ -55,8 +55,8 @@ OpalSRot *OpalSRot::clone(const std::string &name) { void OpalSRot:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); double angle = Attributes::getReal(itsAttr[ANGLE]); attributeRegistry["SANGLE"]->setReal(angle); diff --git a/src/Elements/OpalSRot.h b/src/Elements/OpalSRot.h index f21d3441b..a150cbdb0 100644 --- a/src/Elements/OpalSRot.h +++ b/src/Elements/OpalSRot.h @@ -44,7 +44,7 @@ public: virtual OpalSRot *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC patch. virtual void update(); diff --git a/src/Elements/OpalScalingFFAMagnet.cpp b/src/Elements/OpalScalingFFAMagnet.cpp index 5eabe8150..f6c4dd366 100644 --- a/src/Elements/OpalScalingFFAMagnet.cpp +++ b/src/Elements/OpalScalingFFAMagnet.cpp @@ -102,13 +102,13 @@ OpalScalingFFAMagnet *OpalScalingFFAMagnet::clone(const std::string &name) { void OpalScalingFFAMagnet:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalScalingFFAMagnet::update() { - ScalingFFAMagnet *magnet = dynamic_cast<ScalingFFAMagnet*>(getElement()->removeWrappers()); + ScalingFFAMagnet *magnet = dynamic_cast<ScalingFFAMagnet*>(getElement()); // use L = r0*theta; we define the magnet ito length for UI but ito angles // internally; and use m as external default unit and mm internally diff --git a/src/Elements/OpalScalingFFAMagnet.h b/src/Elements/OpalScalingFFAMagnet.h index ac40b71b3..3a58d768c 100644 --- a/src/Elements/OpalScalingFFAMagnet.h +++ b/src/Elements/OpalScalingFFAMagnet.h @@ -67,7 +67,7 @@ class OpalScalingFFAMagnet : public OpalElement { * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the ScalingFFA with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalSeparator.cpp b/src/Elements/OpalSeparator.cpp index 65447322a..1dd3eac9a 100644 --- a/src/Elements/OpalSeparator.cpp +++ b/src/Elements/OpalSeparator.cpp @@ -53,16 +53,13 @@ OpalSeparator *OpalSeparator::clone(const std::string &name) { void OpalSeparator:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - - if(flag != ERROR_FLAG) { - const SeparatorRep *sep = - dynamic_cast<const SeparatorRep *>(base.removeWrappers()); - double length = sep->getElementLength(); - attributeRegistry["EXL"]->setReal(length * sep->getEx()); - attributeRegistry["EYL"]->setReal(length * sep->getEy()); - } +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const SeparatorRep *sep = dynamic_cast<const SeparatorRep *>(&base); + double length = sep->getElementLength(); + attributeRegistry["EXL"]->setReal(length * sep->getEx()); + attributeRegistry["EYL"]->setReal(length * sep->getEy()); } @@ -70,7 +67,7 @@ void OpalSeparator::update() { OpalElement::update(); SeparatorRep *sep = - dynamic_cast<SeparatorRep *>(getElement()->removeWrappers()); + dynamic_cast<SeparatorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double Ex = Attributes::getReal(itsAttr[EX]) * 1.0e6; double Ey = Attributes::getReal(itsAttr[EY]) * 1.0e6; diff --git a/src/Elements/OpalSeparator.h b/src/Elements/OpalSeparator.h index d0bd14eb2..29061161f 100644 --- a/src/Elements/OpalSeparator.h +++ b/src/Elements/OpalSeparator.h @@ -41,7 +41,7 @@ public: virtual OpalSeparator *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC separator. virtual void update(); diff --git a/src/Elements/OpalSeptum.cpp b/src/Elements/OpalSeptum.cpp index eabbb717f..91c224e46 100644 --- a/src/Elements/OpalSeptum.cpp +++ b/src/Elements/OpalSeptum.cpp @@ -72,8 +72,8 @@ OpalSeptum *OpalSeptum::clone(const std::string &name) { } -void OpalSeptum::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalSeptum::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -81,7 +81,7 @@ void OpalSeptum::fillRegisteredAttributes(const ElementBase &base, ValueFlag fla void OpalSeptum::update() { OpalElement::update(); - SeptumRep *sept = dynamic_cast<SeptumRep *>(getElement()->removeWrappers()); + SeptumRep *sept = dynamic_cast<SeptumRep *>(getElement()); const double mm2m = 0.001; double xstart = mm2m * Attributes::getReal(itsAttr[XSTART]); diff --git a/src/Elements/OpalSeptum.h b/src/Elements/OpalSeptum.h index 191204532..ab9a22d38 100644 --- a/src/Elements/OpalSeptum.h +++ b/src/Elements/OpalSeptum.h @@ -45,7 +45,7 @@ public: virtual OpalSeptum *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC septum. virtual void update(); diff --git a/src/Elements/OpalSextupole.cpp b/src/Elements/OpalSextupole.cpp index cb971b902..357120ebd 100644 --- a/src/Elements/OpalSextupole.cpp +++ b/src/Elements/OpalSextupole.cpp @@ -19,7 +19,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/MultipoleRep.h" -#include "ComponentWrappers/MultipoleWrapper.h" #include "Fields/BMultipoleField.h" #include "Physics/Physics.h" #include "Utilities/Options.h" @@ -42,13 +41,13 @@ OpalSextupole::OpalSextupole(): registerOwnership(); - setElement((new MultipoleRep("SEXTUPOLE"))->makeWrappers()); + setElement(new MultipoleRep("SEXTUPOLE")); } OpalSextupole::OpalSextupole(const std::string &name, OpalSextupole *parent): OpalElement(name, parent) { - setElement((new MultipoleRep(name))->makeWrappers()); + setElement(new MultipoleRep(name)); } @@ -68,22 +67,11 @@ void OpalSextupole::print(std::ostream &os) const { void OpalSextupole:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); - // Get the desired field. - const MultipoleWrapper *mult = - dynamic_cast<const MultipoleWrapper *>(&base); - BMultipoleField field; - - // Get the desired field. - if(flag == ERROR_FLAG) { - field = mult->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = mult->getField(); - } else if(flag == IDEAL_FLAG) { - field = mult->getDesign().getField(); - } + const MultipoleRep *sext = dynamic_cast<const MultipoleRep *>(&base); + BMultipoleField field = sext->getField(); double length = getLength(); double scale = Physics::c / OpalData::getInstance()->getP0(); @@ -109,7 +97,7 @@ void OpalSextupole::update() { OpalElement::update(); MultipoleRep *sext = - dynamic_cast<MultipoleRep *>(getElement()->removeWrappers()); + dynamic_cast<MultipoleRep *>(getElement()); sext->setElementLength(Attributes::getReal(itsAttr[LENGTH])); double factor = OpalData::getInstance()->getP0() / (Physics::c * 2.0); BMultipoleField field; diff --git a/src/Elements/OpalSextupole.h b/src/Elements/OpalSextupole.h index 124ba2fa3..24f4e2991 100644 --- a/src/Elements/OpalSextupole.h +++ b/src/Elements/OpalSextupole.h @@ -47,7 +47,7 @@ public: virtual void print(std::ostream &) const; /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC multipole. virtual void update(); diff --git a/src/Elements/OpalSlit.cpp b/src/Elements/OpalSlit.cpp index 3f1e4aa4a..6199e286f 100644 --- a/src/Elements/OpalSlit.cpp +++ b/src/Elements/OpalSlit.cpp @@ -63,11 +63,11 @@ OpalSlit *OpalSlit::clone(const std::string &name) { } -void OpalSlit::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalSlit::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const FlexibleCollimatorRep *coll = - dynamic_cast<const FlexibleCollimatorRep *>(base.removeWrappers()); + dynamic_cast<const FlexibleCollimatorRep *>(&base); std::string Double("(-?[0-9]+\\.?[0-9]*([Ee][+-]?[0-9]+)?)"); std::string desc = coll->getDescription(); @@ -88,7 +88,7 @@ void OpalSlit::update() { OpalElement::update(); FlexibleCollimatorRep *coll = - dynamic_cast<FlexibleCollimatorRep *>(getElement()->removeWrappers()); + dynamic_cast<FlexibleCollimatorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); coll->setElementLength(length); diff --git a/src/Elements/OpalSlit.h b/src/Elements/OpalSlit.h index 463812ac1..b3e38e67c 100644 --- a/src/Elements/OpalSlit.h +++ b/src/Elements/OpalSlit.h @@ -43,7 +43,7 @@ public: virtual OpalSlit *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC collimator. virtual void update(); diff --git a/src/Elements/OpalSolenoid.cpp b/src/Elements/OpalSolenoid.cpp index af2dcfe3c..241bdfd83 100644 --- a/src/Elements/OpalSolenoid.cpp +++ b/src/Elements/OpalSolenoid.cpp @@ -60,16 +60,14 @@ OpalSolenoid *OpalSolenoid::clone(const std::string &name) { void OpalSolenoid:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - - if(flag != ERROR_FLAG) { - const SolenoidRep *sol = - dynamic_cast<const SolenoidRep *>(base.removeWrappers()); - double length = sol->getElementLength(); - double ks = length * sol->getBz() * Physics::c / OpalData::getInstance()->getP0(); - attributeRegistry["KS"]->setReal(ks); - } +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const SolenoidRep *sol = + dynamic_cast<const SolenoidRep *>(&base); + double length = sol->getElementLength(); + double ks = length * sol->getBz() * Physics::c / OpalData::getInstance()->getP0(); + attributeRegistry["KS"]->setReal(ks); } @@ -77,7 +75,7 @@ void OpalSolenoid::update() { OpalElement::update(); SolenoidRep *sol = - dynamic_cast<SolenoidRep *>(getElement()->removeWrappers()); + dynamic_cast<SolenoidRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double Bz = Attributes::getReal(itsAttr[KS]) * OpalData::getInstance()->getP0() / Physics::c; bool fast = Attributes::getBool(itsAttr[FAST]); diff --git a/src/Elements/OpalSolenoid.h b/src/Elements/OpalSolenoid.h index bb5ab7539..268dee5c1 100644 --- a/src/Elements/OpalSolenoid.h +++ b/src/Elements/OpalSolenoid.h @@ -43,7 +43,7 @@ public: virtual OpalSolenoid *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC solenoid. virtual void update(); diff --git a/src/Elements/OpalSource.cpp b/src/Elements/OpalSource.cpp index 1a94ac510..92b54d6f2 100644 --- a/src/Elements/OpalSource.cpp +++ b/src/Elements/OpalSource.cpp @@ -52,8 +52,8 @@ OpalSource *OpalSource::clone(const std::string &name) { void OpalSource:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -61,7 +61,7 @@ void OpalSource::update() { OpalElement::update(); SourceRep *sol = - dynamic_cast<SourceRep *>(getElement()->removeWrappers()); + dynamic_cast<SourceRep *>(getElement()); double length = 0.05; sol->setElementLength(length); diff --git a/src/Elements/OpalSource.h b/src/Elements/OpalSource.h index 95b20fed0..1801b3aaa 100644 --- a/src/Elements/OpalSource.h +++ b/src/Elements/OpalSource.h @@ -40,7 +40,7 @@ public: virtual OpalSource *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC solenoid. virtual void update(); diff --git a/src/Elements/OpalSplineTimeDependence.cpp b/src/Elements/OpalSplineTimeDependence.cpp index 80a0b30ad..909dd381c 100644 --- a/src/Elements/OpalSplineTimeDependence.cpp +++ b/src/Elements/OpalSplineTimeDependence.cpp @@ -79,8 +79,8 @@ OpalSplineTimeDependence::OpalSplineTimeDependence(const std::string &name, OpalSplineTimeDependence::~OpalSplineTimeDependence() {} void OpalSplineTimeDependence::fillRegisteredAttributes - (const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); + (const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalSplineTimeDependence::update() { diff --git a/src/Elements/OpalSplineTimeDependence.h b/src/Elements/OpalSplineTimeDependence.h index 9b24ff1e8..64fd3fcc8 100644 --- a/src/Elements/OpalSplineTimeDependence.h +++ b/src/Elements/OpalSplineTimeDependence.h @@ -55,7 +55,7 @@ class OpalSplineTimeDependence : public OpalElement { virtual OpalSplineTimeDependence *clone(const std::string &name); /** Calls fillRegisteredAttributes on the OpalElement */ - void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag); + void fillRegisteredAttributes(const ElementBase &base); /** Receive parameters from the parser and hand them off to the * SplineTimeDependence diff --git a/src/Elements/OpalStripper.cpp b/src/Elements/OpalStripper.cpp index 5357cf64b..92974494e 100644 --- a/src/Elements/OpalStripper.cpp +++ b/src/Elements/OpalStripper.cpp @@ -86,8 +86,8 @@ OpalStripper *OpalStripper::clone(const std::string &name) { } -void OpalStripper::fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +void OpalStripper::fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } @@ -95,7 +95,7 @@ void OpalStripper::fillRegisteredAttributes(const ElementBase &base, ValueFlag f void OpalStripper::update() { OpalElement::update(); - StripperRep *strp = dynamic_cast<StripperRep *>(getElement()->removeWrappers()); + StripperRep *strp = dynamic_cast<StripperRep *>(getElement()); const double mm2m = 0.001; double xstart = mm2m * Attributes::getReal(itsAttr[XSTART]); diff --git a/src/Elements/OpalStripper.h b/src/Elements/OpalStripper.h index f605573d5..b54254204 100644 --- a/src/Elements/OpalStripper.h +++ b/src/Elements/OpalStripper.h @@ -55,7 +55,7 @@ public: virtual OpalStripper *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC septum. virtual void update(); diff --git a/src/Elements/OpalTravelingWave.cpp b/src/Elements/OpalTravelingWave.cpp index a86b88b44..3970f8f7e 100644 --- a/src/Elements/OpalTravelingWave.cpp +++ b/src/Elements/OpalTravelingWave.cpp @@ -97,19 +97,17 @@ OpalTravelingWave *OpalTravelingWave::clone(const std::string &name) { void OpalTravelingWave:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); - - if(flag != ERROR_FLAG) { - const TravelingWaveRep *rfc = - dynamic_cast<const TravelingWaveRep *>(base.removeWrappers()); - attributeRegistry["VOLT"]->setReal(rfc->getAmplitude()); - attributeRegistry["DVOLT"]->setReal(rfc->getAmplitudeError()); - attributeRegistry["FREQ"]->setReal(rfc->getFrequency()); - attributeRegistry["LAG"]->setReal(rfc->getPhase()); - attributeRegistry["DLAG"]->setReal(rfc->getPhaseError()); - attributeRegistry["FMAPFN"]->setString(rfc->getFieldMapFN()); - } +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); + + const TravelingWaveRep *rfc = + dynamic_cast<const TravelingWaveRep *>(&base); + attributeRegistry["VOLT"]->setReal(rfc->getAmplitude()); + attributeRegistry["DVOLT"]->setReal(rfc->getAmplitudeError()); + attributeRegistry["FREQ"]->setReal(rfc->getFrequency()); + attributeRegistry["LAG"]->setReal(rfc->getPhase()); + attributeRegistry["DLAG"]->setReal(rfc->getPhaseError()); + attributeRegistry["FMAPFN"]->setString(rfc->getFieldMapFN()); } @@ -117,7 +115,7 @@ void OpalTravelingWave::update() { OpalElement::update(); TravelingWaveRep *rfc = - dynamic_cast<TravelingWaveRep *>(getElement()->removeWrappers()); + dynamic_cast<TravelingWaveRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double vPeak = Attributes::getReal(itsAttr[VOLT]); diff --git a/src/Elements/OpalTravelingWave.h b/src/Elements/OpalTravelingWave.h index d1e259279..2efa3da3e 100644 --- a/src/Elements/OpalTravelingWave.h +++ b/src/Elements/OpalTravelingWave.h @@ -57,7 +57,7 @@ public: virtual OpalTravelingWave *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC cavity. virtual void update(); diff --git a/src/Elements/OpalVKicker.cpp b/src/Elements/OpalVKicker.cpp index 3ee59e063..45ef1250f 100644 --- a/src/Elements/OpalVKicker.cpp +++ b/src/Elements/OpalVKicker.cpp @@ -21,7 +21,6 @@ #include "AbstractObjects/OpalData.h" #include "Attributes/Attributes.h" #include "BeamlineCore/YCorrectorRep.h" -#include "ComponentWrappers/CorrectorWrapper.h" #include "Physics/Physics.h" @@ -42,13 +41,13 @@ OpalVKicker::OpalVKicker(): registerOwnership(); - setElement((new YCorrectorRep("VKICKER"))->makeWrappers()); + setElement(new YCorrectorRep("VKICKER")); } OpalVKicker::OpalVKicker(const std::string &name, OpalVKicker *parent): OpalElement(name, parent) { - setElement((new YCorrectorRep(name))->makeWrappers()); + setElement(new YCorrectorRep(name)); } @@ -62,21 +61,12 @@ OpalVKicker *OpalVKicker::clone(const std::string &name) { void OpalVKicker:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { +fillRegisteredAttributes(const ElementBase &base) { Inform m("fillRegisteredAttributes "); - OpalElement::fillRegisteredAttributes(base, flag); - - const CorrectorWrapper *corr = - dynamic_cast<const CorrectorWrapper *>(&base); - BDipoleField field; - - if(flag == ERROR_FLAG) { - field = corr->errorField(); - } else if(flag == ACTUAL_FLAG) { - field = corr->getField(); - } else if(flag == IDEAL_FLAG) { - field = corr->getDesign().getField(); - } + OpalElement::fillRegisteredAttributes(base); + + const YCorrectorRep *corr = dynamic_cast<const YCorrectorRep *>(&base); + BDipoleField field = corr->getField(); double scale = Physics::c / OpalData::getInstance()->getP0(); attributeRegistry["HKICK"]->setReal(- field.getBy() * scale); @@ -92,7 +82,7 @@ fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { void OpalVKicker::update() { OpalElement::update(); - YCorrectorRep *corr = dynamic_cast<YCorrectorRep *>(getElement()->removeWrappers()); + YCorrectorRep *corr = dynamic_cast<YCorrectorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); double factor = OpalData::getInstance()->getP0() / Physics::c; diff --git a/src/Elements/OpalVKicker.h b/src/Elements/OpalVKicker.h index cf7a7a416..5df108519 100644 --- a/src/Elements/OpalVKicker.h +++ b/src/Elements/OpalVKicker.h @@ -51,7 +51,7 @@ public: //END JMJ 15/12/2000, adding missing print method /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC corrector. virtual void update(); diff --git a/src/Elements/OpalVMonitor.cpp b/src/Elements/OpalVMonitor.cpp index 2b4f8f916..9d33b3730 100644 --- a/src/Elements/OpalVMonitor.cpp +++ b/src/Elements/OpalVMonitor.cpp @@ -47,7 +47,7 @@ void OpalVMonitor::update() { OpalElement::update(); YMonitorRep *mon = - dynamic_cast<YMonitorRep *>(getElement()->removeWrappers()); + dynamic_cast<YMonitorRep *>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); mon->setElementLength(length); diff --git a/src/Elements/OpalVariableRFCavity.cpp b/src/Elements/OpalVariableRFCavity.cpp index 44591b141..203428047 100644 --- a/src/Elements/OpalVariableRFCavity.cpp +++ b/src/Elements/OpalVariableRFCavity.cpp @@ -66,7 +66,7 @@ OpalVariableRFCavity::OpalVariableRFCavity(const std::string &name, OpalVariableRFCavity *parent) : OpalElement(name, parent) { VariableRFCavity *cavity = dynamic_cast<VariableRFCavity*>( - parent->getElement()->removeWrappers()); + parent->getElement()); setElement(new VariableRFCavity(*cavity)); } @@ -82,8 +82,8 @@ OpalVariableRFCavity *OpalVariableRFCavity::clone() { } void OpalVariableRFCavity:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const VariableRFCavity* cavity = dynamic_cast<const VariableRFCavity*>(&base); if (cavity == NULL) { throw OpalException("OpalVariableRFCavity::fillRegisteredAttributes", @@ -108,7 +108,7 @@ void OpalVariableRFCavity::update() { OpalElement::update(); VariableRFCavity *cavity = dynamic_cast<VariableRFCavity*>( - getElement()->removeWrappers()); + getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); cavity->setLength(length); std::string phaseName = Attributes::getString(itsAttr[PHASE_MODEL]); diff --git a/src/Elements/OpalVariableRFCavity.h b/src/Elements/OpalVariableRFCavity.h index 17a375d30..a403926ee 100644 --- a/src/Elements/OpalVariableRFCavity.h +++ b/src/Elements/OpalVariableRFCavity.h @@ -69,7 +69,7 @@ class OpalVariableRFCavity: public OpalElement { * * This updates the registered attributed with values from the ElementBase */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the OpalVariableRFCavity with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalVariableRFCavityFringeField.cpp b/src/Elements/OpalVariableRFCavityFringeField.cpp index a63786d35..1aeec0958 100644 --- a/src/Elements/OpalVariableRFCavityFringeField.cpp +++ b/src/Elements/OpalVariableRFCavityFringeField.cpp @@ -80,7 +80,7 @@ OpalVariableRFCavityFringeField::OpalVariableRFCavityFringeField( OpalVariableRFCavityFringeField *parent ) : OpalElement(name, parent) { VariableRFCavityFringeField *cavity = dynamic_cast - <VariableRFCavityFringeField*>(parent->getElement()->removeWrappers()); + <VariableRFCavityFringeField*>(parent->getElement()); setElement(new VariableRFCavityFringeField(*cavity)); } @@ -97,8 +97,8 @@ OpalVariableRFCavityFringeField *OpalVariableRFCavityFringeField::clone() { } void OpalVariableRFCavityFringeField:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); const VariableRFCavityFringeField* cavity = dynamic_cast<const VariableRFCavityFringeField*>(&base); if (cavity == NULL) { @@ -138,7 +138,7 @@ void OpalVariableRFCavityFringeField::update() { OpalElement::update(); VariableRFCavityFringeField *cavity = dynamic_cast - <VariableRFCavityFringeField*>(getElement()->removeWrappers()); + <VariableRFCavityFringeField*>(getElement()); double length = Attributes::getReal(itsAttr[LENGTH]); cavity->setLength(length); std::string phaseName = Attributes::getString(itsAttr[PHASE_MODEL]); diff --git a/src/Elements/OpalVariableRFCavityFringeField.h b/src/Elements/OpalVariableRFCavityFringeField.h index 192e8c6bc..a01548499 100644 --- a/src/Elements/OpalVariableRFCavityFringeField.h +++ b/src/Elements/OpalVariableRFCavityFringeField.h @@ -74,7 +74,7 @@ class OpalVariableRFCavityFringeField : public OpalElement { * * This updates the registered attributed with values from the ElementBase */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the OpalVariableRFCavity with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalVerticalFFAMagnet.cpp b/src/Elements/OpalVerticalFFAMagnet.cpp index 936ecde74..10167c151 100644 --- a/src/Elements/OpalVerticalFFAMagnet.cpp +++ b/src/Elements/OpalVerticalFFAMagnet.cpp @@ -81,14 +81,14 @@ OpalVerticalFFAMagnet *OpalVerticalFFAMagnet::clone(const std::string &name) { void OpalVerticalFFAMagnet:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); } void OpalVerticalFFAMagnet::update() { VerticalFFAMagnet *magnet = - dynamic_cast<VerticalFFAMagnet*>(getElement()->removeWrappers()); + dynamic_cast<VerticalFFAMagnet*>(getElement()); magnet->setB0(Attributes::getReal(itsAttr[B0])); int maxOrder = floor(Attributes::getReal(itsAttr[MAX_HORIZONTAL_POWER])); magnet->setMaxOrder(maxOrder); diff --git a/src/Elements/OpalVerticalFFAMagnet.h b/src/Elements/OpalVerticalFFAMagnet.h index f269f9eaf..b7494ae91 100644 --- a/src/Elements/OpalVerticalFFAMagnet.h +++ b/src/Elements/OpalVerticalFFAMagnet.h @@ -49,7 +49,7 @@ class OpalVerticalFFAMagnet : public OpalElement { * * Just calls fillRegisteredAttributes on the base class */ - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /** Update the VerticalFFA with new parameters from UI parser */ virtual void update(); diff --git a/src/Elements/OpalYRot.cpp b/src/Elements/OpalYRot.cpp index 3767a4912..3438e320b 100644 --- a/src/Elements/OpalYRot.cpp +++ b/src/Elements/OpalYRot.cpp @@ -55,8 +55,8 @@ OpalYRot *OpalYRot::clone(const std::string &name) { void OpalYRot:: -fillRegisteredAttributes(const ElementBase &base, ValueFlag flag) { - OpalElement::fillRegisteredAttributes(base, flag); +fillRegisteredAttributes(const ElementBase &base) { + OpalElement::fillRegisteredAttributes(base); double angle = Attributes::getReal(itsAttr[ANGLE]); attributeRegistry["SANGLE"]->setReal(angle); } diff --git a/src/Elements/OpalYRot.h b/src/Elements/OpalYRot.h index 739e3ab14..311d5a62a 100644 --- a/src/Elements/OpalYRot.h +++ b/src/Elements/OpalYRot.h @@ -44,7 +44,7 @@ public: virtual OpalYRot *clone(const std::string &name); /// Fill in all registered attributes. - virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag); + virtual void fillRegisteredAttributes(const ElementBase &); /// Update the embedded CLASSIC patch. virtual void update(); diff --git a/src/Lines/Line.cpp b/src/Lines/Line.cpp index 758c1f05f..a6d31df52 100644 --- a/src/Lines/Line.cpp +++ b/src/Lines/Line.cpp @@ -287,7 +287,7 @@ void Line::print(std::ostream &os) const { FlaggedBeamline *Line::fetchLine() const { - return dynamic_cast<FlaggedBeamline *>(getElement()->removeWrappers()); + return dynamic_cast<FlaggedBeamline *>(getElement()); } diff --git a/src/Lines/Sequence.cpp b/src/Lines/Sequence.cpp index a88cacd24..817f1cd52 100644 --- a/src/Lines/Sequence.cpp +++ b/src/Lines/Sequence.cpp @@ -276,7 +276,7 @@ void Sequence::update() { Sequence::TLine *Sequence::fetchLine() const { - return dynamic_cast<TLine *>(getElement()->removeWrappers()); + return dynamic_cast<TLine *>(getElement()); } @@ -387,7 +387,7 @@ void Sequence::updateList(Sequence *seq, TLine *line) { while(true) { // Recursive call for nested beam non-shared sequence. if(iter == last) break; - ElementBase *base = iter->getElement()->removeWrappers(); + ElementBase *base = iter->getElement(); if(! base->isSharable()) { TLine *sub_line = dynamic_cast<TLine *>(base); if(sub_line != 0) { diff --git a/src/Tables/AttList.cpp b/src/Tables/AttList.cpp index 972011bad..67ca1e738 100644 --- a/src/Tables/AttList.cpp +++ b/src/Tables/AttList.cpp @@ -1,20 +1,20 @@ -// ------------------------------------------------------------------------ -// $RCSfile: AttList.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.2 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: AttList +// Class AttList +// The ATTLIST command. // -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2001/08/13 15:25:21 $ -// $Author: jowett $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "Tables/AttList.h" #include "AbstractObjects/BeamSequence.h" #include "AbstractObjects/Table.h" @@ -32,9 +32,6 @@ using std::vector; -// Class AttList -// ------------------------------------------------------------------------ - namespace { // The attributes of class AttList. @@ -42,7 +39,6 @@ namespace { LINE, // The name of the line to be listed. FNAME, // The name of the file to be written. ALL, // If true, list all columns. - VALUE, // Which value is desired: "ACTUAL", "IDEAL", "ERROR". COLUMN, // The columns to be written. SIZE }; @@ -59,8 +55,6 @@ AttList::AttList(): ("FILE", "Name of file to receive output", "ATTLIST"); itsAttr[ALL] = Attributes::makeBool ("ALL", "Are all columns desired?"); - itsAttr[VALUE] = Attributes::makeString - ("VALUE", "Which value is desired: ACTUAL, IDEAL, or ERROR.", "ACTUAL"); itsAttr[COLUMN] = Attributes::makeStringArray ("COLUMN", "The columns to be written"); @@ -121,20 +115,6 @@ void AttList::execute() { void AttList::writeTable(const Beamline &line, std::ostream &os) { - // Type of values desired. - const std::string &value = Attributes::getString(itsAttr[VALUE]); - OpalElement::ValueFlag flag = OpalElement::ACTUAL_FLAG; - if(value == "ACTUAL") { - flag = OpalElement::ACTUAL_FLAG; - } else if(value == "IDEAL") { - flag = OpalElement::IDEAL_FLAG; - } else if(value == "ERROR") { - flag = OpalElement::ERROR_FLAG; - } else { - throw OpalException("AttList::writeTable()", - "Unknown \"VALUE\" type \"" + value + "\"."); - } - // Construct column access table. // This may throw, if a column is unknown. vector<std::string> header = Attributes::getStringArray(itsAttr[COLUMN]); @@ -151,8 +131,7 @@ void AttList::writeTable(const Beamline &line, std::ostream &os) { << "@ DATE %s " << timer.date() << "\n" << "@ TIME %s " << timer.time() << "\n" << "@ ORIGIN %s OPAL_9.5/4\n" - << "@ COMMENT %s \"" - << "@ VALUE %s " << value << "\n"; + << "@ COMMENT %s \"\n"; OpalData::getInstance()->printTitle(os); os << "\"\n"; @@ -173,6 +152,6 @@ void AttList::writeTable(const Beamline &line, std::ostream &os) { os << '\n'; // List the table body. - AttWriter writer(line, os, flag, buffer); + AttWriter writer(line, os, buffer); writer.execute(); } \ No newline at end of file diff --git a/src/Tables/AttList.h b/src/Tables/AttList.h index 4130f240a..8821fc179 100644 --- a/src/Tables/AttList.h +++ b/src/Tables/AttList.h @@ -1,22 +1,22 @@ -#ifndef OPAL_AttList_HH -#define OPAL_AttList_HH - -// ------------------------------------------------------------------------ -// $RCSfile: AttList.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: AttList +// Class AttList +// The ATTLIST command. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// ------------------------------------------------------------------------ +// This file is part of OPAL. // -// $Date: 2000/03/27 09:33:46 $ -// $Author: Andreas Adelmann $ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// ------------------------------------------------------------------------ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. +// +#ifndef OPAL_AttList_HH +#define OPAL_AttList_HH #include "AbstractObjects/Action.h" #include <iosfwd> @@ -24,10 +24,6 @@ class Beamline; -// Class AttList -// ------------------------------------------------------------------------ -/// The ATTLIST command. - class AttList: public Action { public: diff --git a/src/Tables/AttWriter.cpp b/src/Tables/AttWriter.cpp index 2e3a2ccc5..f5f0e20ab 100644 --- a/src/Tables/AttWriter.cpp +++ b/src/Tables/AttWriter.cpp @@ -51,12 +51,10 @@ AttWriter::AttWriter(const Beamline &line, std::ostream &os, - OpalElement::ValueFlag flag, const std::vector<AttCell *> &buffer): DefaultVisitor(line, false, false), itsStream(os), - itsBuffer(buffer), - itsValueFlag(flag) + itsBuffer(buffer) {} @@ -65,7 +63,7 @@ AttWriter::~AttWriter() void AttWriter::visitFlaggedElmPtr(const FlaggedElmPtr &fep) { - ElementBase *base = fep.getElement()->removeWrappers(); + ElementBase *base = fep.getElement(); const std::string &nam = base->getName(); if(dynamic_cast<Beamline *>(base)) { DefaultVisitor::visitFlaggedElmPtr(fep); @@ -76,7 +74,7 @@ void AttWriter::visitFlaggedElmPtr(const FlaggedElmPtr &fep) { OpalElement::setRegisteredAttribute("KEYWORD", "DRIFT"); } else { OpalElement *elem = dynamic_cast<OpalElement *>(OpalData::getInstance()->find(nam)); - elem->fillRegisteredAttributes(*fep.getElement(), itsValueFlag); + elem->fillRegisteredAttributes(*fep.getElement()); } // Write the current output line and clear it. diff --git a/src/Tables/AttWriter.h b/src/Tables/AttWriter.h index 5b5a5a77e..8110b3fa8 100644 --- a/src/Tables/AttWriter.h +++ b/src/Tables/AttWriter.h @@ -57,7 +57,6 @@ public: /// Constructor. AttWriter(const Beamline &, std::ostream &, - OpalElement::ValueFlag valueFlag, const std::vector<AttCell *> &); virtual ~AttWriter(); @@ -78,9 +77,6 @@ private: // The current output line representation. const std::vector<AttCell *> &itsBuffer; - - // The flag for the type of value desired. - OpalElement::ValueFlag itsValueFlag; }; #endif // OPAL_AttWriter_HH diff --git a/src/Tables/RangeSelector.cpp b/src/Tables/RangeSelector.cpp index 3e500d992..f4b43d639 100644 --- a/src/Tables/RangeSelector.cpp +++ b/src/Tables/RangeSelector.cpp @@ -1,23 +1,22 @@ -// ------------------------------------------------------------------------ -// $RCSfile: RangeSelector.cpp,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.3 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: RangeSelector +// Class RangeSelector // This abstract class runs through a beam line and calls the pure // virtual methods RangeSelector::handleXXX() for each element or // beamline in a range. // -// ------------------------------------------------------------------------ +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// $Date: 2001/08/24 19:35:16 $ -// $Author: jsberg $ +// This file is part of OPAL. +// +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. // -// ------------------------------------------------------------------------ - #include "Tables/RangeSelector.h" #include "AbsBeamline/ElementBase.h" #include "AbstractObjects/Element.h" @@ -29,9 +28,6 @@ class Element; -// Class RangeSelector -// ------------------------------------------------------------------------ - RangeSelector::RangeSelector(const Beamline &beamline, const RangeRep &range): DefaultVisitor(beamline, false, false), itsRange(range) {} @@ -52,7 +48,7 @@ void RangeSelector::visitFlaggedElmPtr(const FlaggedElmPtr &fep) { itsRange.enter(fep); // Do the required operations on the beamline or element. - ElementBase *base = fep.getElement()->removeWrappers(); + ElementBase *base = fep.getElement(); if(dynamic_cast<Beamline *>(base)) { handleBeamline(fep); diff --git a/src/Tables/RangeSelector.h b/src/Tables/RangeSelector.h index 4f995142a..82b05f93a 100644 --- a/src/Tables/RangeSelector.h +++ b/src/Tables/RangeSelector.h @@ -1,22 +1,24 @@ -#ifndef OPAL_RangeSelector_HH -#define OPAL_RangeSelector_HH - -// ------------------------------------------------------------------------ -// $RCSfile: RangeSelector.h,v $ -// ------------------------------------------------------------------------ -// $Revision: 1.1.1.1 $ -// ------------------------------------------------------------------------ -// Copyright: see Copyright.readme -// ------------------------------------------------------------------------ // -// Class: RangeSelector +// Class RangeSelector +// This abstract class runs through a beam line and calls the pure +// virtual methods RangeSelector::handleXXX() for each element or +// beamline in a range. +// +// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland +// All rights reserved // -// ------------------------------------------------------------------------ +// This file is part of OPAL. // -// $Date: 2000/03/27 09:33:45 $ -// $Author: Andreas Adelmann $ +// OPAL is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// ------------------------------------------------------------------------ +// You should have received a copy of the GNU General Public License +// along with OPAL. If not, see <https://www.gnu.org/licenses/>. +// +#ifndef OPAL_RangeSelector_HH +#define OPAL_RangeSelector_HH #include "Algorithms/DefaultVisitor.h" #include "AbstractObjects/RangeRep.h" @@ -24,11 +26,6 @@ class Beamline; -// Class RangeSelector -// ------------------------------------------------------------------------ -/// An abstract visitor which calls the pure virtual method -// [tt]RangeSelector::handleXXX()[/tt] for each element or beamline in range. - class RangeSelector: public DefaultVisitor { public: diff --git a/tests/opal_src/Elements/OpalPolynomialTimeDependenceTest.cpp b/tests/opal_src/Elements/OpalPolynomialTimeDependenceTest.cpp index 106e151df..7e0654e28 100644 --- a/tests/opal_src/Elements/OpalPolynomialTimeDependenceTest.cpp +++ b/tests/opal_src/Elements/OpalPolynomialTimeDependenceTest.cpp @@ -57,7 +57,7 @@ TEST(OpalPolynomialTimeDependenceTest, UpdateTest) { OpalPolynomialTimeDependence dependence; // std::cerr << "FILL" << std::endl; // makes a segmentation fault... - // dependence.fillRegisteredAttributes(element, OpalElement::IDEAL_FLAG); + // dependence.fillRegisteredAttributes(element); // std::cerr << "DONE" << std::endl; } \ No newline at end of file diff --git a/tests/opal_src/Elements/OpalVariableRFCavityTest.cpp b/tests/opal_src/Elements/OpalVariableRFCavityTest.cpp index 5b4aec1b2..0859559c2 100644 --- a/tests/opal_src/Elements/OpalVariableRFCavityTest.cpp +++ b/tests/opal_src/Elements/OpalVariableRFCavityTest.cpp @@ -72,7 +72,7 @@ TEST(OpalVariableRFCavityTest, TestFillRegisteredAttributes) { OpalVariableRFCavity opal_cav; OpalVariableRFCavity parent; // dummy parent to prevent segv opal_cav.setParent(&parent); - opal_cav.fillRegisteredAttributes(cav, OpalElement::IDEAL_FLAG); + opal_cav.fillRegisteredAttributes(cav); Attribute* null_att = NULL; EXPECT_EQ(opal_cav.findAttribute("NONSENSE ATTRIBUTE ASDASDA"), null_att); @@ -91,8 +91,7 @@ TEST(OpalVariableRFCavityTest, TestFillRegisteredAttributes) { // try to fill a VariableRFCavity using an ElementBase that is not a // VariableRFCavity - should throw DriftRep drift("test"); - EXPECT_THROW(opal_cav.fillRegisteredAttributes(drift, - OpalElement::IDEAL_FLAG), + EXPECT_THROW(opal_cav.fillRegisteredAttributes(drift), OpalException); */ } -- GitLab