19#include "BDSArray4D.hh"
21#include "BDSException.hh"
22#include "BDSFieldValue.hh"
32 nX(nXIn), nY(nYIn), nZ(nZIn), nT(nTIn),
69 G4bool rx = x < 0 || x >
nX-1;
70 G4bool ry = y < 0 || y >
nY-1;
71 G4bool rz = z < 0 || z >
nZ-1;
72 G4bool rt = t < 0 || t >
nT-1;
73 return rx || ry || rz || rt;
84 std::to_string(x) +
", " +
85 std::to_string(y) +
", " +
86 std::to_string(z) +
", " +
87 std::to_string(t) +
") is outside array");
93 out <<
"#x = " <<
nX <<
", ";
94 out <<
"#y = " <<
nY <<
", ";
95 out <<
"#z = " <<
nZ <<
", ";
96 out <<
"#t = " <<
nT << G4endl;
98 for (G4int t = 0; t <
nT; t++)
100 for (G4int z = 0; z <
nZ; z++)
102 for (G4int y = 0; y <
nY; y++)
104 for (G4int x = 0; x <
nX; x++)
112std::ostream& operator<< (std::ostream& out,
BDSArray4D const &a)
4D array and base class for 3,2 & 1D arrays.
virtual void OutsideWarn(G4int x, G4int y, G4int z, G4int t) const
Use Outside() but warn and exit if the coordinates requested are outside the array.
std::vector< BDSFieldValue > data
A 1D array representing all the data.
virtual G4bool Outside(G4int x, G4int y, G4int z, G4int t) const
Return whether the indices are valid and lie within the array boundaries or not.
virtual BDSFieldValue & operator()(G4int x, G4int y=0, G4int z=0, G4int t=0)
Setter & (technically, a non-const) accessor.
BDSFieldValue defaultValue
Need to store a default value so it can be return by reference.
virtual const BDSFieldValue & GetConst(G4int x, G4int y=0, G4int z=0, G4int t=0) const
virtual std::ostream & Print(std::ostream &out) const
General exception with possible name of object and message.