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

Representation of arrays used in tokens. More...

#include <array.h>

Collaboration diagram for GMAD::Array:
Collaboration graph

Public Member Functions

 Array ()
 Default Constructor. More...
 
 Array (Symtab *)
 Constructor from symbol. More...
 
double Product (Array *a)
 Scalar vector product. More...
 
const std::vector< std::string > & GetSymbols () const
 Access. More...
 
std::list< std::string > GetSymbolsList () const
 
const std::vector< double > & GetData () const
 
std::list< double > GetDataList () const
 
void Clear ()
 Clear data. More...
 
void Print ()
 Print data. More...
 
template<template< typename, typename > class Container>
void Copy (Container< std::string, std::allocator< std::string > > &cpy)
 Copy STL string containers into symbols. More...
 
template<typename T , template< typename, typename > class Container>
void Copy (Container< T, std::allocator< T > > &cpy)
 Copy STL numerical containers into data. More...
 
template<template< typename, typename > class Container>
void set_vector (Container< std::string, std::allocator< std::string > > &dst) const
 Copy symbols into STL string containers. More...
 
template<typename T , template< typename, typename > class Container>
void set_vector (Container< T, std::allocator< T > > &dst) const
 Copy data into STL numerical containers. More...
 

Static Public Member Functions

static ArrayAdd (Array *a1, Array *a2)
 Constructor from adding 2 double arrays. More...
 
static ArraySubtract (Array *a1, Array *a2)
 Constructor from subtracting 2 double arrays. More...
 
static ArrayAdd (Array *a, double d)
 Constructor from adding an array. More...
 
static ArraySubtract (Array *a, double d)
 Constructor from subtracting an array. More...
 
static ArrayMultiply (Array *a, double d)
 Constructor from multiplying an array. More...
 
static ArrayDivide (Array *a, double d)
 Constructor from dividing an array. More...
 

Private Member Functions

 Array (unsigned int n)
 Helper constructor method, creates data array with size n. More...
 

Private Attributes

std::vector< std::string > symbols
 Representation of string array. More...
 
std::vector< double > data
 Representation of double array. More...
 

Friends

class Symtab
 Symtabs and arrays are kind of interchangeable. More...
 

Detailed Description

Representation of arrays used in tokens.

Used for both std::string and double

Definition at line 40 of file array.h.

Constructor & Destructor Documentation

◆ Array() [1/3]

Array::Array ( unsigned int  n)
explicitprivate

Helper constructor method, creates data array with size n.

Definition at line 39 of file array.cc.

References data.

◆ Array() [2/3]

Array::Array ( )

Default Constructor.

Definition at line 27 of file array.cc.

Referenced by Add(), Divide(), Multiply(), and Subtract().

Here is the caller graph for this function:

◆ Array() [3/3]

Array::Array ( Symtab array)
explicit

Constructor from symbol.

Definition at line 31 of file array.cc.

References GMAD::Symtab::array, and data.

Member Function Documentation

◆ Add() [1/2]

Array * Array::Add ( Array a,
double  d 
)
static

Constructor from adding an array.

Definition at line 66 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

◆ Add() [2/2]

Array * Array::Add ( Array a1,
Array a2 
)
static

Constructor from adding 2 double arrays.

Definition at line 44 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

◆ Clear()

void Array::Clear ( )

Clear data.

Definition at line 124 of file array.cc.

References data, and symbols.

◆ Copy() [1/2]

template<template< typename, typename > class Container>
void GMAD::Array::Copy ( Container< std::string, std::allocator< std::string > > &  cpy)
inline

Copy STL string containers into symbols.

Definition at line 86 of file array.h.

References symbols.

Referenced by GMAD::Parser::FillArray(), and GMAD::Parser::FillString().

Here is the caller graph for this function:

◆ Copy() [2/2]

template<typename T , template< typename, typename > class Container>
void GMAD::Array::Copy ( Container< T, std::allocator< T > > &  cpy)
inline

Copy STL numerical containers into data.

Definition at line 94 of file array.h.

References data.

◆ Divide()

Array * Array::Divide ( Array a,
double  d 
)
static

Constructor from dividing an array.

Definition at line 99 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

◆ GetData()

const std::vector< double > & GMAD::Array::GetData ( ) const
inline

Definition at line 76 of file array.h.

◆ GetDataList()

std::list< double > Array::GetDataList ( ) const

Definition at line 152 of file array.cc.

◆ GetSymbols()

const std::vector< std::string > & GMAD::Array::GetSymbols ( ) const
inline

Access.

Definition at line 74 of file array.h.

References symbols.

◆ GetSymbolsList()

std::list< std::string > Array::GetSymbolsList ( ) const

Definition at line 144 of file array.cc.

◆ Multiply()

Array * Array::Multiply ( Array a,
double  d 
)
static

Constructor from multiplying an array.

Definition at line 88 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

◆ Print()

void Array::Print ( )

Print data.

Definition at line 130 of file array.cc.

References data, and symbols.

◆ Product()

double Array::Product ( Array a)

Scalar vector product.

Definition at line 110 of file array.cc.

References data.

◆ set_vector() [1/2]

template<template< typename, typename > class Container>
void GMAD::Array::set_vector ( Container< std::string, std::allocator< std::string > > &  dst) const
inline

Copy symbols into STL string containers.

Definition at line 102 of file array.h.

References symbols.

Referenced by GMAD::Material::set_value(), and GMAD::PhysicsBiasing::set_value().

Here is the caller graph for this function:

◆ set_vector() [2/2]

template<typename T , template< typename, typename > class Container>
void GMAD::Array::set_vector ( Container< T, std::allocator< T > > &  dst) const
inline

Copy data into STL numerical containers.

Definition at line 118 of file array.h.

References data.

◆ Subtract() [1/2]

Array * Array::Subtract ( Array a,
double  d 
)
static

Constructor from subtracting an array.

Definition at line 77 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

◆ Subtract() [2/2]

Array * Array::Subtract ( Array a1,
Array a2 
)
static

Constructor from subtracting 2 double arrays.

Definition at line 55 of file array.cc.

References Array(), and data.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ Symtab

friend class Symtab
friend

Symtabs and arrays are kind of interchangeable.

Definition at line 53 of file array.h.

Field Documentation

◆ data

std::vector<double> GMAD::Array::data
private

Representation of double array.

Definition at line 46 of file array.h.

Referenced by Add(), Array(), Clear(), Copy(), Divide(), Multiply(), Print(), Product(), GMAD::Symtab::Set(), set_vector(), and Subtract().

◆ symbols

std::vector<std::string> GMAD::Array::symbols
private

Representation of string array.

Definition at line 44 of file array.h.

Referenced by Clear(), Copy(), GetSymbols(), Print(), and set_vector().


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