41 description_m(right.description_m),
44 informed_m(right.informed_m),
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);
112 double frac = -
R(2) / singleStep(2);
114 R + frac * singleStep, P,
178 std::ofstream omsg(
"errormsg.txt", std::ios_base::app);
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] -= 1
e-3 * width;
246 urc[0] += 1
e-3 * width;
247 llc[1] -= 1
e-3 * height;
248 urc[1] += 1
e-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);
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
constexpr double e
The value of.
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)
ParticleAttrib< double > M
ParticleAttrib< Vector_t > P
ParticleAttrib< double > Q
ParticleAttrib< double > dt
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.
Interface for a single beam element.
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
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
static std::string typeset_msg(const std::string &msg, const std::string &title)
virtual void apply(std::vector< std::shared_ptr< Base > > &bfuncs)=0
bool isInside(const Vector_t &X) const
void writeGnuplot(std::ostream &out) const
bool isInside(const Vector_t &R) const
std::list< std::shared_ptr< Base > > objects_m