49 for (
const std::shared_ptr<mslang::Base>& obj: right.
holes_m) {
50 holes_m.emplace_back(obj->clone());
83 const double z = R(2);
91 if (!
bb_m.isInside(R)) {
112 double frac = -R(2) / singleStep(2);
114 R + frac * singleStep, P,
178 std::ofstream omsg(
"errormsg.txt", std::ios_base::app);
179 omsg << errormsg << std::endl;
214 "Couldn't parse input file");
218 if (
holes_m.size() == 0)
return;
220 for (std::shared_ptr<mslang::Base>& it:
holes_m) {
221 it->computeBoundingBox();
224 std::shared_ptr<mslang::Base>& first =
holes_m.front();
234 for (
const std::shared_ptr<mslang::Base>& it:
holes_m) {
242 double width = urc[0] - llc[0];
243 double height = urc[1] - llc[1];
245 llc[0] -= 1e-3 * width;
246 urc[0] += 1e-3 * width;
247 llc[1] -= 1e-3 * height;
248 urc[1] += 1e-3 * height;
266 std::ofstream out(fname +
"_quadtree.gpl");
270 out.open(fname +
"_holes.gpl");
271 for (
const std::shared_ptr<mslang::Base> &obj:
holes_m) {
272 obj->writeGnuplot(out);
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
constexpr double c
The velocity of light in m/s.
bool parse(std::string str, Function *&fun)
std::string combineFilePath(std::initializer_list< std::string > ilist)
Vector_t getBeta(Vector_t p)
static OpalData * getInstance()
std::string getAuxiliaryOutputDirectory() const
get the name of the the additional data directory
virtual void visitFlexibleCollimator(const FlexibleCollimator &)=0
Apply the algorithm to a flexible collimator.
Component(const std::string &name)
Constructor with given name.
PartBunchBase< double, 3 > * RefPartBunch_m
virtual const std::string & getName() const
Get element name.
virtual ParticleMatterInteractionHandler * getParticleMatterInteraction() const
bool getFlagDeleteOnTransverseExit() const
virtual double getElementLength() const
Get design length.
bool isInsideTransverse(const Vector_t &r) const
std::string getOutputFN() const
Get output filename.
std::unique_ptr< LossDataSink > lossDs_m
bool isStopped(const Vector_t &R)
std::vector< std::shared_ptr< mslang::Base > > holes_m
std::string description_m
virtual ~FlexibleCollimator()
ParticleMatterInteractionHandler * parmatint_m
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
virtual bool checkCollimator(PartBunchBase< double, 3 > *bunch, const int turnnumber, const double t, const double tstep)
virtual void finalise() override
mslang::BoundingBox2D bb_m
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
void setDescription(const std::string &desc)
virtual void goOffline() override
virtual ElementType getType() const override
Get element type std::string.
virtual void goOnline(const double &kineticEnergy) override
virtual void accept(BeamlineVisitor &) const override
Apply visitor to FlexibleCollimator.
void writeHolesAndQuadtree(const std::string &baseFilename) const
virtual void getDimensions(double &zBegin, double &zEnd) const override
FlexibleCollimator(const std::string &name)
Constructor with given name.
static std::string typeset_msg(const std::string &msg, const std::string &title)
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)=0
Vektor< double, 3 > Vector_t