BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
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

BDSArray4DCoords * Load4D (const G4String &fileName)
 Load a 4D array.
 
BDSArray3DCoords * Load3D (const G4String &fileName)
 Load a 3D array.
 
BDSArray2DCoords * Load2D (const G4String &fileName)
 Load a 2D array.
 
BDSArray1DCoords * Load1D (const G4String &fileName)
 Load a 1D array.
 

Private Member Functions

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

Private Attributes

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

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 53 of file BDSFieldLoaderBDSIM.hh.

Constructor & Destructor Documentation

◆ BDSFieldLoaderBDSIM()

template<class T >
BDSFieldLoaderBDSIM< T >::BDSFieldLoaderBDSIM ( )

Definition at line 49 of file BDSFieldLoaderBDSIM.cc.

◆ ~BDSFieldLoaderBDSIM()

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

Definition at line 71 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 75 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 128 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 100 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 107 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 114 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 121 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,
const unsigned long  zIndex,
unsigned long long  currentLineNumber 
)
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 419 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 93 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.

◆ dimUnitsMap

template<class T >
std::map<BDSDimensionType, G4double> BDSFieldLoaderBDSIM< T >::dimUnitsMap
private

Definition at line 103 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: