OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Configure.cpp
Go to the documentation of this file.
1 //
2 // Namespace Configure
3 // The OPAL configurator.
4 // This class must be modified to configure the commands to be contained
5 // in an executable OPAL program. For each command an exemplar object
6 // is constructed and linked to the main directory. This exemplar is then
7 // available to the OPAL parser for cloning.
8 // This class could be part of the class OpalData. It is separated from
9 // that class and opale into a special module in order to reduce
10 // dependencies between modules.
11 //
12 // Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
13 // All rights reserved
14 //
15 // This file is part of OPAL.
16 //
17 // OPAL is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
24 //
27 
29 
30 // Basic action commands.
31 #include "BasicActions/Call.h"
34 #include "BasicActions/Echo.h"
35 #include "BasicActions/Help.h"
36 #include "BasicActions/Option.h"
37 #include "BasicActions/Select.h"
38 #include "BasicActions/Stop.h"
39 #include "BasicActions/Quit.h"
40 #include "BasicActions/System.h"
41 #include "BasicActions/PSystem.h"
42 #include "BasicActions/Title.h"
43 #include "BasicActions/Value.h"
44 
45 // Macro command.
46 #include "OpalParser/MacroCmd.h"
47 
48 // Commands introducing a special mode.
49 #include "Track/TrackCmd.h"
50 
51 // Table-related commands.
52 #include "Structure/Beam.h"
53 #include "Structure/FieldSolver.h"
55 #include "Structure/OpalWake.h"
57 #include "Utilities/OpalFilter.h"
58 #include "TrimCoils/OpalTrimCoil.h"
59 #include "Tables/List.h"
60 
61 // Value definitions commands.
67 
68 // Element commands.
69 #include "Elements/OpalCavity.h"
71 #include "Elements/OpalCyclotron.h"
72 #include "Elements/OpalDegrader.h"
73 #include "Elements/OpalDrift.h"
76 #include "Elements/OpalHKicker.h"
77 #include "Elements/OpalKicker.h"
78 #include "Elements/OpalMarker.h"
79 #include "Elements/OpalMonitor.h"
80 #include "Elements/OpalMultipole.h"
85 #include "Elements/OpalOctupole.h"
90 #include "Elements/OpalPepperPot.h"
92 #include "Elements/OpalProbe.h"
94 #include "Elements/OpalRBend.h"
95 #include "Elements/OpalRBend3D.h"
98 #include "Elements/OpalSBend.h"
99 #include "Elements/OpalSBend3D.h"
101 #include "Elements/OpalSeptum.h"
102 #include "Elements/OpalSextupole.h"
103 #include "Elements/OpalSlit.h"
104 #include "Elements/OpalSolenoid.h"
105 #include "Elements/OpalSource.h"
106 #include "Elements/OpalStripper.h"
108 #include "Elements/OpalVacuum.h"
112 #include "Elements/OpalVKicker.h"
113 
114 #ifdef ENABLE_OPAL_FEL
115 #include "Elements/OpalUndulator.h"
116 #endif
117 
118 // Structure-related commands.
119 #include "Lines/Line.h"
120 #include "Lines/Sequence.h"
121 
122 // Optimize command
123 #include "Optimize/OptimizeCmd.h"
124 #include "Optimize/DVar.h"
125 #include "Optimize/Objective.h"
126 #include "Optimize/Constraint.h"
127 
128 // Sample command
129 #include "Sample/SampleCmd.h"
130 #include "Sample/OpalSample.h"
131 
132 #include "changes.h"
133 
134 // Modify these methods to add new commands.
135 // ------------------------------------------------------------------------
136 
137 namespace {
138 
139  void makeActions() {
141  opal->create(new Call());
142  opal->create(new DumpFields());
143  opal->create(new DumpEMFields());
144  opal->create(new Echo());
145  opal->create(new Help());
146  opal->create(new List());
147  opal->create(new Option());
148  opal->create(new OptimizeCmd());
149  opal->create(new SampleCmd());
150  opal->create(new Select());
151  opal->create(new Stop());
152  opal->create(new Quit());
153  opal->create(new PSystem());
154  opal->create(new System());
155  opal->create(new Title());
156  opal->create(new TrackCmd());
157  opal->create(new Value());
158  }
159 
160  void makeDefinitions() {
162  // Must create the value definitions first.
163  opal->create(new BoolConstant());
164  opal->create(new RealConstant());
165  opal->create(new RealVariable());
166  opal->create(new RealVector());
167  opal->create(new StringConstant());
168 
169  opal->create(new Beam());
170  opal->create(new FieldSolver());
171  opal->create(new BoundaryGeometry());
172  opal->create(new OpalWake());
173  opal->create(new ParticleMatterInteraction());
174 
175  opal->create(new OpalFilter());
176  opal->create(new OpalTrimCoil());
177 
178  opal->create(new Distribution());
179 
180  opal->create(new MacroCmd());
181 
182  opal->create(new DVar());
183  opal->create(new Objective());
184  opal->create(new Constraint());
185 
186  opal->create(new OpalSample());
187  }
188 
189  void makeElements() {
191  opal->create(new OpalCavity());
192  opal->create(new OpalCCollimator());
193  opal->create(new OpalCyclotron());
194  opal->create(new OpalDegrader());
195  opal->create(new OpalDrift());
196  opal->create(new OpalECollimator());
197  opal->create(new OpalFlexibleCollimator());
198  opal->create(new OpalHKicker());
199  opal->create(new OpalKicker());
200  opal->create(new OpalMarker());
201  opal->create(new OpalMonitor());
202  opal->create(new OpalMultipole());
203  opal->create(new OpalMultipoleT());
204  opal->create(new OpalMultipoleTStraight());
207  opal->create(new OpalOctupole());
209 // opal->create(new OpalOffset::OpalLocalCylindricalOffset());
210 // opal->create(new OpalOffset::OpalGlobalCartesianOffset());
211 // opal->create(new OpalOffset::OpalGlobalCylindricalOffset());
212  opal->create(new OpalPepperPot());
214  opal->create(new OpalProbe());
215  opal->create(new OpalQuadrupole());
216  opal->create(new OpalRBend());
217  opal->create(new OpalRBend3D());
218  opal->create(new OpalRCollimator());
219  opal->create(new OpalRingDefinition());
220  opal->create(new OpalSBend());
221  opal->create(new OpalSBend3D());
222  opal->create(new OpalScalingFFAMagnet());
223  opal->create(new OpalSeptum());
224  opal->create(new OpalSextupole());
225  opal->create(new OpalSlit());
226  opal->create(new OpalSolenoid());
227  opal->create(new OpalSource());
228  opal->create(new OpalStripper());
229  opal->create(new OpalTravelingWave());
230 #ifdef ENABLE_OPAL_FEL
231  opal->create(new OpalUndulator());
232 #endif
233  opal->create(new OpalVacuum());
234  opal->create(new OpalVariableRFCavity());
236  opal->create(new OpalVerticalFFAMagnet());
237  opal->create(new OpalVKicker());
238 
239  opal->create(new Line());
240  opal->create(new Sequence());
241  }
242 };
243 
244 namespace Configure {
245  void configure() {
246  makeDefinitions();
247  makeElements();
248  makeActions();
250  }
251 };
void fillChanges()
Definition: changes.cpp:9
void configure()
Configure all commands.
Definition: Configure.cpp:245
The global OPAL structure.
Definition: OpalData.h:49
void create(Object *newObject)
Create new object.
Definition: OpalData.cpp:475
static OpalData * getInstance()
Definition: OpalData.cpp:195
Definition: Call.h:24
Definition: Echo.h:24
Definition: Help.h:24
Definition: Option.h:25
Definition: Quit.h:24
Definition: Select.h:26
Definition: Stop.h:24
Definition: System.h:24
Definition: Title.h:24
Definition: Value.h:24
The MARKER element.
Definition: OpalMarker.h:28
Definition: Line.h:32
Definition: DVar.h:6
The OPTIMIZE command.
Definition: OptimizeCmd.h:16
Definition: Beam.h:32
The FieldSolver definition.
Definition: FieldSolver.h:43
The LIST command.
Definition: List.h:32
The TRACK command.
Definition: TrackCmd.h:28
The FILTER definition.
Definition: OpalFilter.h:32