BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Wrapped BDSArray1DCoords with possible transformation to extend field. More...
#include <BDSArray1DCoordsTransformed.hh>
Public Member Functions | |
BDSArray1DCoordsTransformed ()=delete | |
No default constructor. | |
BDSArray1DCoordsTransformed (BDSArray1DCoords *arrayIn, BDSArrayOperatorIndex *indexOperatorIn, BDSArrayOperatorValue *valueOperatorIn) | |
A valid index and value operator must be supplied. | |
virtual void | ExtractSection2 (G4double x, BDSFieldValue(&localData)[2], G4double &xFrac) const |
virtual void | ExtractSection4 (G4double x, BDSFieldValue(&localData)[4], G4double &xFrac) const |
virtual BDSFieldValue | ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const |
Extract nearest field value from array. y,z,t ignored but required for overload. | |
virtual std::ostream & | Print (std::ostream &out) const |
![]() | |
BDSArray1DCoords ()=delete | |
BDSArray1DCoords (G4int nX, G4double xMinIn, G4double xMaxIn, BDSDimensionType dimensionIn=BDSDimensionType::x) | |
virtual void | ExtractSection2 (G4double x, BDSFieldValue(&localData)[2], G4double &xFrac) const |
Extract 2 points lying around coordinate x. | |
virtual void | ExtractSection4 (G4double x, BDSFieldValue(&localData)[4], G4double &xFrac) const |
Extract 4 points lying around coordinate x, where x will be between points 2 and 3. | |
virtual BDSFieldValue | ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const |
Extract nearest field value from array. y,z,t ignored but required for overload. | |
virtual BDSExtent | Extent () const |
![]() | |
BDSArray2DCoords ()=delete | |
BDSArray2DCoords (G4int nX, G4int nY, G4double xMinIn, G4double xMaxIn, G4double yMinIn, G4double yMaxIn, BDSDimensionType xDimensionIn=BDSDimensionType::x, BDSDimensionType yDimensionIn=BDSDimensionType::y) | |
virtual void | ExtractSection2x2 (G4double x, G4double y, BDSFieldValue(&localData)[2][2], G4double &xFrac, G4double &yFrac) const |
Extract 2x2 points lying around coordinate x. | |
virtual void | ExtractSection4x4 (G4double x, G4double y, BDSFieldValue(&localData)[4][4], G4double &xFrac, G4double &yFrac) const |
Extract 4x4 points lying around coordinate x. | |
virtual BDSFieldValue | ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const |
Extract nearest field value from array. z,t ignored but required for overload. | |
virtual BDSExtent | Extent () const |
![]() | |
BDSArray3DCoords ()=delete | |
BDSArray3DCoords (G4int nX, G4int nY, G4int nZ, G4double xMinIn, G4double xMaxIn, G4double yMinIn, G4double yMaxIn, G4double zMinIn, G4double zMaxIn, BDSDimensionType xDimensionIn=BDSDimensionType::x, BDSDimensionType yDimensionIn=BDSDimensionType::y, BDSDimensionType zDimensionIn=BDSDimensionType::z) | |
virtual void | ExtractSection2x2x2 (G4double x, G4double y, G4double z, BDSFieldValue(&localData)[2][2][2], G4double &xFrac, G4double &yFrac, G4double &zFrac) const |
Extract 2x2x2 points lying around coordinate x. | |
virtual void | ExtractSection4x4x4 (G4double x, G4double y, G4double z, BDSFieldValue(&localData)[4][4][4], G4double &xFrac, G4double &yFrac, G4double &zFrac) const |
Extract 4x4x4 points lying around coordinate x. | |
virtual BDSFieldValue | ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const |
Extract nearest field value from array. t ignored but required for overload. | |
![]() | |
BDSArray4DCoords ()=delete | |
BDSArray4DCoords (G4int nXIn, G4int nYIn, G4int nZIn, G4int nTIn, G4double xMinIn, G4double xMaxIn, G4double yMinIn, G4double yMaxIn, G4double zMinIn, G4double zMaxIn, G4double tMinIn, G4double tMaxIn, BDSDimensionType xDimensionIn=BDSDimensionType::x, BDSDimensionType yDimensionIn=BDSDimensionType::y, BDSDimensionType zDimensionIn=BDSDimensionType::z, BDSDimensionType tDimensionIn=BDSDimensionType::t) | |
G4double | SmallestSpatialStep () const |
virtual G4bool | OutsideCoords (G4double x, G4double y, G4double z, G4double t) const |
Whether the spatial coordinates lie outside the range of the array or not. | |
virtual void | OutsideCoordsWarn (G4double x, G4double y, G4double z, G4double t) const |
BDSFourVector< G4double > | ArrayCoordsFromXYZT (G4double x, G4double y, G4double z, G4double t) const |
Convenience function to easily get array coords in all dimensions at once. | |
BDSFourVector< G4double > | XYZTFromArrayCoords (G4double x, G4double y, G4double z, G4double t) const |
BDSFourVector< G4int > | NearestXYZT (G4double x, G4double y, G4double z, G4double t) const |
Return the index of the nearest field value in space. | |
BDSFourVector< G4int > | NearestXYZT (const BDSFourVector< G4double > &pos) const |
Return the index of the nearest field value in space via four-vector. | |
virtual void | ExtractSection2x2x2x2 (G4double x, G4double y, G4double z, G4double t, BDSFieldValue(&localData)[2][2][2][2], G4double &xFrac, G4double &yFrac, G4double &zFrac, G4double &tFrac) const |
Extract 2x2x2x2 points lying around coordinate x. | |
virtual void | ExtractSection4x4x4x4 (G4double x, G4double y, G4double z, G4double t, BDSFieldValue(&localData)[4][4][4][4], G4double &xFrac, G4double &yFrac, G4double &zFrac, G4double &tFrac) const |
Extract 4x4x4x4 points lying around coordinate x. | |
virtual BDSFieldValue | ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const |
Extract nearest field value from array. | |
virtual std::ostream & | Print (std::ostream &out) const |
virtual BDSExtent | Extent () const |
Return the SPATIAL (only) extent of this field without any offset. Ignores time. | |
G4double | XMin () const |
G4double | YMin () const |
G4double | ZMin () const |
G4double | TMin () const |
G4double | XMax () const |
G4double | YMax () const |
G4double | ZMax () const |
G4double | TMax () const |
virtual G4bool | TimeVarying () const |
G4int | DimensionIndex (BDSDimensionType spatialDimension) const |
std::array< G4int, 4 > | ArrayToSpatialDimensionIndices () const |
Access all indices at once. | |
G4double | XStep () const |
The distance in spatial coordinates between any two points in the array. | |
G4double | YStep () const |
The distance in spatial coordinates between any two points in the array. | |
G4double | ZStep () const |
The distance in spatial coordinates between any two points in the array. | |
G4double | TStep () const |
The distance in spatial coordinates between any two points in the array. | |
virtual G4double | ArrayCoordsFromX (G4double x) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4double | ArrayCoordsFromY (G4double y) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4double | ArrayCoordsFromZ (G4double z) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4double | ArrayCoordsFromT (G4double t) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
void | ArrayCoordsFromXY (G4double &x, G4double &xArr, G4double &y, G4double &yArr) const |
Utility version to forward to individual function. | |
void | ArrayCoordsFromXYZ (G4double &x, G4double &xArr, G4double &y, G4double &yArr, G4double &z, G4double &zArr) const |
Utility version to forward to individual function. | |
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. | |
G4double | XFromArrayCoords (G4double xCoord) const |
Return spatial value from a continuous array coordinate in one dimension. | |
G4double | YFromArrayCoords (G4double yCoord) const |
Return spatial value from a continuous array coordinate in one dimension. | |
G4double | ZFromArrayCoords (G4double zCoord) const |
Return spatial value from a continuous array coordinate in one dimension. | |
G4double | TFromArrayCoords (G4double tCoord) const |
Return spatial value from a continuous array coordinate in one dimension. | |
virtual G4int | NearestX (G4double x) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4int | NearestY (G4double y) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4int | NearestZ (G4double z) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
virtual G4int | NearestT (G4double t) const |
Not much point in being both virtual and inline (in our use case) but has to be virtual. | |
BDSDimensionType | FirstDimension () const |
Accessor for each dimension label. e.g. array 'x' = spatial z. | |
BDSDimensionType | SecondDimension () const |
Accessor for each dimension label. e.g. array 'x' = spatial z. | |
BDSDimensionType | ThirdDimension () const |
Accessor for each dimension label. e.g. array 'x' = spatial z. | |
BDSDimensionType | FourthDimension () const |
Accessor for each dimension label. e.g. array 'x' = spatial z. | |
![]() | |
BDSArray4D ()=delete | |
BDSArray4D (G4int nXIn, G4int nYIn, G4int nZIn, G4int nTIn) | |
virtual BDSFieldValue & | operator() (G4int x, G4int y=0, G4int z=0, G4int t=0) |
Setter & (technically, a non-const) accessor. | |
const BDSFieldValue & | operator() (BDSFourVector< G4int > &pos) |
Convenience accessor to operator(). | |
virtual const BDSFieldValue & | GetConst (G4int x, G4int y=0, G4int z=0, G4int t=0) const |
virtual const BDSFieldValue & | operator() (G4int x, G4int y=0, G4int z=0, G4int t=0) const |
Convenience shortcut to GetConst(). | |
const BDSFieldValue & | operator() (const BDSFourVector< G4int > &pos) const |
Convenience accessor to operator(). | |
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 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. | |
virtual std::ostream & | Print (std::ostream &out) const |
G4int | NX () const |
Access the number of elements in a given dimension. | |
G4int | NY () const |
Access the number of elements in a given dimension. | |
G4int | NZ () const |
Access the number of elements in a given dimension. | |
G4int | NT () const |
Access the number of elements in a given dimension. | |
BDSFourVector< G4int > | NXYZT () const |
Access the number of elements in a given dimension. | |
Private Attributes | |
BDSArrayOperatorIndex * | indexOperator |
BDSArrayOperatorValue * | valueOperator |
BDSFieldValue | returnValue |
Friends | |
std::ostream & | operator<< (std::ostream &out, BDSArray1DCoordsTransformed const &a) |
Delegate function to call polymorphic Print(). | |
Additional Inherited Members | |
![]() | |
void | BuildDimensionIndex () |
Build up an array of ints based on the order of dimensions stored in the array. | |
![]() | |
G4double | smallestSpatialStep |
BDSDimensionType | xDimension |
BDSDimensionType | yDimension |
BDSDimensionType | zDimension |
BDSDimensionType | tDimension |
std::array< G4int, 4 > | dimensions |
G4bool | timeVarying |
G4double | xMin |
Dimension parameter - protected for derived class access. | |
G4double | xMax |
Dimension parameter - protected for derived class access. | |
G4double | yMin |
Dimension parameter - protected for derived class access. | |
G4double | yMax |
Dimension parameter - protected for derived class access. | |
G4double | zMin |
Dimension parameter - protected for derived class access. | |
G4double | zMax |
Dimension parameter - protected for derived class access. | |
G4double | tMin |
Dimension parameter - protected for derived class access. | |
G4double | tMax |
Dimension parameter - protected for derived class access. | |
G4double | xStep |
Dimension parameter - protected for derived class access. | |
G4double | yStep |
Dimension parameter - protected for derived class access. | |
G4double | zStep |
Dimension parameter - protected for derived class access. | |
G4double | tStep |
Dimension parameter - protected for derived class access. | |
![]() | |
BDSFieldValue | defaultValue |
Need to store a default value so it can be return by reference. | |
const G4int | nX |
Dimension. | |
const G4int | nY |
Dimension. | |
const G4int | nZ |
Dimension. | |
const G4int | nT |
Dimension. | |
Wrapped BDSArray1DCoords with possible transformation to extend field.
Uses an index operator and a value operator. The index operator will map some array index coordinates to another index to give the array a larger appearance for the same data, e.g. index -5 -> 5 for reflection. The value operator may flip components of the field value stored depending on the original array coordinates supplied, e.g. flip Bx in quadrant 2.
Definition at line 45 of file BDSArray1DCoordsTransformed.hh.
BDSArray1DCoordsTransformed::BDSArray1DCoordsTransformed | ( | BDSArray1DCoords * | arrayIn, |
BDSArrayOperatorIndex * | indexOperatorIn, | ||
BDSArrayOperatorValue * | valueOperatorIn | ||
) |
A valid index and value operator must be supplied.
Definition at line 30 of file BDSArray1DCoordsTransformed.cc.
|
virtual |
Definition at line 39 of file BDSArray1DCoordsTransformed.cc.
|
virtual |
Extract nearest field value from array. y,z,t ignored but required for overload.
Reimplemented from BDSArray1DCoords.
Definition at line 86 of file BDSArray1DCoordsTransformed.cc.
References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4D::GetConst(), and BDSArray4DCoords::NearestX().
|
virtual |
Extract 2 points lying around coordinate x. Applies index operator to access the data and applies value operator to the value.
Reimplemented from BDSArray1DCoords.
Definition at line 45 of file BDSArray1DCoordsTransformed.cc.
References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4DCoords::ArrayCoordsFromX(), and BDSArray4D::GetConst().
|
virtual |
Same as base class but applies index operator to access the data and applies value operator to the value.
Reimplemented from BDSArray1DCoords.
Definition at line 66 of file BDSArray1DCoordsTransformed.cc.
References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4DCoords::ArrayCoordsFromX(), and BDSArray4D::GetConst().
|
virtual |
Overloaded output function from BDSArray4D. Prints spatial map parameters, then underlying array.
Reimplemented from BDSArray4DCoords.
Definition at line 99 of file BDSArray1DCoordsTransformed.cc.
References BDSArrayOperatorIndex::Name(), BDSArrayOperatorValue::Name(), and BDSArray4D::Print().
|
friend |
Delegate function to call polymorphic Print().
Definition at line 107 of file BDSArray1DCoordsTransformed.cc.
|
private |
Definition at line 80 of file BDSArray1DCoordsTransformed.hh.
|
mutableprivate |
Must return by reference and the true data value may have to be reflected in one or more dimensions. Copy to this and return reference to it.
Definition at line 85 of file BDSArray1DCoordsTransformed.hh.
|
private |
Definition at line 81 of file BDSArray1DCoordsTransformed.hh.