38 filename_m(right.filename_m),
39 fieldmap_m(right.fieldmap_m),
40 scale_m(right.scale_m),
41 scaleError_m(right.scaleError_m),
42 startField_m(right.startField_m),
43 endField_m(right.endField_m),
44 fast_m(right.fast_m) {}
68 Inform m(
"Solenoid::apply");
69 m << level5 <<
"Solenoid::apply() called." << endl;
88 std::shared_ptr<ParticleContainer_t> pc =
RefPartBunch_m->getParticleContainer();
89 auto Rview = pc->
R.getView();
90 auto Pview = pc->P.getView();
94 return apply(R, P, t, E, B);
143 if (outOfBounds)
return true;
170 Inform msg(
"Solenoid ", *
gmsg);
177 msg << level2 <<
getName() <<
" using file ";
180 double zBegin = 0.0, zEnd = 0.0;
186 const double bodyBegin = startField;
192 endField = startField;
250 if (aperture.second.size() >= 2 && std::abs(aperture.second[0]) < 1e5
251 && std::abs(aperture.second[1]) < 1e5) {
252 horizontalRadius = std::abs(aperture.second[0]);
253 verticalRadius = std::abs(aperture.second[1]);
254 return horizontalRadius > 0.0 && verticalRadius > 0.0;
262 double xIni = 0.0, xFinal = 0.0, yIni = 0.0, yFinal = 0.0, zIni = 0.0, zFinal = 0.0;
264 horizontalRadius = 0.5 * std::abs(xFinal - xIni);
265 verticalRadius = 0.5 * std::abs(yFinal - yIni);
266 return horizontalRadius > 0.0 && verticalRadius > 0.0;
ippl::Vector< T, Dim > Vector_t
Template PIC bunch: IPPL PicManager, shared field mesh/solver, and multiple particle containers.
virtual void visitSolenoid(const Solenoid &)=0
Apply the algorithm to a Solenoid element.
PartBunch_t * RefPartBunch_m
virtual const std::string & getName() const
Get element name.
bool getFlagDeleteOnTransverseExit() const
virtual double getElementLength() const
Get design length.
std::pair< ApertureType, std::vector< double > > getAperture() const
bool isInsideTransverse(const Vector_t< double, 3 > &r) const
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const =0
Get the field strength at a given point.
virtual void getInfo(Inform *msg)=0
Print info about the field map.
virtual void getFieldDimensions(double &zBegin, double &zEnd) const =0
Get the longitudinal dimensions of the field.
virtual void applyField(std::shared_ptr< ParticleContainer_t > pc, double scale=1.0)=0
Apply the FM to all the particles.
virtual bool isInside(const Vector_t< double, 3 > &) const =0
Check if a point is inside the field map.
Vector_t< double, Dim > R(size_t)
Do not use; throws (access positions via ParticleContainer::R).
Abstract class for a solenoid magnet.
double scaleError_m
Scale error multiplier.
void setFast(bool fast)
Set the fast flag.
double endField_m
End point of the field support in the local chart.
virtual void initialise(PartBunch_t *bunch, double &startField, double &endField) override
initialise the solenoid element
virtual void getElementDimensions(double &zBegin, double &zEnd) const override
Return the nominal body extent of the solenoid.
virtual void getFieldExtend(double &zBegin, double &zEnd) const override
Return the local field-support interval of the solenoid.
double startField_m
Starting point of the field.
virtual void goOffline() override
Free field map and go offline.
virtual void goOnline(const double &kineticEnergy) override
Load field map and go online.
virtual void finalise() override
bool fast_m
Fast tracking flag.
bool getFast() const
Get the fast flag.
virtual bool bends() const override
void setDKS(double ks)
Set the strength scaling error dks.
Fieldmap * fieldmap_m
Fieldmap pointer.
virtual ElementType getType() const override
Get the element type.
std::string filename_m
Name of the field map file.
virtual bool isInside(const Vector_t< double, 3 > &r) const override
Check if position r is inside the field map.
bool getSupportEnvelope(double &horizontalRadius, double &verticalRadius) const
Get a finite transverse support envelope for placement/export.
virtual bool applyToReferenceParticle(const Vector_t< double, 3 > &R, const Vector_t< double, 3 > &P, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) override
Apply to reference particle with position R and momemtum P.
void setKS(double ks)
Set the strength scaling factor ks.
virtual bool apply(const std::shared_ptr< ParticleContainer_t > &pc) override
apply the solenoid field to all particles in the bunch
void setFieldMapFN(std::string fn)
Assign the field filename.
virtual void accept(BeamlineVisitor &) const override
Apply visitor to Solenoid.
double scale_m
Scale multiplier.