BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
BDSFieldLoaderBDSIM< T > Class Template Reference

Loader for BDSIM format fields. More...

#include <BDSFieldLoaderBDSIM.hh>

Collaboration diagram for BDSFieldLoaderBDSIM< T >:
Collaboration graph

Data Structures

struct  DimensionKeys
 

Public Member Functions

BDSArray4DCoordsLoad4D (const G4String &fileName)
 Load a 4D array. More...
 
BDSArray3DCoordsLoad3D (const G4String &fileName)
 Load a 3D array. More...
 
BDSArray2DCoordsLoad2D (const G4String &fileName)
 Load a 2D array. More...
 
BDSArray1DCoordsLoad1D (const G4String &fileName)
 Load a 1D array. More...
 

Private Member Functions

void CleanUp ()
 Ensure any member variables are reset between usages. More...
 
void Terminate (const G4String &message="")
 Close file and exit program in case of an error. More...
 
void Load (const G4String &fileName, const unsigned int nDim)
 General loader for any number of dimensions. More...
 
void ProcessData (const std::string &line, const unsigned long xIndex, const unsigned long yIndex=0, const unsigned long zIndex=0)
 

Private Attributes

file
 Templated iostream for std::ifstream and gzstream as well. More...
 
unsigned long nColumns
 Number of columns to read. More...
 
std::vector< G4float > lineData
 Vector to store line data during loading. More...
 
BDSFieldValue fv
 Temporary field value. More...
 
std::map< G4String, double > header
 Header keys and values. More...
 
BDSArray4DCoordsresult
 Resultant array from loading. More...
 
G4String loopOrder
 String for looping order when loading. More...
 
const std::vector< G4String > headerMustBePositiveKeys
 
unsigned long indexOfFirstFieldValue
 
std::map< BDSDimensionType, DimensionKeysdimKeyMap
 

Detailed Description

template<class T>
class BDSFieldLoaderBDSIM< T >

Loader for BDSIM format fields.

Loaders are given through specific public methods so the exact type can be returned.

The input stream type is templated.

This can exit the program if an invalid specification is loaded.

Author
Laurie Nevay

Definition at line 54 of file BDSFieldLoaderBDSIM.hh.

Constructor & Destructor Documentation

◆ BDSFieldLoaderBDSIM()

Definition at line 50 of file BDSFieldLoaderBDSIM.cc.

◆ ~BDSFieldLoaderBDSIM()

template<class T >
BDSFieldLoaderBDSIM< T >::~BDSFieldLoaderBDSIM

Definition at line 66 of file BDSFieldLoaderBDSIM.cc.

Member Function Documentation

◆ CleanUp()

template<class T >
void BDSFieldLoaderBDSIM< T >::CleanUp
private

Ensure any member variables are reset between usages.

Definition at line 70 of file BDSFieldLoaderBDSIM.cc.

◆ Load()

template<class T >
void BDSFieldLoaderBDSIM< T >::Load ( const G4String &  fileName,
const unsigned int  nDim 
)
private

General loader for any number of dimensions.

Definition at line 123 of file BDSFieldLoaderBDSIM.cc.

References BDS::DetermineDimensionType(), and BDS::LowerCase().

Here is the call graph for this function:

◆ Load1D()

template<class T >
BDSArray1DCoords * BDSFieldLoaderBDSIM< T >::Load1D ( const G4String &  fileName)

Load a 1D array.

Definition at line 95 of file BDSFieldLoaderBDSIM.cc.

Referenced by BDSFieldLoader::LoadBDSIM1D().

Here is the caller graph for this function:

◆ Load2D()

template<class T >
BDSArray2DCoords * BDSFieldLoaderBDSIM< T >::Load2D ( const G4String &  fileName)

Load a 2D array.

Definition at line 102 of file BDSFieldLoaderBDSIM.cc.

Referenced by BDSFieldLoader::LoadBDSIM2D().

Here is the caller graph for this function:

◆ Load3D()

template<class T >
BDSArray3DCoords * BDSFieldLoaderBDSIM< T >::Load3D ( const G4String &  fileName)

Load a 3D array.

Definition at line 109 of file BDSFieldLoaderBDSIM.cc.

Referenced by BDSFieldLoader::LoadBDSIM3D().

Here is the caller graph for this function:

◆ Load4D()

template<class T >
BDSArray4DCoords * BDSFieldLoaderBDSIM< T >::Load4D ( const G4String &  fileName)

Load a 4D array.

Definition at line 116 of file BDSFieldLoaderBDSIM.cc.

Referenced by BDSFieldLoader::LoadBDSIM4D().

Here is the caller graph for this function:

◆ ProcessData()

template<class T >
void BDSFieldLoaderBDSIM< T >::ProcessData ( const std::string &  line,
const unsigned long  xIndex,
const unsigned long  yIndex = 0,
const unsigned long  zIndex = 0 
)
private

Process on line of data. Index of 0 corresponds to a default value of field of 0. This allows various dimensional loading to use the same function.

Definition at line 408 of file BDSFieldLoaderBDSIM.cc.

◆ Terminate()

template<class T >
void BDSFieldLoaderBDSIM< T >::Terminate ( const G4String &  message = "")
private

Close file and exit program in case of an error.

Definition at line 88 of file BDSFieldLoaderBDSIM.cc.

Field Documentation

◆ dimKeyMap

template<class T >
std::map<BDSDimensionType, DimensionKeys> BDSFieldLoaderBDSIM< T >::dimKeyMap
private

Definition at line 102 of file BDSFieldLoaderBDSIM.hh.

◆ file

template<class T >
T BDSFieldLoaderBDSIM< T >::file
private

Templated iostream for std::ifstream and gzstream as well.

Definition at line 84 of file BDSFieldLoaderBDSIM.hh.

◆ fv

template<class T >
BDSFieldValue BDSFieldLoaderBDSIM< T >::fv
private

Temporary field value.

Definition at line 89 of file BDSFieldLoaderBDSIM.hh.

◆ header

template<class T >
std::map<G4String, double> BDSFieldLoaderBDSIM< T >::header
private

Header keys and values.

Definition at line 90 of file BDSFieldLoaderBDSIM.hh.

◆ headerMustBePositiveKeys

template<class T >
const std::vector<G4String> BDSFieldLoaderBDSIM< T >::headerMustBePositiveKeys
private

Definition at line 93 of file BDSFieldLoaderBDSIM.hh.

◆ indexOfFirstFieldValue

template<class T >
unsigned long BDSFieldLoaderBDSIM< T >::indexOfFirstFieldValue
private

Definition at line 94 of file BDSFieldLoaderBDSIM.hh.

◆ lineData

template<class T >
std::vector<G4float> BDSFieldLoaderBDSIM< T >::lineData
private

Vector to store line data during loading.

Definition at line 88 of file BDSFieldLoaderBDSIM.hh.

◆ loopOrder

template<class T >
G4String BDSFieldLoaderBDSIM< T >::loopOrder
private

String for looping order when loading.

Definition at line 92 of file BDSFieldLoaderBDSIM.hh.

◆ nColumns

template<class T >
unsigned long BDSFieldLoaderBDSIM< T >::nColumns
private

Number of columns to read.

Number of columns to read.

Definition at line 87 of file BDSFieldLoaderBDSIM.hh.

◆ result

template<class T >
BDSArray4DCoords* BDSFieldLoaderBDSIM< T >::result
private

Resultant array from loading.

Definition at line 91 of file BDSFieldLoaderBDSIM.hh.


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