40 componentsFractions.clear();
41 componentsWeights.clear();
53 publish(
"components" ,&Material::components);
54 publish(
"componentsWeights" ,&Material::componentsWeights);
55 publish(
"componentsFractions",&Material::componentsFractions);
60 std::cout <<
"material: " <<
name <<
" ";
62 if (components.empty()) {
63 std::cout <<
"A= " <<
A <<
"g/mole "
66 std::cout <<
"ncomponents= " << components.size() <<
" ";
68 std::cout <<
"density= " <<
density <<
"g/cm3 "
69 <<
"state= " <<
state <<
" "
79 std::cout <<
"parser> Setting value " << std::setw(25) << std::left <<
property << std::endl;
81 if(property==
"components")
85 else if(property==
"componentsWeights")
89 else if(property==
"componentsFractions")
95 std::cerr <<
"Error: parser> unknown material option \"" <<
property <<
"\", or doesn't expect vector type" << std::endl;
99 {std::rethrow_exception(std::current_exception());}
103#if __cplusplus >= 201703L
105 std::list<std::variant<bool, int, double, std::string>> retval(components.size());
107 if(property==
"components")
109 std::copy(components.begin(),components.end(), retval.begin());
111 else if(property==
"componentsWeights")
113 std::copy(componentsWeights.begin(),componentsWeights.end(), retval.begin());
115 else if(property==
"componentsFractions")
117 std::copy(componentsFractions.begin(),componentsFractions.end(), retval.begin());
121 std::cerr <<
"Error: parser> unknown material option \"" <<
property <<
"\", or doesn't expect vector type" << std::endl;
Representation of arrays used in tokens.
void set_vector(Container< std::string, std::allocator< std::string > > &dst) const
Copy symbols into STL string containers.
void publish(const std::string &name, T C::*mp)
Make pointer to member from class C and type T with accessible with a name.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
std::string state
"solid", "liquid", or "gas"
std::list< std::variant< bool, int, double, std::string > > get_value_array(const std::string &)
Get method for lists.
void set_value(const std::string &property, T value, bool bExit=true)
set methods by property name and value
void PublishMembers()
publish members so these can be looked up from parser
void print() const
printout