diff --git a/src/Classic/AbsBeamline/BeamlineVisitor.h b/src/Classic/AbsBeamline/BeamlineVisitor.h index a5b46bfb8c42fe19404e1b7fffc3b30ad4874b9d..485edbba48f1f93d01112a6a29d75f1f073a3f67 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 172d0583821d5a5e3a63dd9bfbdf02f95a60c5e1..8f9f5fa133e81fddd4e36efe21416d416785bc56 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 6bb134666c5c6c6d3ee9350a41a0a644098f6ec8..fe4fde06cbca89180158da48edcb40f116a25ef7 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 751f4524fd6a8a91fe3c002ec8c6fc4659a573dc..b7fc610bd57a14515330d381115414686f09cb8e 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 2e3dae54e370f0db8fd9ee6790cd72ce7387dc35..9ff6f1645c092fb1ee4c67d8645e840b649f3709 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 17a3510e7c0ca5ad50ba4530eab319c2710ef17f..dac6d0994b8ceb9cc90308a57f2cb06a5c4b0376 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 f6c0c52ad4334f5b36e3dbea260ed387d95d8cd2..153c00362e86d059a4cb9800fd95bb41d483aa09 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 bf3878677aacb453da89c061e01f7b0fa06f16f5..26978d154ccaf2e7bbf659ffa0519237ee3a10fd 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 24528a24cb9ef435b9ae73f2ab0dfb3d73c652d4..9955dd7e29cb36cda416265602442943e7f541be 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 4dc503eb4f5301f097e6e0f705aa79c8542de179..1d5505fa6043c3d0326937e062c9965e1ebcb437 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 6a419f6184cc1832f92ddcf6cc98c90eb6e571b1..bfc5e4303df509b7b17c7a65a4e8bc3e80ec9a58 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 8ee0f82fe6c7ac239604cc6884bd7e5115a1105e..f829af6b02e933566e3c6bb2c68fc0747aa751ff 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 10f2eac7a077915872a28ce88866cbb5987b3b35..6c6690219c44bad0c24ba44a4b7f224d1aa09aa5 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 76ea92f9f1fdb8a560ca60c75f589c7b3d074d6b..8096f02c7a7b732ee5997d466fe2561bf8f82f87 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 e90e9c77e107e7cc4ab877f03a60134ee1542a4e..48d128ce6791329cffb16c666caaca3b6b54e62a 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 5b859f5b8047d7afd0eace418e71f4c5a01cfad0..f18e1954719f2dd4da22c7cbf54bf967f7514515 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 eba1362e34714e2d9c58f7400bd16d3acad5e704..575f758fef70b645833d401bcf24b003523a1594 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 bc7a2a62e0b8421072a4ebf22da1d1a2eb9a0404..5117d8d3d102808b5fac79ad63e7fc9468588ad9 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 ca30bd751869e7ed843502a8b3b682a606e3ee01..954849b84549d5dd7385a7c9a3f603d68e145e01 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 601805fc567f68c7f625ffb63190d13e9669f572..0000000000000000000000000000000000000000 --- 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 f9489bfd8625f0aee08a9290b1179da87496f396..0000000000000000000000000000000000000000 --- 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 7929de27f536bd55d2a2f8cf96be0468e9c231b1..0000000000000000000000000000000000000000 --- 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 c145fcb5ce958f91cd9f0849b3d5b00f63a1a117..0000000000000000000000000000000000000000 --- 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 769cfe01c379de1b8dd988f90de182c6cbc65b9c..0000000000000000000000000000000000000000 --- 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 8cdcc488c92062d93608aa3c66104869906cbc9a..0000000000000000000000000000000000000000 --- 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 ad23866aedc13e7aa4621cbd8b6f296b0cb05e06..0000000000000000000000000000000000000000 --- 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 fbf2afe32e1eba579dbffcf3035f37858cc05f91..0000000000000000000000000000000000000000 --- 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 d5d12e9ec192b92a0d2b3b02ca1fb2d0c72a7ca2..0000000000000000000000000000000000000000 --- 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 b655034f1fd6fbc37535ff98d77e4fa4286119d8..0000000000000000000000000000000000000000 --- 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 1744e1b7ac3dd5974547bc9038cd6320fa0a3557..0000000000000000000000000000000000000000 --- 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 c71f16a07c338f48c77ea2ee6fe4c8fad243f560..f94dce5bea0f9c49ae2d60e7367a6a884f175da3 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 ee1fbf9e9034a2574e6a4c11618a17be9d2d5501..59db360f647630422c4b0063801ae7462897b7c6 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 acc490692e52cc9a14477d68fee8978c09715a5a..7776d216649c75dde81a56c76692c45d1ffaa190 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 11a2e6b0ce0b65e10c484e24ca48e7df8ff4b822..f452faf7267f078248b85d30f98d149aa5f9ec6a 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 7fbff03b3887397e509e0cd4f4b0eea12c5fecfb..635cfe6a99bc96f7afe887602162088d70188369 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 1758c092fe17d9a588c54239af15a79be68c3851..b97263f3160d9f9b7edd4d1dfaee1cb85f5a4b33 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 045adf54e8cb252d01b37cd750e7efc0feb56f26..d7548d3224e5d52525ff37c4b0d4fa5d73a3e59e 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 88613e780464b35eeb3076d1967a1fbff844e948..6eefff28df456c021ae553c57a3439e87d4e6bd0 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 d17d9c8d7d796826a67bb993124b6e21778942d1..b6aee782130753cdc94cfb8b1c3c5747cee3b077 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 561ea5d315213d2e8037f235f31dc8cd0f1fcbc8..28d908919a7ebb631562c7a23f25654c54d9351f 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 6c7b7a753564641f9cc0ea16cea746795a7d62b7..8da696c82392c422a6874d4bd6769b5e5e58c395 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 3f9b82e882c3fcaf41ef9aeb6a7abc68775da6f8..fac710f9896bcee08f9f53037bd46b598a10f6c0 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 3112a314730115f5964d44baf42968517d8a37fe..53329d657019a94ec2a93667b4348598daee6344 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 c00b28dbb3d67406fdd099e3fafe30f7ce268363..10ade1dd04b26cc7cef030498063fdccc894d207 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 d72467f7626df041fef3d8085b5575e915ab0841..63bf8b771bf9200523104f97bbb7684f2ca46d29 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 04d70f376e1711398ad09f5c2b3ba5199877e0ab..10b4e9ec9cf8711e2e1d9647c76266ecf94fe745 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 ec96f93b6d4edc672f46cdb828ab96286a4ac263..20a3b70cad23b13c1f7f493ce60b27d6d71c2df0 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 dff47c07339f93363b817682f47700f301f54188..f11ceff8c6d460644f2f81d06a48a6ff858883d7 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 fb18edc9559bcc10bc4254e6515ebbb79be35d30..d4e561d256a5a4cdf14704668eaf2c130fa155e0 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 8136d2fe1ddb18261d3f5d4b711894c62c340ace..c7ca2f633c47789bf001eeb9d416e7b2a035187f 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 0949d5bf3308ca700d7bd253b90b51a22074273f..bce6380f14b4afeee2a5fb869ecd1c7360b36ec1 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 2f72e643068bd50fe7757d7e10b0b3a99219d745..33cfd409c83fa88f6cfb1b1dc192ebc2a4ed92fb 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 cee91dd4a587d71e368bfb6dd89580f42f785bc0..e0eaa8eae316d84ec09e2ff66fd090cc67e3329d 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 0e4bb0658cd183560000c490a95be6a7c607a12c..d3c03265cbbfa292de372c20f8e65edda1b44300 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 fbac7100691362b7b8f6e887b2b7e786d9d3a234..64f197f9ad4fcaf81ca144ee2527e27204119094 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 1517ed2853fa6d3ad107dee9fd5a48cedafb9ecb..765080edc9483e5b0f66df2776816c1140fed38c 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 f22337522e9d6825420f8157e720e52396da7542..7e5925f7064ed038f1823ba4335a339ea797761e 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 63313b1dab5115adb8ec9a14d461877f3c6cf41f..d024da231a3db60a0d117e8bcb2766bf407c7c62 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 e141018ac1aa196ad16d8ab42f4b7fc444044b44..c228143443ae5d4d6144729e5f10393593aaefb8 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 1ed272dd731d3f2600169d8a5e6e76e301338349..3ddfc592fb25431821a7671bfd6ec33d8cee634a 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 6b6842a967448ac89477786e903c89ddf1dd4310..1fbe0989b3b6eae2faeaf396b1f9951307a60427 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 b8949b33aa2efbc293569cb277da5488e06414fd..5e26379735c038678af9f8cdb02dd370d6392da7 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 634dd57316bf43abfa337273ac9baa7952da40ee..9312206e34734f1bc27edb616681dd11f5f2a61e 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 dda14c3bbd5f3ad91a5822f8b6ef4679e55845e7..8f379c6cfd6aad736854d34051ebef2448ef6cdb 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 9f2df2f171345cd6452ef0c177387e1a11530c03..d4276a71db7f6a61230f466d5c1669991d98a146 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 d57efd6b02fa9770dc841fdc41f159c82cb3800e..0a7800e7e92c35d27fc5bc7361fc2b2da6cd6bc4 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 9c7acc61492114178d87d4171271d02ab170207f..9e2185829072b548b5c2832271cff4dd36cec24c 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 e01f9f6283689cd2ecac332a134f39eb19004210..2191e01db60f2a8470df6cf00a69e7be963674c9 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 0638ccf9a9143e4275a5d6ea21083f3b04ecca71..bc6aa09c12b9099c74ad3e6e1029a7e1c8f9f030 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 3da3ad95e849d318d1d23c89f1fe8b3171f0b631..a9dd909ee23b522eaf2f80fb5ff690381e3a9e90 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 807a5d619787770732db231084c623d16744ea55..49d4b5b5352979a85e5db52b6c5bbe4f5533a82b 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 14f28969c797d2d18fb93d785c8bea4439427659..07f3dbd7cf06ed941343be93b1c95a66636c398f 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 6fc000cc87ac6a2b9d4f279b712852389f96b360..bed08e52c7741176da9ecfa4c9a0d21d21e60129 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 732f77cb4806981cb3682a314473bda566b569c1..29822f53ed00c79feb0e897fde229428a289e565 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 8cd04c46c911c1f5913a5941150e860ae323482f..9140886db48ca3b15725e1103d0aee66a31f0f34 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 d17d611c8bd0c45bca5a13158aff0ae770e697b2..665685013c96e405206d1bfdea8793336c95dc8d 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 556ec933165424f89d9847aa146c5c20fc9f8222..5543d7a19f5afd11c87678c8d9606e80a12adaa3 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 7647a0e641b195f7ff845d7cadd491b03ee3b2db..820e11cf48e62aead0c83302b5777f92c27c93ca 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 1b0a60e9a5c878a507a47cc3f03253ee72ed01c5..aad8501ef28d2aa7c791f4a2987b90edf6a5792c 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 f6df689618aa44cbe9c257ed0bc39d1dc27dcfc2..175ea72567bc8eb0959129e47f7262e577a9807f 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 c48d040c1b95060eda51b97ac473148636c352f6..ba927c533476dd529a2742bb0e2c4212f8b6bd8c 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 eb4dc29aa6bc997467217de0346489e3d467d62e..3ee47889cd5087a7095af37819336a866fbb7036 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 4decff3e6a2118b35fdb2cf73abb18417c90b3ce..a42b0f49026bd6f397ffd0d4f3e62661465e9f13 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 b632f244308cbe283044a83bcee41b49a83d6028..fa0abaabb3caa13352782a63f35ea4184378c885 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 aa52d7c36acee72005cb70ea8a44a2ffb92504c6..dec75dc88fd2a27239cc8538a2487d68a35b513b 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 526d9643cfe34f9bd8e708b2bdc98fdaf36c5f07..2bc1c527f521e107b2079c1c802410d9034f8fe8 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 0c5954f8f2de1eeff70b07b05323573070ce3cea..f64500bfddc8945e4520fc85fbce6fe40bdd9ad1 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 c1e8a5b8f85deed83e286a0f0ced522a7f872c81..650fddc223bb9059a17d80ba5e53d98d3471b15a 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 61508f502c1278df0e8aea14c75fe24b75bae749..cec559076531f3010368ea4d4d95e4a1cb15f478 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 7d3e46960c2119c64761572316a60ae3e2696192..12dfbf436534609b1cb02cff8e7a9347743439ca 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 95180a951073deae6633afd6c53e243531675fce..b99b160cf02f655c5e390219ea9c51b50bb2e8e5 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 c903a142e3af7e73dcfc00a5c4ef9d4d17f3d658..7fe2755e45cdaef88701c95e3dc358b0fa15551b 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 06af04b37d9b7f66f37d0413ad5df00f46579ab9..785c1bf3d17951b734bc898323be340f58d297e2 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 d1e4fa857e3f232ad849df9435203f01572d88d0..007d8dd18dde8c0d772578fa952359f0bbd79717 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 02aab26ddb611604ef2c05e5e86a1f1185dc1311..f668c8fa48957e418c1c3301f54a00632ac2ee86 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 23c0378ac3f85fb13ab9fa142ed1714764efd437..61c53dd3d2a24f6d8306178ac1d0268df858732a 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 0d549f4f197ea2bb2bd02289a8fa1be5ab199aa3..61d3ef9f247d2a7044a92973e28451ed83200ab1 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 f21d3441bbdbb413bee09a85089517873be6cf22..a150cbdb07283a5a27ca2a66801d08a483a07f17 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 5eabe81503c0220023a4a815990e3e733c4c68b9..f6c4dd36689783fa023482b344a989cc7f72a804 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 ac40b71b30e23a79f683f1e26d4a77b8f76a7583..3a58d768cf10f35958279452e6d5d526baeea045 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 65447322a1624018d75c9f6f14793d7903eb6262..1dd3eac9a8ca3722faaa42e3e4eaabbc7dc2cf69 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 d0bd14eb250cb00ce95abdaed02812b0cdb6651f..29061161fd7233ba860cba62e778ae25970ea46d 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 eabbb717f4c13f7655a1c27c1e61c17e490de1e6..91c224e46b76364c7c2ae9aaff02387c2383056b 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 191204532ba069801df2cbe54d90b61b38cfc603..ab9a22d386c6279ddd7f3f192a845c0ea9c7a619 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 cb971b9025a8f1bdbc34855e51941ef2e3370cc2..357120ebde33cb37d6414e8f7315597684ada644 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 124ba2fa30c3263245c2c4afc32ae288ab4ef29b..24f4e29913804adc459ad7d87b9d812168a88acd 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 3f1e4aa4a1a367c463dcc30158b286949a47e9c8..6199e286f74233a1d4ea1e9046ee53bd51c02e82 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 463812ac18608d189a954762ca0601242e5bacc6..b3e38e67c07eaa82a696a5ce0fdc794e18cf79a4 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 af2dcfe3c1abcefc86eb870af427e98e9ca2e10f..241bdfd832f23ba2422e7b8d7e85c50495f372f4 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 bb5ab7539f2a9dc9f2a92ad3019b4776131ffcd7..268dee5c1f1bcbb6eb60b797775c09e700785c8b 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 1a94ac510452ad610c737088e9cad2996f3646cf..92b54d6f25a5d06367ac99a16f3329103e2e7227 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 95b20fed07cd41a9f1b45039eee63da3e9391514..1801b3aaa26e49b486639ffd303ab00c6fbb7218 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 80a0b30adc601a5b7c64c7f4ffbc9586e3cc41b0..909dd381cf863850de2a62987aac04bda1959d83 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 9b24ff1e86955804cc7114b3f55ae6933ad03e28..64fd3fcc886e974efdf555c99ebae6e2cd7aaa9c 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 5357cf64bba99bcb1991b735b669e7037405e2cc..92974494e935b615cc7bbecfb9308e423b38c9c1 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 f605573d5a0dc13708fff1340dde7294f0bbb052..b542542043666877299a6933db0bb82c46735467 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 a86b88b44fcf348e7fde28a5443f8ad1cd786e2b..3970f8f7ebec9d421efae2e40d82473ff4dbf383 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 d1e259279125a4368dae8da4fec764b3baa56f56..2efa3da3e9a7acebc3ed170276a69eb622e2c0a1 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 3ee59e06311f706305495bd655da3ce1c4ae9c52..45ef1250f6dff746cf065c3ffc9a3521b2325d7f 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 cf7a7a41623309a5789467b20925b29b8698ee93..5df108519d88f1c375be7621147abc570c7ea7af 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 2b4f8f91617b43d8a131a72116bfd5eaff498992..9d33b37302cfb17f283c6fa1297d1705934d9f1d 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 44591b141a3146df4bf090d5290daca1ff25ff1d..20342804708ef95ebb2a04daa69e8bf84eeec04f 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 17a375d305adea4360f7c9926553e139f5e13485..a403926eeaf6733b5538c7ceb5ad4ee562ea2957 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 a63786d357957ebead301aa916aaf5cd31169e4a..1aeec095812b59a74043664b9e1547b2932eb58c 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 192e8c6bc8a149f0492312d0cca327de958d309d..a01548499e2b060de044ab5d2860ccd33a1878b2 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 936ecde7474ab527b2c2e01170e2ab932535f804..10167c1513bce229fff60a919732a2b3465144ca 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 f269f9eaf019779cd534c239fcc88c0a6a76e6af..b7494ae91075362ff0b4b2b5a0cddbd1bb04a5f7 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 3767a49123408a26480858ab8d8beb38fe529170..3438e320b2284160ba06d833e1058459b703ca48 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 739e3ab14d1881bec8af5479f69390517efc8ec9..311d5a62a5945e1afe297568e80cf2e16b2b4f58 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 758c1f05fcccdd39b8042469f3ce1cac5b022f90..a6d31df523128ed99489240ea52382971572429b 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 a88cacd24f94b36193667382a22f2fba22de1a6d..817f1cd524f0a8c0f28a6019be6d15ddcdddb3b9 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 972011badf56e8f42a1e3c8f7be3f76257132e3c..67ca1e738ab55b1fd6fa49101dcafad317acba51 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 4130f240ac54ecce0810d6674ec56bbe75e32657..8821fc1799082f19674818b24dc7c1690e90fa6f 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 2e3a2ccc5cba2081ecec32d2dd7cab6dcd5ca7d4..f5f0e20abcea899e3968a326dd5fa62b0b05ef2e 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 5b5a5a77e80824c3fe9acf84ac57e5dbd28aee36..8110b3fa81b96e01287e5cf1ed8deddd8147ed96 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 3e500d992ee47f9e2ff3122f2a83b4c3fd34f25a..f4b43d6393f166463ffb75ae4e6f56502b9d7b3d 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 4f995142a056e0cbbf057b5713a1b60a6eba9998..82b05f93a454d8395311d33caa1c6fa768c0ceea 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 106e151df4dbc1542ea065134d23de01e830995a..7e0654e28531c1f3abac2b18ad334af8b24ac4ee 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 5b4aec1b2eb5be4b358b2cbb57601cb57bf66496..0859559c25885434beccee5cbd050b86e260c6a5 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); */ }