BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSArrayInfo.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSARRAYINFO_H
20#define BDSARRAYINFO_H
21#include "BDSArray4DCoords.hh"
22#include "BDSFourVector.hh"
23
24#include "G4Types.hh"
25
26#include <array>
27
35{
36public:
37 BDSArrayInfo() = delete;
38 explicit BDSArrayInfo(const BDSArray4DCoords* array):
39 zeroPoint(std::array<G4double,4>()),
40 nPoints(std::array<G4int,4>()),
41 arrayToSpatialIndex{0,1,2,3}
42 {
43 auto zV = array->ArrayCoordsFromXYZT(0, 0, 0, 0);
44 auto nP = array->NXYZT();
45 for (G4int i = 0; i < 4; i++)
46 {
47 zeroPoint[i] = zV[i];
48 nPoints[i] = nP[i];
49 }
50 arrayToSpatialIndex = array->ArrayToSpatialDimensionIndices();
51 }
52 ~BDSArrayInfo(){;}
53
54 std::array<G4double, 4> zeroPoint;
55 std::array<G4int, 4> nPoints;
56 std::array<G4int, 4> arrayToSpatialIndex;
57};
58
59#endif
Overlay of 4D array that provides uniform only spatial coordinate mapping.
std::array< G4int, 4 > ArrayToSpatialDimensionIndices() const
Access all indices at once.
void ArrayCoordsFromXYZT(G4double &x, G4double &xArr, G4double &y, G4double &yArr, G4double &z, G4double &zArr, G4double &t, G4double &tArr) const
Utility version to forward to individual function.
BDSFourVector< G4int > NXYZT() const
Access the number of elements in a given dimension.
Definition: BDSArray4D.hh:66
Simple holder of information about an array.
Definition: BDSArrayInfo.hh:35