41 void replaceAll(std::string& source,
const std::string& from,
const std::string& to)
43 std::string newString;
44 newString.reserve( source.length() );
46 std::string::size_type lastPos = 0;
47 std::string::size_type findPos;
49 while( std::string::npos != ( findPos = source.find( from, lastPos )))
51 newString.append( source, lastPos, findPos - lastPos );
53 lastPos = findPos + from.length();
57 newString += source.substr( lastPos );
59 source.swap( newString );
65 template void Parser::Add<Atom, FastList<Atom> >();
66 template void Parser::Add<Aperture, FastList<Aperture> >();
67 template void Parser::Add<BLMPlacement, FastList<BLMPlacement> >();
68 template void Parser::Add<CavityModel, FastList<CavityModel> >();
69 template void Parser::Add<Crystal, FastList<Crystal> >();
70 template void Parser::Add<Field, FastList<Field> >();
71 template void Parser::Add<Material, FastList<Material> >();
72 template void Parser::Add<Modulator, FastList<Modulator> >();
73 template void Parser::Add<NewColour, FastList<NewColour> >();
74 template void Parser::Add<PhysicsBiasing, FastList<PhysicsBiasing> >();
75 template void Parser::Add<Placement, FastList<Placement> >();
76 template void Parser::Add<Query, FastList<Query> >();
77 template void Parser::Add<Region, FastList<Region> >();
78 template void Parser::Add<SamplerPlacement, FastList<SamplerPlacement> >();
79 template void Parser::Add<Scorer, FastList<Scorer> >();
80 template void Parser::Add<ScorerMesh, FastList<ScorerMesh> >();
81 template void Parser::Add<Tunnel, FastList<Tunnel> >();
83 template void Parser::Add<Atom, FastList<Atom> >(
bool unique,
const std::string& className);
84 template void Parser::Add<Aperture, FastList<Aperture> >(
bool unique,
const std::string& className);
85 template void Parser::Add<BLMPlacement, FastList<BLMPlacement> >(
bool unique,
const std::string& className);
86 template void Parser::Add<CavityModel, FastList<CavityModel> >(
bool unique,
const std::string& className);
87 template void Parser::Add<CoolingChannel, FastList<CoolingChannel> >(
bool unique,
const std::string& className);
88 template void Parser::Add<Crystal, FastList<Crystal> >(
bool unique,
const std::string& className);
89 template void Parser::Add<Field, FastList<Field> >(
bool unique,
const std::string& className);
90 template void Parser::Add<ScorerMesh, FastList<ScorerMesh> >(
bool unique,
const std::string& className);
91 template void Parser::Add<Material, FastList<Material> >(
bool unique,
const std::string& className);
92 template void Parser::Add<Modulator, FastList<Modulator> >(
bool unique,
const std::string& className);
93 template void Parser::Add<NewColour, FastList<NewColour> >(
bool unique,
const std::string& className);
94 template void Parser::Add<PhysicsBiasing, FastList<PhysicsBiasing> >(
bool unique,
const std::string& className);
96 template void Parser::Add<Query, FastList<Query> >(
bool unique,
const std::string& className);
97 template void Parser::Add<Region, FastList<Region> >(
bool unique,
const std::string& className);
98 template void Parser::Add<SamplerPlacement, FastList<SamplerPlacement> >(
bool unique,
const std::string& className);
99 template void Parser::Add<Scorer, FastList<Scorer> >(
bool unique,
const std::string& className);
100 template void Parser::Add<Tunnel, FastList<Tunnel> >(
bool unique,
const std::string& className);
101 template void Parser::Add<Laser, FastList<Laser> >(
bool unique,
const std::string& className);
107 extern std::string yyfilename;
123 std::cerr <<
"Parser has not been initialized!" << std::endl;
133 std::cerr <<
"Warning parser was already initialized!" << std::endl;
154 std::cout <<
"gmad_parser> opening file" << std::endl;
159 std::string tilde(
"~");
160 std::string home(getpwuid(getuid())->pw_dir);
162 replaceAll(name,tilde,home);
164 FILE *f = fopen(name.c_str(),
"r");
168 std::cerr <<
"gmad_parser> Can't open input file " << name << std::endl;
172 yyfilename = std::string(name);
176 std::cout.precision(10);
186 std::cout <<
"gmad_parser> beginning to parse file" << std::endl;
194 std::cout <<
"gmad_parser> finished to parsing file" << std::endl;
198 std::cout <<
"gmad_parser> clearing temporary lists" << std::endl;
207 std::cout <<
"gmad_parser> finished" << std::endl;
215 const int reserved = 1;
228 add_var(
"pi", 4.0*std::atan(1),reserved);
229 add_var(
"twopi", 8.0*std::atan(1),reserved);
230 add_var(
"halfpi", 2.0*std::atan(1),reserved);
232 add_var(
"PeV",1e6, reserved);
233 add_var(
"TeV",1e3, reserved);
234 add_var(
"GeV",1.0 ,reserved);
235 add_var(
"MeV",1e-3,reserved);
236 add_var(
"keV",1e-6,reserved);
237 add_var(
"KeV",1e-6,reserved);
238 add_var(
"eV" ,1e-9,reserved);
240 add_var(
"PJ", 1e12, reserved);
241 add_var(
"GJ", 1e9, reserved);
242 add_var(
"MJ", 1e6, reserved);
243 add_var(
"kJ", 1e3, reserved);
244 add_var(
"J", 1, reserved);
245 add_var(
"mJ", 1e-3, reserved);
246 add_var(
"uJ", 1e-6, reserved);
247 add_var(
"nJ", 1e-9, reserved);
248 add_var(
"pJ", 1e-12, reserved);
250 add_var(
"mV",1e-3,reserved);
251 add_var(
"V" ,1.0, reserved);
252 add_var(
"kV",1e+3,reserved);
253 add_var(
"MV",1e+6,reserved);
254 add_var(
"GV",1e+9,reserved);
256 add_var(
"Tesla",1.0,reserved);
257 add_var(
"T", 1.0,reserved);
259 add_var(
"km" ,1e3 ,reserved);
260 add_var(
"m" ,1.0 ,reserved);
261 add_var(
"cm" ,1e-2,reserved);
262 add_var(
"mm" ,1e-3,reserved);
263 add_var(
"um" ,1e-6,reserved);
264 add_var(
"mum",1e-6,reserved);
265 add_var(
"nm" ,1e-9,reserved);
266 add_var(
"ang",1e-10,reserved);
267 add_var(
"pm" ,1e-12,reserved);
269 add_var(
"s" ,1.0 ,reserved);
270 add_var(
"ms" ,1.e-3,reserved);
271 add_var(
"us" ,1.e-6,reserved);
272 add_var(
"ns" ,1.e-9,reserved);
273 add_var(
"ps" ,1.e-12,reserved);
275 add_var(
"Hz" ,1.0, reserved);
276 add_var(
"kHz",1e+3, reserved);
277 add_var(
"MHz",1e+6, reserved);
278 add_var(
"GHz",1e+9, reserved);
279 add_var(
"THz",1e+12,reserved);
281 add_var(
"rad" ,1.0, reserved);
282 add_var(
"mrad",1e-3,reserved);
283 add_var(
"urad",1e-6,reserved);
284 add_var(
"nrad",1e-9,reserved);
286 add_var(
"degrees",std::atan(1)/45,reserved);
288 add_var(
"clight",2.99792458e+8,reserved);
290 add_var(
"kg_per_cubic_m", 1e-3, reserved);
291 add_var(
"g_per_cubic_m", 1e-6, reserved);
292 add_var(
"g_per_cubic_cm", 1, reserved);
294 add_var(
"pascal", 1/101324.99987983676, reserved);
295 add_var(
"bar", 1/1.0132499987983676, reserved);
296 add_var(
"torr", 0.00131579, reserved);
297 add_var(
"atmosphere", 1, reserved);
304 std::cout <<
"parsing complete..." << std::endl;
336 const std::string& start,
337 const std::string& end)
343 const std::string& name,
344 const std::string& start,
345 const std::string& end)
348 if(line.
type != ElementType::_LINE && line.
type != ElementType::_REV_LINE )
350 std::cerr <<
"Error with use command: \"" << name <<
"\" is not a line" << std::endl;
367 std::cout <<
"expanding line " << name <<
", range = " << start << end << std::endl;
373 std::list<Element>::iterator sit = line.
lst->begin();
374 std::list<Element>::iterator eit = line.
lst->end();
379 case ElementType::_LINE:
380 {target.
insert(target.
end(),sit,eit);
break;}
381 case ElementType::_REV_LINE:
382 {target.
insert(target.
end(),line.
lst->rbegin(),line.
lst->rend());
break;}
384 {target.
insert(target.
end(),sit,eit);
break;}
387 bool is_expanded =
false;
395 std::list<Element>::iterator it = ++target.
begin();
396 for (; it!=target.
end(); ++it)
401 std::cout << element.name <<
" , " << type << std::endl;
404 if (type != ElementType::_LINE && type != ElementType::_REV_LINE)
408 std::list<Element>::const_iterator tmpit =
element_list.find(element.name);
409 std::list<Element>::const_iterator iterEnd =
element_list.end();
410 if ( (tmpit != iterEnd) && ( (*tmpit).lst !=
nullptr) )
414 std::cout <<
"inserting sequence for " << element.name <<
" - " << list.name <<
" ...";
416 if (type == ElementType::_LINE)
418 else if (type == ElementType::_REV_LINE)
421 std::list<Element> tmpList;
422 tmpList.insert(tmpList.end(),list.
lst->begin(),list.
lst->end());
423 for (std::list<Element>::iterator itLineInverter = tmpList.begin();
424 itLineInverter != tmpList.end(); ++itLineInverter)
426 if ( (*itLineInverter).type == ElementType::_LINE)
427 {(*itLineInverter).type = ElementType::_REV_LINE;}
428 else if ((*itLineInverter).type == ElementType::_REV_LINE)
429 {(*itLineInverter).type = ElementType::_LINE;}
431 target.
insert(it,tmpList.rbegin(),tmpList.rend());
434 std::cout <<
"inserted" << std::endl;
439 else if ( tmpit != iterEnd )
443 std::cout <<
"keeping element..." << element.name << std::endl;
449 std::cout <<
"done" << std::endl;
454 std::cerr <<
"Error : Expanding line \"" << name <<
"\" : element \"" << element.name
455 <<
"\" has not been defined! " << std::endl;
462 std::cerr <<
"Error : Line expansion of '" << name <<
"' seems to loop, " << std::endl
463 <<
"possible recursive line definition, quitting" << std::endl;
474 std::list<Element>::const_iterator startIt = target.
find(std::string(start));
476 if(startIt!=target.
end())
482 std::list<Element>::const_iterator endIt = target.
find(std::string(end));
484 if(endIt!=target.
end())
485 {target.
erase(++endIt,target.
end());}
490 std::list<Element>::iterator itTunnel =
element_list.find(
"tunnel");
500 {
return *(search->second);}
502 {std::cerr <<
"parser> no such sequence \"" << name <<
"\"" << std::endl; exit(1);}
508 const std::string& samplerType,
509 double samplerRadius,
519 if((*it).type == ElementType::_LINE || (*it).type == ElementType::_REV_LINE)
522 if (type != ElementType::_NONE && type != (*it).type)
525 (*it).setSamplerInfo(samplerType,(*it).name,samplerRadius,particleSetID);
528 else if (count == -1)
531 if (itPair.first == itPair.second)
533 std::string msg =
"parser> SetSampler> current beamline doesn't contain element \"" + name +
"\"";
534 yyerror2(msg.c_str());
536 for (
auto it = itPair.first; it != itPair.second; ++it)
539 auto elementIt = (it->second);
540 std::string samplerName = elementIt->name;
541 if ((*elementIt).type == ElementType::_MARKER)
545 while ((*elementIt).isSpecial())
555 std::cout <<
"parser> SetSampler> WARNING: no element before marker " << name <<
", no sampler added" << std::endl;
559 (*elementIt).setSamplerInfo(samplerType,samplerName,samplerRadius,particleSetID);
567 std::string msg =
"parser> SetSampler> current beamline doesn't contain element \"" + name +
"\" with number " + std::to_string(count);
568 yyerror2(msg.c_str());
571 std::string samplerName = (*it).name;
572 if ((*it).type == ElementType::_MARKER)
576 while ((*it).isSpecial())
581 std::cout <<
"parser> SetSampler> WARNING: no element before marker " << name <<
", no sampler added" << std::endl;
586 (*it).setSamplerInfo(samplerType,samplerName,samplerRadius,particleSetID);
592 if (!samplerPartIDListIn)
594 std::set<int> partIDs = std::set<int>(std::begin(*samplerPartIDListIn), std::end(*samplerPartIDListIn));
596 if (alreadyExists > 0)
597 {
return setToSamplerFilterID[partIDs];}
600 int particleSetID = (int) samplerFilterIDToSet.size();
601 samplerFilterIDToSet[particleSetID] = partIDs;
602 setToSamplerFilterID[partIDs] = particleSetID;
604 return particleSetID;
611 std::cout <<
"inserting sampler " << name;
613 {std::cout <<
"[" << count <<
"]";}
614 std::cout << std::endl;
617 set_sampler(name,count,type,samplerType,0,particleSetID);
622 std::list<Element>::iterator it =
element_list.find(element_name);
623 std::list<Element>::const_iterator iterEnd =
element_list.end();
627 std::cerr <<
"parser.h> Error: element (type) \"" << element_name
628 <<
"\" has not been defined." << std::endl;
639 std::cerr <<
"parser.h> Error: unknown element \"" << element_name <<
"\"." << std::endl;
647 const Element* result =
nullptr;
659 const Element* result =
nullptr;
678 std::cout <<
"matched sequence element, " << name;
680 {std::cout <<
" * " << number;}
681 std::cout << std::endl;
690 for (
int i = 0; i < number; i++)
695 for (
int i = 0; i < number; i++)
704 std::cout <<
"newinstance : VARIABLE -- " << elementName << std::endl;
709 type =
static_cast<int>(element.
type);
721void Parser::add_var(std::string name,
double value,
int is_reserved)
724 sp->
Set(value,is_reserved);
727bool Parser::InvalidSymbolName(
const std::string& s, std::string& errorReason)
731 {result =
true; errorReason =
"The variable name \"" + s +
"\" is an option name and cannot be used as a variable name";}
779 bool extended =
false;
797 if ( (extended = FindAndExtend<Atom> (objectName)) ) {}
798 else if ( (extended = FindAndExtend<NewColour> (objectName)) ) {}
799 else if ( (extended = FindAndExtend<Crystal> (objectName)) ) {}
800 else if ( (extended = FindAndExtend<CoolingChannel> (objectName)) ) {}
801 else if ( (extended = FindAndExtend<Field> (objectName)) ) {}
802 else if ( (extended = FindAndExtend<Material> (objectName)) ) {}
803 else if ( (extended = FindAndExtend<Placement> (objectName)) ) {}
804 else if ( (extended = FindAndExtend<Query> (objectName)) ) {}
805 else if ( (extended = FindAndExtend<Region> (objectName)) ) {}
806 else if ( (extended = FindAndExtend<Tunnel> (objectName)) ) {}
807 else if ( (extended = FindAndExtend<CavityModel>(objectName)) ) {}
808 else if ( (extended = FindAndExtend<SamplerPlacement>(objectName)) ) {}
809 else if ( (extended = FindAndExtend<Scorer> (objectName)) ) {}
810 else if ( (extended = FindAndExtend<ScorerMesh> (objectName)) ) {}
811 else if ( (extended = FindAndExtend<Aperture> (objectName)) ) {}
812 else if ( (extended = FindAndExtend<BLMPlacement> (objectName)) ) {}
813 else if ( (extended = FindAndExtend<Modulator> (objectName)) ) {}
814 else if ( (extended = FindAndExtend<Laser> (objectName)) ) {}
819 std::cerr <<
"parser.h> Error: object \"" << objectName
820 <<
"\" has not been defined and can't be extended." << std::endl;
834 auto search = fl.
find(objectName);
835 if (search != fl.
end())
847 {
object.set_value(option.first, option.second);}
849 {
object.set_value(option.first, option.second);}
851 {
object.set_value(option.first, option.second);}
881 const std::string& on = objectName;
884 auto searchAtom = std::find_if(
atom_list.begin(),
atom_list.end(), [&on](
const Atom& obj) {return obj.name == on;});
886 {searchAtom->print();
return true;}
889 {searchNewColour->print();
return true;}
892 {searchCrystal->print();
return true;}
895 {searchCoolingChannel->print();
return true;}
898 {searchField->print();
return true;}
901 {searchLaser->print();
return true;}
904 {searchMaterial->print();
return true;}
907 {searchQuery->print();
return true;}
910 {searchRegion->print();
return true;}
913 {searchTunnel->print();
return true;}
916 {searchXsecbias->print();
return true;}
919 {searchPlacement->print();
return true;}
922 {searchCavityModel->print();
return true;}
925 {searchSamplerPlacement->print();
return true;}
928 {searchScorer->print();
return true;}
931 {searchScorerMesh->print();
return true;}
934 {searchAperture->print();
return true;}
936 if (searchBLMPlacement !=
blm_list.end())
937 {searchBLMPlacement->print();
return true;}
940 {searchModulator->print();
return true;}
959 template<>
Atom* Parser::GetGlobalPtr(){
return &
atom;}
963 template<>
Beam* Parser::GetGlobalPtr(){
return &
beam;}
986 template<>
Field* Parser::GetGlobalPtr(){
return &
field;}
995 template<>
Laser* Parser::GetGlobalPtr(){
return &
laser;}
1010 template<>
FastList<PhysicsBiasing>& Parser::GetList<PhysicsBiasing, FastList<PhysicsBiasing>>(){
return xsecbias_list;}
1017 template<>
Query* Parser::GetGlobalPtr(){
return &
query;}
1021 template<>
Region* Parser::GetGlobalPtr(){
return &
region;}
1029 template<>
Scorer* Parser::GetGlobalPtr(){
return &
scorer;}
1037 template<>
Tunnel* Parser::GetGlobalPtr(){
return &
tunnel;}
1053 template <
class C,
class Container>
1057 C& global = GetGlobal<C>();
1064 GetList<C, Container>().push_back(inst);
1067 template <
class C,
class Container>
1068 void Parser::Add(
bool unique,
const std::string& className)
1071 C& global = GetGlobal<C>();
1078 GetList<C, Container>().push_back(inst, unique, className);
1088 void Parser::Add<Placement, FastList<Placement>>(
bool unique,
const std::string& className)
1091 Placement& global = GetGlobal<Placement>();
1098 GetList<Placement, FastList<Placement>>().push_back(inst, unique, className);
1105 std::cerr <<
"The bdsimElement referred to in \"" << inst.
name <<
"\" (\""
1106 << inst.
bdsimElement <<
"\") cannot be found and should be defined"
1107 <<
" before this placement" << std::endl;
1110 placement_elements.push_back(
Element(*elDef));
Representation of arrays used in tokens.
void Copy(Container< std::string, std::allocator< std::string > > &cpy)
Copy STL string containers into symbols.
RF CavityModel class for parser.
Cooling channel parameters.
Crystal class for parser.
List with Efficient Lookup.
FastListIterator insert(FastListInputIterator position, const T &val)
template definitions need to be in header
void erase()
erase elements
void push_back(const T &el, bool unique=false, const std::string &objectName="element")
FastListConstIterator find(std::string name, unsigned int count=1) const
Placement class for laser.
Modulator class for parser.
Colour definition for parser.
void print() const
print some properties
void Overwrite(const std::string &objectName)
Overwrite object with current values.
FastList< Atom > atom_list
List of parser defined instances of that object.
void Add()
Insert global object of parser class C in Container class.
Parser()
Default contructor.
std::vector< std::list< Element > * > allocated_lines
double property_lookup(const std::string &element_name, const std::string &property_name) const
access property of Element with element_name
FastList< BLMPlacement > blm_list
List of parser defined instances of that object.
std::vector< std::string > sequences
Names of all defined sequences in the parser with 'line'.
const int MAX_EXPAND_ITERATIONS
maximum number of nested lines
Laser laser
The one instance we fill before appending to a list.
Scorer scorer
The one instance we fill before appending to a list.
void ExtendValue(const std::string &property, T value)
Add value to be extended to object.
void ExtendObject(C &object)
Extend object with maps.
FastList< Crystal > crystal_list
List of parser defined instances of that object.
FastList< Placement > placement_list
List of parser defined instances of that object.
Material material
The one instance we fill before appending to a list.
virtual ~Parser()
Destructor.
Atom atom
The one instance we fill before appending to a list.
Symtab * symlook(const std::string &s)
look up parser symbol
static Parser * Instance()
Access method.
std::map< std::string, FastList< Element > * > expandedSequences
Cached copy of expanded sequences.
FastList< Region > region_list
List of parser defined instances of that object.
FastList< Modulator > modulator_list
List of parser defined instances of that object.
FastList< NewColour > colour_list
List of parser defined instances of that object.
Parameters params
The one instance we fill before appending to a list.
int add_sampler_partIDSet(std::list< int > *samplerPartIDListIn)
FastList< Scorer > scorer_list
List of parser defined instances of that object.
FastList< Tunnel > tunnel_list
List of parser defined instances of that object.
FastList< Element > element_list
List of all encountered elements.
CoolingChannel coolingchannel
The one instance we fill before appending to a list.
void add_sampler(const std::string &name, int count, ElementType type, std::string samplerType, std::list< int > *samplerPartIDListIn=nullptr)
insert a sampler into beamline_list
C & GetGlobal()
Get global object of parser class C.
int copy_element_to_params(const std::string &elementName)
copy properties from Element into params, returns element type as integer, returs _NONE if not found
Crystal crystal
The one instance we fill before appending to a list.
bool TryPrintingObject(const std::string &objectName) const
Options options
General options.
Element & find_element(const std::string &element_name)
find element
FastList< Aperture > aperture_list
List of parser defined instances of that object.
Modulator modulator
The one instance we fill before appending to a list.
FastList< CoolingChannel > coolingchannel_list
List of parser defined instances of that object.
Tunnel tunnel
The one instance we fill before appending to a list.
void expand_line(FastList< Element > &target, const std::string &name, const std::string &start="", const std::string &end="")
FastList< PhysicsBiasing > xsecbias_list
List of parser defined instances of that object.
void write_table(std::string *name, ElementType type, bool isLine=false)
Method that transfers parameters to element properties.
FastList< ScorerMesh > scorermesh_list
List of parser defined instances of that object.
const Element * find_placement_element_safe(const std::string &element_name) const
search placement_element
void PrintElements() const
Print methods.
FastList< Element > placement_elements
std::vector< std::string * > var_list
Variable vector for memory storage.
FastList< Element > beamline_list
Beamline.
void add_element_temp(const std::string &name, int number, bool pushfront, ElementType linetype)
add element to temporary element sequence tmp_list
std::set< std::set< int > > samplerFilters
FastList< SamplerPlacement > samplerplacement_list
List of parser defined instances of that object.
Field field
The one instance we fill before appending to a list.
std::list< Element > tmp_list
Temporary list.
Query query
The one instance we fill before appending to a list.
Aperture aperture
The one instance we fill before appending to a list.
void AddVariable(std::string *name)
Add variable memory to variable list for memory management.
BLMPlacement blm
The one instance we fill before appending to a list.
std::map< std::string, std::string > extendedStrings
Map for options of type string for extending objects.
Region region
The one instance we fill before appending to a list.
void ParseFile(FILE *f)
Parse the input file and construct beamline_list and options.
bool FindAndExtend(const std::string &objectName)
Laser instance.
SymbolMap symtab_map
Parser symbol map.
void PrintBeamline() const
Print methods.
const FastList< Element > & get_sequence(const std::string &name)
std::map< std::string, Array * > extendedVectors
Map for options of type vector for extending objects.
void set_sampler(const std::string &name, int count, ElementType type, const std::string &samplerType, double samplerRadius=0, int particleSetID=-1)
Set sampler.
Symtab * symcreate(const std::string &s)
create new parser symbol
NewColour colour
The one instance we fill before appending to a list.
ScorerMesh scorermesh
The one instance we fill before appending to a list.
const FastList< Element > & GetBeamline() const
void PrintOptions() const
Print methods.
FastList< Field > field_list
List of parser defined instances of that object.
FastList< CavityModel > cavitymodel_list
List of parser defined instances of that object.
std::map< std::string, double > extendedNumbers
Map for options of type double for extending objects.
Placement placement
The one instance we fill before appending to a list.
std::list< double > tmparray
temporary list for reading of arrays in parser
CavityModel cavitymodel
The one instance we fill before appending to a list.
FastList< Query > query_list
List of parser defined instances of that object.
void Store(double value)
Add value to front of temporary list.
static Parser * instance
Instance.
PhysicsBiasing xsecbias
The one instance we fill before appending to a list.
FastList< Laser > laser_list
List of parser defined instances of that object.
void add_func(std::string name, double(*func)(double))
Add function to parser.
void Initialise()
Initialisation of parser functions and constants.
FastList< Material > material_list
List of parser defined instances of that object.
const Element * find_element_safe(const std::string &element_name) const
find element by pointer - nullptr if not found - searches element_list
void expand_sequences()
Expand all sequences define with 'line' into FastLists.
std::list< std::string > tmpstring
temporary list for reading of arrays in parser
SamplerPlacement samplerplacement
The one instance we fill before appending to a list.
Physics biasing class for parser.
Placement class for parser.
std::string name
Name of this placement.
void print() const
print some properties
std::string bdsimElement
Name of bdsim-built component to place instead of piece of geometry.
Query structure class for parser.
Sampler placement class for parser.
ScorerMesh class for parser.
void clear()
Destructor that clears memory.
Symtab * symlook(std::string s)
Look up parser symbol.
Symtab * symcreate(std::string s)
Create new parser symbol.
Common header for the lexer and the parser to share Symbol table for numeric variables,...
void Set(Array *)
Set to Array value.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
ElementType
types of elements
double property_lookup(std::string property_name) const
void set(const Parameters ¶ms)
set method from Parameters structure
std::list< Element > * lst
in case the element is a list itself (line)
ElementType type
element enum
Parameters - Element class with booleans.
void inherit_properties(const Element &e)
void flush()
Reset the parameters to defaults and setMap.