24 #include <boost/regex.hpp>
28 "The \"FLEXIBLECOLLIMATOR\" element defines a flexible collimator."),
29 parmatint_m(nullptr) {
31 (
"FNAME",
"File name containing description of holes");
33 (
"DESCRIPTION",
"String describing the distribution of holes");
35 (
"DUMP",
"Save quadtree and holes of collimator",
false);
44 parmatint_m(nullptr) {
72 std::ifstream
it(fname);
73 std::string str((std::istreambuf_iterator<char>(it)),
74 std::istreambuf_iterator<char>());
76 str = boost::regex_replace(str, boost::regex(
"//.*?\\n"), std::string(
""), boost::match_default | boost::format_all);
77 str = boost::regex_replace(str, boost::regex(
"\\s"), std::string(
""), boost::match_default | boost::format_all);
80 }
else if (!desc.empty()) {
81 desc = boost::regex_replace(desc, boost::regex(
"[\\t ]"), std::string(
""), boost::match_default | boost::format_all);
85 "A description for the holes has to be provided, either using DESCRIPTION or FNAME");
ParticleMatterInteraction * parmatint_m
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
std::string getString(const Attribute &attr)
Get string value.
virtual void setParticleMatterInteraction(ParticleMatterInteractionHandler *spys)
static ParticleMatterInteraction * find(const std::string &name)
Find named PARTICLEMATTERINTERACTION.
virtual ~OpalFlexibleCollimator()
virtual void update()
Update the embedded CLASSIC collimator.
void setElement(ElementBase *)
Assign new CLASSIC element.
bool getBool(const Attribute &attr)
Return logical value.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
The base class for all OPAL exceptions.
void setOutputFN(std::string fn)
Set output filename.
void initParticleMatterInteractionHandler(ElementBase &element)
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
ElementBase * getElement() const
Return the embedded CLASSIC element.
void setDescription(const std::string &desc)
const std::string & getOpalName() const
Return object name.
std::vector< Attribute > itsAttr
The object attributes.
double getReal(const Attribute &attr)
Return real value.
ParticleMatterInteractionHandler * handler_m
virtual ParticleMatterInteraction * clone(const std::string &name)
Make clone.
virtual void setElementLength(double length)
Set design length.
virtual OpalFlexibleCollimator * clone(const std::string &name)
Make clone.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
OpalFlexibleCollimator()
Exemplar constructor.
virtual void update()
Update the embedded CLASSIC element.
void registerOwnership() const
void writeHolesAndQuadtree(const std::string &baseFilename) const