BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSArrayOperatorValueV.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSARRAYOPERATORVALUEV_H
19#define BDSARRAYOPERATORVALUEV_H
20#include "BDSArrayOperatorValue.hh"
21
22#include "G4Types.hh"
23
24#include <vector>
25
33{
34public:
36 BDSArrayOperatorValue("Vector( ")
37 {;}
39 {
40 for (auto op : operators)
41 {delete op;}
42 }
43
45 void push_back(BDSArrayOperatorValue* operatorIn) {operators.push_back(operatorIn);}
46
48 virtual G4String Name() const
49 {
50 G4String result = name;
51 for (auto op : operators)
52 {result += op->Name() + " ";}
53 result += " )";
54 return result;
55 }
56
60 G4int xInd,
61 G4int yInd = 0,
62 G4int zInd = 0,
63 G4int tInd = 0) const
64 {
65 BDSFieldValue tempV = v;
66 for (auto op : operators)
67 {tempV = op->Apply(tempV, xInd, yInd, zInd, tInd);}
68 return tempV;
69 }
70
71 std::vector<BDSArrayOperatorValue*> operators;
72};
73
74#endif
A vectorised version of BDSArrayOperatorValueV.
virtual BDSFieldValue Apply(BDSFieldValue v, G4int xInd, G4int yInd=0, G4int zInd=0, G4int tInd=0) const
void push_back(BDSArrayOperatorValue *operatorIn)
Append an operator to the vector.
virtual G4String Name() const
Return a name of the operator for feedback to the user in print out.
Interface for modifying field values.