BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSArrayInfo.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 BDSARRAYINFO_H
19#define BDSARRAYINFO_H
20#include "BDSArray4DCoords.hh"
21#include "BDSFourVector.hh"
22
23#include "G4Types.hh"
24
25#include <array>
26
34{
35public:
36 BDSArrayInfo() = delete;
37 explicit BDSArrayInfo(const BDSArray4DCoords* array):
38 zeroPoint(std::array<G4double,4>()),
39 nPoints(std::array<G4int,4>()),
40 arrayToSpatialIndex{0,1,2,3}
41 {
42 auto zV = array->ArrayCoordsFromXYZT(0, 0, 0, 0);
43 auto nP = array->NXYZT();
44 for (G4int i = 0; i < 4; i++)
45 {
46 zeroPoint[i] = zV[i];
47 nPoints[i] = nP[i];
48 }
49 arrayToSpatialIndex = array->ArrayToSpatialDimensionIndices();
50 }
51 ~BDSArrayInfo(){;}
52
53 std::array<G4double, 4> zeroPoint;
54 std::array<G4int, 4> nPoints;
55 std::array<G4int, 4> arrayToSpatialIndex;
56};
57
58#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:65
Simple holder of information about an array.