BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions | Private Attributes | Friends
BDSArray3DCoordsTransformed Class Reference

Wrapped BDSArray3DCoords with possible transformation to extend field. More...

#include <BDSArray3DCoordsTransformed.hh>

Inheritance diagram for BDSArray3DCoordsTransformed:
Inheritance graph
Collaboration diagram for BDSArray3DCoordsTransformed:
Collaboration graph

Public Member Functions

 BDSArray3DCoordsTransformed ()=delete
 No default constructor.
 
 BDSArray3DCoordsTransformed (BDSArray3DCoords *arrayIn, BDSArrayOperatorIndex *indexOperatorIn, BDSArrayOperatorValue *valueOperatorIn)
 A valid index and value operator must be supplied. More...
 
virtual void ExtractSection2x2x2 (G4double x, G4double y, G4double z, BDSFieldValue(&localData)[2][2][2], G4double &xFrac, G4double &yFrac, G4double &zFrac) const
 
virtual void ExtractSection4x4x4 (G4double x, G4double y, G4double z, BDSFieldValue(&localData)[4][4][4], G4double &xFrac, G4double &yFrac, G4double &zFrac) const
 
virtual BDSFieldValue ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const
 
virtual std::ostream & Print (std::ostream &out) const
 
- Public Member Functions inherited from BDSArray3DCoords
 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. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from BDSArray4DCoords
 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. More...
 
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. More...
 
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. More...
 
BDSFourVector< G4int > NearestXYZT (const BDSFourVector< G4double > &pos) const
 Return the index of the nearest field value in space via four-vector. More...
 
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. More...
 
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. More...
 
virtual BDSFieldValue ExtractNearest (G4double x, G4double y=0, G4double z=0, G4double t=0) const
 Extract nearest field value from array. More...
 
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. More...
 
G4double XMin () const
 
G4double YMin () const
 
G4double ZMin () const
 
G4double TMin () const
 
G4double XMax () const
 
G4double YMax () const
 
G4double ZMax () const
 
G4double TMax () const
 
G4int DimensionIndex (BDSDimensionType spatialDimension) const
 
std::array< G4int, 4 > ArrayToSpatialDimensionIndices () const
 Access all indices at once. More...
 
G4double XStep () const
 The distance in spatial coordinates between any two points in the array. More...
 
G4double YStep () const
 The distance in spatial coordinates between any two points in the array. More...
 
G4double ZStep () const
 The distance in spatial coordinates between any two points in the array. More...
 
G4double TStep () const
 The distance in spatial coordinates between any two points in the array. More...
 
virtual G4double ArrayCoordsFromX (G4double x) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4double ArrayCoordsFromY (G4double y) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4double ArrayCoordsFromZ (G4double z) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4double ArrayCoordsFromT (G4double t) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
void ArrayCoordsFromXY (G4double &x, G4double &xArr, G4double &y, G4double &yArr) const
 Utility version to forward to individual function. More...
 
void ArrayCoordsFromXYZ (G4double &x, G4double &xArr, G4double &y, G4double &yArr, G4double &z, G4double &zArr) const
 Utility version to forward to individual function. More...
 
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. More...
 
G4double XFromArrayCoords (G4double xCoord) const
 Return spatial value from a continuous array coordinate in one dimension. More...
 
G4double YFromArrayCoords (G4double yCoord) const
 Return spatial value from a continuous array coordinate in one dimension. More...
 
G4double ZFromArrayCoords (G4double zCoord) const
 Return spatial value from a continuous array coordinate in one dimension. More...
 
G4double TFromArrayCoords (G4double tCoord) const
 Return spatial value from a continuous array coordinate in one dimension. More...
 
virtual G4int NearestX (G4double x) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4int NearestY (G4double y) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4int NearestZ (G4double z) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
virtual G4int NearestT (G4double t) const
 Not much point in being both virtual and inline (in our use case) but has to be virtual. More...
 
BDSDimensionType FirstDimension () const
 Accessor for each dimension label. e.g. array 'x' = spatial z. More...
 
BDSDimensionType SecondDimension () const
 Accessor for each dimension label. e.g. array 'x' = spatial z. More...
 
BDSDimensionType ThirdDimension () const
 Accessor for each dimension label. e.g. array 'x' = spatial z. More...
 
BDSDimensionType FourthDimension () const
 Accessor for each dimension label. e.g. array 'x' = spatial z. More...
 
- Public Member Functions inherited from BDSArray4D
 BDSArray4D ()=delete
 
 BDSArray4D (G4int nXIn, G4int nYIn, G4int nZIn, G4int nTIn)
 
virtual BDSFieldValueoperator() (G4int x, G4int y=0, G4int z=0, G4int t=0)
 Setter & (technically, a non-const) accessor. More...
 
const BDSFieldValueoperator() (BDSFourVector< G4int > &pos)
 Convenience accessor to operator(). More...
 
virtual const BDSFieldValueGetConst (G4int x, G4int y=0, G4int z=0, G4int t=0) const
 
virtual const BDSFieldValueoperator() (G4int x, G4int y=0, G4int z=0, G4int t=0) const
 Convenience shortcut to GetConst(). More...
 
const BDSFieldValueoperator() (const BDSFourVector< G4int > &pos) const
 Convenience accessor to operator(). More...
 
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. More...
 
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. More...
 
virtual std::ostream & Print (std::ostream &out) const
 
G4int NX () const
 Access the number of elements in a given dimension. More...
 
G4int NY () const
 Access the number of elements in a given dimension. More...
 
G4int NZ () const
 Access the number of elements in a given dimension. More...
 
G4int NT () const
 Access the number of elements in a given dimension. More...
 
BDSFourVector< G4int > NXYZT () const
 Access the number of elements in a given dimension. More...
 

Private Attributes

BDSArrayOperatorIndexindexOperator
 
BDSArrayOperatorValuevalueOperator
 
BDSFieldValue returnValue
 

Friends

std::ostream & operator<< (std::ostream &out, BDSArray3DCoordsTransformed const &a)
 Delegate function to call polymorphic Print(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from BDSArray4DCoords
void BuildDimensionIndex ()
 Build up an array of ints based on the order of dimensions stored in the array. More...
 
- Protected Attributes inherited from BDSArray4DCoords
G4double smallestSpatialStep
 
BDSDimensionType xDimension
 
BDSDimensionType yDimension
 
BDSDimensionType zDimension
 
BDSDimensionType tDimension
 
std::array< G4int, 4 > dimensions
 
G4double xMin
 Dimension parameter - protected for derived class access. More...
 
G4double xMax
 Dimension parameter - protected for derived class access. More...
 
G4double yMin
 Dimension parameter - protected for derived class access. More...
 
G4double yMax
 Dimension parameter - protected for derived class access. More...
 
G4double zMin
 Dimension parameter - protected for derived class access. More...
 
G4double zMax
 Dimension parameter - protected for derived class access. More...
 
G4double tMin
 Dimension parameter - protected for derived class access. More...
 
G4double tMax
 Dimension parameter - protected for derived class access. More...
 
G4double xStep
 Dimension parameter - protected for derived class access. More...
 
G4double yStep
 Dimension parameter - protected for derived class access. More...
 
G4double zStep
 Dimension parameter - protected for derived class access. More...
 
G4double tStep
 Dimension parameter - protected for derived class access. More...
 
- Protected Attributes inherited from BDSArray4D
BDSFieldValue defaultValue
 Need to store a default value so it can be return by reference. More...
 
const G4int nX
 Dimension. More...
 
const G4int nY
 Dimension. More...
 
const G4int nZ
 Dimension. More...
 
const G4int nT
 Dimension. More...
 

Detailed Description

Wrapped BDSArray3DCoords with possible transformation to extend field.

See BDSArray1DCoordsTransformed for explanation.

Author
Laurie Nevay

Definition at line 42 of file BDSArray3DCoordsTransformed.hh.

Constructor & Destructor Documentation

◆ BDSArray3DCoordsTransformed()

BDSArray3DCoordsTransformed::BDSArray3DCoordsTransformed ( BDSArray3DCoords arrayIn,
BDSArrayOperatorIndex indexOperatorIn,
BDSArrayOperatorValue valueOperatorIn 
)

A valid index and value operator must be supplied.

Definition at line 30 of file BDSArray3DCoordsTransformed.cc.

◆ ~BDSArray3DCoordsTransformed()

BDSArray3DCoordsTransformed::~BDSArray3DCoordsTransformed ( )
virtual

Definition at line 39 of file BDSArray3DCoordsTransformed.cc.

Member Function Documentation

◆ ExtractNearest()

BDSFieldValue BDSArray3DCoordsTransformed::ExtractNearest ( G4double  x,
G4double  y = 0,
G4double  z = 0,
G4double  t = 0 
) const
virtual

Same as base class but applies index operator to access the data and applies value operator to the value.

Reimplemented from BDSArray3DCoords.

Definition at line 128 of file BDSArray3DCoordsTransformed.cc.

References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4D::GetConst(), BDSArray4DCoords::NearestX(), BDSArray4DCoords::NearestY(), and BDSArray4DCoords::NearestZ().

Here is the call graph for this function:

◆ ExtractSection2x2x2()

void BDSArray3DCoordsTransformed::ExtractSection2x2x2 ( G4double  x,
G4double  y,
G4double  z,
BDSFieldValue(&)  localData[2][2][2],
G4double &  xFrac,
G4double &  yFrac,
G4double &  zFrac 
) const
virtual

Same as base class but applies index operator to access the data and applies value operator to the value.

Reimplemented from BDSArray3DCoords.

Definition at line 45 of file BDSArray3DCoordsTransformed.cc.

References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4DCoords::ArrayCoordsFromXYZ(), and BDSArray4D::GetConst().

Here is the call graph for this function:

◆ ExtractSection4x4x4()

void BDSArray3DCoordsTransformed::ExtractSection4x4x4 ( G4double  x,
G4double  y,
G4double  z,
BDSFieldValue(&)  localData[4][4][4],
G4double &  xFrac,
G4double &  yFrac,
G4double &  zFrac 
) const
virtual

Same as base class but applies index operator to access the data and applies value operator to the value.

Reimplemented from BDSArray3DCoords.

Definition at line 86 of file BDSArray3DCoordsTransformed.cc.

References BDSArrayOperatorValue::Apply(), BDSArrayOperatorIndex::Apply(), BDSArray4DCoords::ArrayCoordsFromX(), BDSArray4DCoords::ArrayCoordsFromY(), BDSArray4DCoords::ArrayCoordsFromZ(), and BDSArray4D::GetConst().

Here is the call graph for this function:

◆ Print()

std::ostream & BDSArray3DCoordsTransformed::Print ( std::ostream &  out) const
virtual

Overloaded output function from BDSArray4D. Prints spatial map parameters, then underlying array.

Reimplemented from BDSArray4DCoords.

Definition at line 145 of file BDSArray3DCoordsTransformed.cc.

References BDSArrayOperatorIndex::Name(), BDSArrayOperatorValue::Name(), and BDSArray4DCoords::Print().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
BDSArray3DCoordsTransformed const &  a 
)
friend

Delegate function to call polymorphic Print().

Definition at line 153 of file BDSArray3DCoordsTransformed.cc.

Field Documentation

◆ indexOperator

BDSArrayOperatorIndex* BDSArray3DCoordsTransformed::indexOperator
private

Definition at line 86 of file BDSArray3DCoordsTransformed.hh.

◆ returnValue

BDSFieldValue BDSArray3DCoordsTransformed::returnValue
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 91 of file BDSArray3DCoordsTransformed.hh.

◆ valueOperator

BDSArrayOperatorValue* BDSArray3DCoordsTransformed::valueOperator
private

Definition at line 87 of file BDSArray3DCoordsTransformed.hh.


The documentation for this class was generated from the following files: