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());
85 const double z =
R(2);
111 double frac = -
R(2) / P(2) * recpgamma;
181 std::ofstream omsg(
"errormsg.txt", std::ios_base::app);
217 "Couldn't parse input file");
221 if (
holes_m.size() == 0)
return;
223 for (std::shared_ptr<mslang::Base> & it:
holes_m) {
224 it->computeBoundingBox();
227 std::shared_ptr<mslang::Base> &first =
holes_m.front();
237 for (
const std::shared_ptr<mslang::Base> & it:
holes_m) {
245 double width = urc[0] - llc[0];
246 double height = urc[1] - llc[1];
248 llc[0] -= 1
e-3 * width;
249 urc[0] += 1
e-3 * width;
250 llc[1] -= 1
e-3 * height;
251 urc[1] += 1
e-3 * height;
269 std::ofstream out(fname +
"_quadtree.gpl");
273 out.open(fname +
"_holes.gpl");
274 for (
const std::shared_ptr<mslang::Base> &obj:
holes_m) {
275 obj->writeGnuplot(out);
Tps< T > sqrt(const Tps< T > &x)
Square root.
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
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)
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
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 ElementBase::ElementType getType() const override
Get element type std::string.
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
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 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)
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
virtual void apply(std::vector< std::shared_ptr< Base >> &bfuncs)=0