Commit 61691d0f authored by frey_m's avatar frey_m
Browse files

Revert "start adding Undulator"

This reverts commit 5fbd4c4b.
parent 5fbd4c4b
......@@ -19,8 +19,6 @@
#include "Algorithms/ParallelTTracker.h"
#include "mithra/fieldvector.hh"
#include <cfloat>
#include <iostream>
#include <fstream>
......@@ -1466,4 +1464,4 @@ void ParallelTTracker::evenlyDistributeParticles() {
// mode:c++
// c-basic-offset: 4
// indent-tabs-mode:nil
// End:
// End:
\ No newline at end of file
......@@ -36,7 +36,6 @@
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Drift.h"
#include "AbsBeamline/Undulator.h"
#include "AbsBeamline/FlexibleCollimator.h"
#include "AbsBeamline/ElementBase.h"
#include "AbsBeamline/Lambertson.h"
......@@ -123,9 +122,6 @@ public:
/// Apply the algorithm to a Drift.
virtual void visitDrift(const Drift &);
/// Apply the algorithm to a Undulator.
virtual void visitUndulator(const Undulator &);
/// Apply the algorithm to a flexible collimator
virtual void visitFlexibleCollimator(const FlexibleCollimator &);
......@@ -360,10 +356,6 @@ inline void ParallelTTracker::visitDiagnostic(const Diagnostic &diag) {
}
inline void ParallelTTracker::visitUndulator(const Undulator &u) {
itsOpalBeamline_m.visit(u, *this, itsBunch_m);
}
inline void ParallelTTracker::visitDrift(const Drift &drift) {
itsOpalBeamline_m.visit(drift, *this, itsBunch_m);
}
......
......@@ -43,7 +43,6 @@ class CyclotronValley;
class Degrader;
class Diagnostic;
class Drift;
class Undulator;
class FlexibleCollimator;
class Lambertson;
class Marker;
......@@ -131,9 +130,6 @@ public:
/// Apply the algorithm to a drift space.
virtual void visitDrift(const Drift &) = 0;
/// Apply the algorithm to a undulator space.
virtual void visitUndulator(const Undulator &) = 0;
/// Apply the algorithm to a flexible collimator
virtual void visitFlexibleCollimator(const FlexibleCollimator &) = 0;
......
......@@ -16,7 +16,6 @@ set (_SRCS
Degrader.cpp
Diagnostic.cpp
Drift.cpp
Undulator.cpp
ElementBase.cpp
ElementImage.cpp
FlexibleCollimator.cpp
......@@ -74,7 +73,6 @@ set (HDRS
Degrader.h
Diagnostic.h
Drift.h
Undulator.h
ElementBase.h
ElementImage.h
FlexibleCollimator.h
......
......@@ -42,7 +42,6 @@ class ElementImage;
enum ElemType {
isDrift,
isUndulator,
isSolenoid,
isSource,
isRF,
......@@ -161,8 +160,7 @@ public:
, CYCLOTRONVALLEY
, DEGRADER
, DIAGNOSTIC
, DRIFT
, UNDULATOR
, DRIFT
, FLEXIBLECOLLIMATOR
, INTEGRATOR
, LAMBERTSON
......@@ -716,4 +714,4 @@ bool ElementBase::isElementPositionSet() const
{ return elemedgeSet_m; }
#endif // CLASSIC_ElementBase_HH
#endif // CLASSIC_ElementBase_HH
\ No newline at end of file
// ------------------------------------------------------------------------
// $RCSfile: Undulator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Undulator
// Defines the abstract interface for a drift space.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Undulator.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Algorithms/PartBunchBase.h"
extern Inform *gmsg;
// Class Undulator
// ------------------------------------------------------------------------
Undulator::Undulator():
Component(),
nSlices_m(1)
{ }
Undulator::Undulator(const Undulator &right):
Component(right),
nSlices_m(right.nSlices_m)
{ }
Undulator::Undulator(const std::string &name):
Component(name),
nSlices_m(1)
{ }
Undulator::~Undulator()
{ }
void Undulator::accept(BeamlineVisitor &visitor) const {
visitor.visitUndulator(*this);
}
void Undulator::initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField) {
endField = startField + getElementLength();
RefPartBunch_m = bunch;
startField_m = startField;
}
//set the number of slices for map tracking
void Undulator::setNSlices(const std::size_t& nSlices) {
nSlices_m = nSlices;
}
//get the number of slices for map tracking
std::size_t Undulator::getNSlices() const {
return nSlices_m;
}
void Undulator::finalise() {
}
bool Undulator::bends() const {
return false;
}
void Undulator::getDimensions(double &zBegin, double &zEnd) const {
zBegin = startField_m;
zEnd = startField_m + getElementLength();
}
ElementBase::ElementType Undulator::getType() const {
return UNDULATOR;
}
#ifndef CLASSIC_Undulator_HH
#define CLASSIC_Undulator_HH
// ------------------------------------------------------------------------
// $RCSfile: Undulator.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Undulator
// Defines the abstract interface for a drift space.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
// Class Undulator
// ------------------------------------------------------------------------
/// Interface for drift space.
// Class Undulator defines the abstract interface for a drift space.
class Undulator: public Component {
public:
/// Constructor with given name.
explicit Undulator(const std::string &name);
Undulator();
Undulator(const Undulator &right);
virtual ~Undulator();
/// Apply visitor to Undulator.
virtual void accept(BeamlineVisitor &) const;
virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField);
virtual void finalise();
virtual bool bends() const;
virtual ElementBase::ElementType getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
//set number of slices for map tracking
void setNSlices(const std::size_t& nSlices); // Philippe was here
//set number of slices for map tracking
std::size_t getNSlices() const; // Philippe was here
private:
double startField_m;
std::size_t nSlices_m;
// Not implemented.
void operator=(const Undulator &);
};
#endif // CLASSIC_Undulator_HH
......@@ -6,7 +6,6 @@ set (_SRCS
CyclotronValleyRep.cpp
DegraderRep.cpp
DriftRep.cpp
UndulatorRep.cpp
FlexibleCollimatorRep.cpp
MarkerRep.cpp
MonitorRep.cpp
......@@ -49,7 +48,6 @@ set (HDRS
CyclotronValleyRep.h
DegraderRep.h
DriftRep.h
UndulatorRep.h
FlexibleCollimatorRep.h
MarkerRep.h
MonitorRep.h
......
// ------------------------------------------------------------------------
// $RCSfile: UndulatorRep.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: UndulatorRep
// Defines a concrete drift space representation.
//
// ------------------------------------------------------------------------
// Class category: BeamlineCore
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "BeamlineCore/UndulatorRep.h"
#include "AbsBeamline/ElementImage.h"
#include "Channels/IndirectChannel.h"
// Attribute access table.
// ------------------------------------------------------------------------
namespace {
struct Entry {
const char *name;
double(UndulatorRep::*get)() const;
void (UndulatorRep::*set)(double);
};
const Entry entries[] = {
{
"L",
&UndulatorRep::getElementLength,
&UndulatorRep::setElementLength
},
{ 0, 0, 0 }
};
}
// Class UndulatorRep
// ------------------------------------------------------------------------
UndulatorRep::UndulatorRep():
Undulator(),
geometry(0.0)
{}
UndulatorRep::UndulatorRep(const UndulatorRep &right):
Undulator(right),
geometry(right.geometry)
{}
UndulatorRep::UndulatorRep(const std::string &name):
Undulator(name),
geometry()
{}
UndulatorRep::~UndulatorRep()
{}
ElementBase *UndulatorRep::clone() const {
return new UndulatorRep(*this);
}
Channel *UndulatorRep::getChannel(const std::string &aKey, bool create) {
for(const Entry *entry = entries; entry->name != 0; ++entry) {
if(aKey == entry->name) {
return new IndirectChannel<UndulatorRep>(*this, entry->get, entry->set);
}
}
return ElementBase::getChannel(aKey, create);
}
NullField &UndulatorRep::getField() {
return field;
}
const NullField &UndulatorRep::getField() const {
return field;
}
StraightGeometry &UndulatorRep::getGeometry() {
return geometry;
}
const StraightGeometry &UndulatorRep::getGeometry() const {
return geometry;
}
ElementImage *UndulatorRep::getImage() const {
ElementImage *image = ElementBase::getImage();
for(const Entry *entry = entries; entry->name != 0; ++entry) {
image->setAttribute(entry->name, (this->*(entry->get))());
}
return image;
}
#ifndef CLASSIC_UndulatorRep_HH
#define CLASSIC_UndulatorRep_HH
// ------------------------------------------------------------------------
// $RCSfile: UndulatorRep.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: UndulatorRep
//
// ------------------------------------------------------------------------
// Class category: BeamlineCore
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:33 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Undulator.h"
#include "BeamlineGeometry/StraightGeometry.h"
#include "Fields/NullField.h"
// Class UndulatorRep
// ------------------------------------------------------------------------
/// Representation for a drift space.
class UndulatorRep: public Undulator {
public:
/// Constructor with given name.
explicit UndulatorRep(const std::string &name);
UndulatorRep();
UndulatorRep(const UndulatorRep &);
virtual ~UndulatorRep();
/// Return clone.
// Return an identical deep copy of the element.
virtual ElementBase *clone() const;
/// Construct a read/write channel.
// This method constructs a Channel permitting read/write access to
// the attribute [b]aKey[/b] and returns it.
// If the attribute does not exist, it returns NULL.
virtual Channel *getChannel(const std::string &aKey, bool = false);
/// Get field.
// Version for non-constant object.
virtual NullField &getField();
/// Get field.
// Version for constant object.
virtual const NullField &getField() const;
/// Get geometry.
// Version for non-constant object.
virtual StraightGeometry &getGeometry();
/// Get geometry.
// Version for constant object.
virtual const StraightGeometry &getGeometry() const;
/// Construct an image.
// Return the image of the element, containing the name and type string
// of the element, and a copy of the user-defined attributes.
virtual ElementImage *getImage() const;
private:
// Not implemented.
void operator=(const UndulatorRep &);
/// The zero magnetic field.
NullField field;
/// The geometry.
StraightGeometry geometry;
};
#endif // CLASSIC_UndulatorRep_HH
......@@ -8,7 +8,6 @@ set (_SRCS
OpalCCollimator.cpp
OpalCyclotron.cpp
OpalDrift.cpp
OpalUndulator.cpp
OpalECollimator.cpp
OpalFlexibleCollimator.cpp
OpalDegrader.cpp
......@@ -78,7 +77,6 @@ set (HDRS
OpalCyclotronValley.h
OpalDegrader.h
OpalDrift.h
OpalUndulator.h
OpalECollimator.h
OpalElement.h
OpalHKicker.h
......
// ------------------------------------------------------------------------
// $RCSfile: OpalUndulator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: OpalUndulator
// The class of OPAL drift spaces.
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:39 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
#include "Elements/OpalUndulator.h"
#include "Structure/BoundaryGeometry.h"
#include "Attributes/Attributes.h"
#include "BeamlineCore/UndulatorRep.h"
#include "Structure/OpalWake.h"
#include "Structure/ParticleMatterInteraction.h"
// Class OpalUndulator
// ------------------------------------------------------------------------
OpalUndulator::OpalUndulator():
OpalElement(SIZE, "DRIFT",
"The \"DRIFT\" element defines a drift space."),
owk_m(NULL),
parmatint_m(NULL),
obgeo_m(NULL) {
// CKR: the following 3 lines are redundant: OpalElement does this already!
// they prevent drift from working properly
//
// itsAttr[LENGTH] = Attributes::makeReal
// ("LENGTH", "Undulator length");
// registerRealAttribute("LENGTH");
itsAttr[GEOMETRY] = Attributes::makeString
("GEOMETRY", "BoundaryGeometry for Undulators");
itsAttr[NSLICES] = Attributes::makeReal
("NSLICES",
"The number of slices/ steps for this element in Map Tracking", 1);
registerStringAttribute("GEOMETRY");
registerRealAttribute("NSLICES");
registerOwnership();
setElement(new UndulatorRep("DRIFT"));
}
OpalUndulator::OpalUndulator(const std::string &name, OpalUndulator *parent):
OpalElement(name, parent),
owk_m(NULL),
parmatint_m(NULL),
obgeo_m(NULL) {
setElement(new UndulatorRep(name));
}
OpalUndulator::~OpalUndulator() {
if(owk_m)
delete owk_m;
if(parmatint_m)
delete parmatint_m;
if(obgeo_m)
delete obgeo_m;
}
OpalUndulator *OpalUndulator::clone(const std::string &name) {
return new OpalUndulator(name, this);
}
bool OpalUndulator::isUndulator() const {
return true;
}
void OpalUndulator::update() {
OpalElement::update();
UndulatorRep *drf = static_cast<UndulatorRep *>(getElement());
drf->setElementLength(Attributes::getReal(itsAttr[LENGTH]));
drf->setNSlices(Attributes::getReal(itsAttr[NSLICES]));
if(itsAttr[WAKEF] && owk_m == NULL) {
owk_m = (OpalWake::find(Attributes::getString(itsAttr[WAKEF])))->clone(getOpalName() + std::string("_wake"));
owk_m->initWakefunction(*drf);
drf->setWake(owk_m->wf_m);
}
if(itsAttr[PARTICLEMATTERINTERACTION] && parmatint_m == NULL) {
parmatint_m = (ParticleMatterInteraction::find(Attributes::getString(itsAttr[PARTICLEMATTERINTERACTION])))->clone(getOpalName() + std::string("_parmatint"));
parmatint_m->initParticleMatterInteractionHandler(*drf);
drf->setParticleMatterInteraction(parmatint_m->handler_m);
}
if(itsAttr[GEOMETRY] && obgeo_m == NULL) {
obgeo_m = (BoundaryGeometry::find(Attributes::getString(itsAttr[GEOMETRY])))->clone(getOpalName() + std::string("_geometry"));
if(obgeo_m) {
drf->setBoundaryGeometry(obgeo_m);
}
}
// Transmit "unknown" attributes.
OpalElement::updateUnknown(drf);
}
#ifndef OPAL_OpalUndulator_HH
#define OPAL_OpalUndulator_HH
// ------------------------------------------------------------------------
// $RCSfile: OpalUndulator.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//