Commit c8b49f25 authored by kraus's avatar kraus
Browse files

Merge branch 'develop' into svn

- moving the following classes over from OPAL to CLASSIC
  o OpalField       -> ClassicField
  o OpalRing        -> Ring
  o OpalRingSection -> RingSection
  o LossDataSink
- clean up
- splitting Options into classic and opal options
parent a5bbf7cf
......@@ -58,6 +58,8 @@ classic/5.0/src/AbsBeamline/RFCavity.cpp -text
classic/5.0/src/AbsBeamline/RFCavity.h -text
classic/5.0/src/AbsBeamline/RFQuadrupole.cpp -text
classic/5.0/src/AbsBeamline/RFQuadrupole.h -text
classic/5.0/src/AbsBeamline/Ring.cpp -text
classic/5.0/src/AbsBeamline/Ring.h -text
classic/5.0/src/AbsBeamline/SBend.cpp -text
classic/5.0/src/AbsBeamline/SBend.h -text
classic/5.0/src/AbsBeamline/SBend3D.cpp -text
......@@ -473,6 +475,9 @@ classic/5.0/src/Solvers/GreenWakeFunction.hh -text
classic/5.0/src/Solvers/SurfacePhysicsHandler.hh -text
classic/5.0/src/Solvers/TestLambda.h -text
classic/5.0/src/Solvers/WakeFunction.hh -text
classic/5.0/src/Structure/CMakeLists.txt -text
classic/5.0/src/Structure/LossDataSink.cpp -text
classic/5.0/src/Structure/LossDataSink.h -text
classic/5.0/src/Utilities/ArithmeticError.cpp -text
classic/5.0/src/Utilities/ArithmeticError.h -text
classic/5.0/src/Utilities/AttributeError.cpp -text
......@@ -482,6 +487,8 @@ classic/5.0/src/Utilities/CLRangeError.h -text
classic/5.0/src/Utilities/CMakeLists.txt -text
classic/5.0/src/Utilities/ClassicException.cpp -text
classic/5.0/src/Utilities/ClassicException.h -text
classic/5.0/src/Utilities/ClassicField.cpp -text
classic/5.0/src/Utilities/ClassicField.h -text
classic/5.0/src/Utilities/ComplexErrorFun.cpp -text
classic/5.0/src/Utilities/ComplexErrorFun.h -text
classic/5.0/src/Utilities/ConvergenceError.cpp -text
......@@ -496,18 +503,24 @@ classic/5.0/src/Utilities/FormatError.cpp -text
classic/5.0/src/Utilities/FormatError.h -text
classic/5.0/src/Utilities/Gauss.cpp -text
classic/5.0/src/Utilities/Gauss.h -text
classic/5.0/src/Utilities/GeneralClassicException.cpp -text
classic/5.0/src/Utilities/GeneralClassicException.h -text
classic/5.0/src/Utilities/InverseGauss.cpp -text
classic/5.0/src/Utilities/InverseGauss.h -text
classic/5.0/src/Utilities/LogicalError.cpp -text
classic/5.0/src/Utilities/LogicalError.h -text
classic/5.0/src/Utilities/NormalFormError.cpp -text
classic/5.0/src/Utilities/NormalFormError.h -text
classic/5.0/src/Utilities/Options.cpp -text
classic/5.0/src/Utilities/Options.h -text
classic/5.0/src/Utilities/OverflowError.cpp -text
classic/5.0/src/Utilities/OverflowError.h -text
classic/5.0/src/Utilities/ParseError.cpp -text
classic/5.0/src/Utilities/ParseError.h -text
classic/5.0/src/Utilities/Random.cpp -text
classic/5.0/src/Utilities/Random.h -text
classic/5.0/src/Utilities/RingSection.cpp -text
classic/5.0/src/Utilities/RingSection.h -text
classic/5.0/src/Utilities/SingularMatrixError.cpp -text
classic/5.0/src/Utilities/SingularMatrixError.h -text
classic/5.0/src/Utilities/SizeError.cpp -text
......@@ -780,11 +793,8 @@ src/Elements/OpalRBend.cpp -text
src/Elements/OpalRBend.h -text
src/Elements/OpalRCollimator.cpp -text
src/Elements/OpalRCollimator.h -text
src/Elements/OpalRing.cpp -text
src/Elements/OpalRing.h -text
src/Elements/OpalRingDefinition.cpp -text
src/Elements/OpalRingDefinition.h -text
src/Elements/OpalRingTest.h -text
src/Elements/OpalSBend.cpp -text
src/Elements/OpalSBend.h -text
src/Elements/OpalSBend3D.cpp -text
......@@ -1030,8 +1040,6 @@ src/Structure/DataSink.cpp -text
src/Structure/DataSink.h -text
src/Structure/FieldSolver.cpp -text
src/Structure/FieldSolver.h -text
src/Structure/LossDataSink.cpp -text
src/Structure/LossDataSink.h -text
src/Structure/OpalWake.cpp -text
src/Structure/OpalWake.h -text
src/Structure/PriEmissionPhysics.cpp -text
......@@ -1098,15 +1106,12 @@ src/Utilities/NumToStr.cpp -text
src/Utilities/NumToStr.h -text
src/Utilities/OpalException.cpp -text
src/Utilities/OpalException.h -text
src/Utilities/OpalField.cpp -text
src/Utilities/OpalField.h -text
src/Utilities/OpalFilter.cpp -text
src/Utilities/OpalFilter.h -text
src/Utilities/OpalRingSection.cpp -text
src/Utilities/OpalRingSection.h -text
src/Utilities/OpalOptions.cpp -text
src/Utilities/OpalOptions.h -text
src/Utilities/OpalSection.cpp -text
src/Utilities/OpalSection.h -text
src/Utilities/Options.h -text
src/Utilities/RegularExpression.cpp -text
src/Utilities/RegularExpression.h -text
src/Utilities/Round.cpp -text
......@@ -1139,14 +1144,14 @@ src/opal.h -text
src/unit_tests/CMakeLists.txt -text
src/unit_tests/Main.cpp -text
src/unit_tests/classic_src/AbsBeamline/OffsetTest.cpp -text
src/unit_tests/classic_src/AbsBeamline/RingTest.cpp -text
src/unit_tests/classic_src/AbsBeamline/SBend3DTest.cpp -text
src/unit_tests/classic_src/AbsBeamline/SBend3D_map.field -text
src/unit_tests/classic_src/AbsBeamline/VariableRFCavityTest.cpp -text
src/unit_tests/classic_src/Algorithms/PolynomialTimeDependenceTest.cpp -text
src/unit_tests/classic_src/Utilities/RingSectionTest.cpp -text
src/unit_tests/gtest/bin/install_gtest.bash -text
src/unit_tests/opal_src/Elements/OpalOffsetTest.cpp -text
src/unit_tests/opal_src/Elements/OpalPolynomialTimeDependenceTest.cpp -text
src/unit_tests/opal_src/Elements/OpalRingTest.cpp -text
src/unit_tests/opal_src/Elements/OpalVariableRFCavityTest.cpp -text
src/unit_tests/opal_src/Utilities/MockComponent.h -text
src/unit_tests/opal_src/Utilities/OpalRingSectionTest.cpp -text
......@@ -234,9 +234,33 @@ ELSE ()
ENDIF ()
MESSAGE (STATUS "Compiling with ${CMAKE_CXX_FLAGS}")
INCLUDE(FindSubversion)
IF(Subversion_SVN_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE OPAL_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
RESULT_VARIABLE Subversion_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(${Subversion_svn_info_result} EQUAL 0)
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} OPAL)
ELSE()
SET (OPAL_WC_REVISION 0)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git rev-parse HEAD
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET (OPAL_WC_REVISION \"${GIT_OUT}\")
ENDIF()
ELSE()
MESSAGE (STATUS "could not find subversion")
SET (OPAL_WC_REVISION \"\")
ENDIF()
ADD_SUBDIRECTORY (classic/5.0/src)
ADD_SUBDIRECTORY (src)
......@@ -63,7 +63,7 @@ class Solenoid;
class ParallelPlate;
class CyclotronValley;
class Stripper;
class OpalRing;
class Ring;
// Integrators.
class Integrator;
......@@ -122,8 +122,8 @@ public:
/// Apply the algorithm to a drift space.
virtual void visitDrift(const Drift &) = 0;
/// Apply the algorithm to an OpalRing
virtual void visitOpalRing(const OpalRing &) = 0;
/// Apply the algorithm to an Ring
virtual void visitRing(const Ring &) = 0;
/// Apply the algorithm to a cyclotron.
virtual void visitCyclotron(const Cyclotron &) = 0;
......
......@@ -7,6 +7,7 @@ set (_SRCS
Component.cpp
Corrector.cpp
Cyclotron.cpp
CyclotronValley.cpp
Degrader.cpp
Diagnostic.cpp
Drift.cpp
......@@ -18,21 +19,21 @@ set (_SRCS
Monitor.cpp
Multipole.cpp
Offset.cpp
ParallelPlate.cpp
Patch.cpp
Probe.cpp
RBend.cpp
RFCavity.cpp
VariableRFCavity.cpp
TravelingWave.cpp
RFQuadrupole.cpp
Ring.cpp
SBend.cpp
SBend3D.cpp
Separator.cpp
Septum.cpp
Solenoid.cpp
ParallelPlate.cpp
CyclotronValley.cpp
Stripper.cpp
TravelingWave.cpp
VariableRFCavity.cpp
)
include_directories (
......
......@@ -24,6 +24,7 @@
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "Structure/LossDataSink.h"
#include "Utilities/Options.h"
#include "Solvers/SurfacePhysicsHandler.hh"
#include <memory>
......
......@@ -23,12 +23,13 @@
#include "AbsBeamline/BeamlineVisitor.h"
#include "Physics/Physics.h"
#include "Structure/LossDataSink.h"
#include "Utilities/Options.h"
#include "Fields/Fieldmap.hh"
#include "Utilities/OpalException.h"
#include "Utilities/GeneralClassicException.h"
#include <fstream>
#define CHECK_CYC_FSCANF_EOF(arg) if(arg == EOF)\
throw OpalException("Cyclotron::getFieldFromFile",\
throw GeneralClassicException("Cyclotron::getFieldFromFile",\
"fscanf returned EOF at " #arg);
extern Inform *gmsg;
......@@ -279,10 +280,10 @@ bool Cyclotron::apply(const size_t &id, const double &t, double E[], double B[])
}
bool Cyclotron::apply(const size_t &id, const double &t, Vector_t &E, Vector_t &B) {
bool flagNeedUpdate = false;
const double rpos = sqrt(RefPartBunch_m->R[id](0) * RefPartBunch_m->R[id](0)
const double rpos = sqrt(RefPartBunch_m->R[id](0) * RefPartBunch_m->R[id](0)
+ RefPartBunch_m->R[id](1) * RefPartBunch_m->R[id](1));
const double zpos = RefPartBunch_m->R[id](2);
......@@ -294,12 +295,12 @@ bool Cyclotron::apply(const size_t &id, const double &t, Vector_t &E, Vector_t &
} else{
flagNeedUpdate = apply(RefPartBunch_m->R[id], Vector_t(0.0), t, E, B);
if(flagNeedUpdate){
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
if(flagNeedUpdate){
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
gmsgALL << getName() << ": particle "<< id <<" out of the field map boundary!"<< endl;
}
}
if (flagNeedUpdate) {
lossDs_m->addParticle(RefPartBunch_m->R[id], RefPartBunch_m->P[id],id);
RefPartBunch_m->Bin[id] = -1;
......@@ -464,7 +465,7 @@ bool Cyclotron::apply(const Vector_t &R, const Vector_t &centroid, const double
B[0] = br * cos(tet_rad) - bt * sin(tet_rad);
B[1] = br * sin(tet_rad) + bt * cos(tet_rad);
B[2] = bz;
} else {
return true;
}
......@@ -892,7 +893,7 @@ void Cyclotron::initialise(PartBunch *bunch, double &startField, double &endFiel
void Cyclotron::initialise(PartBunch *bunch, const int &fieldflag, const double &scaleFactor) {
RefPartBunch_m = bunch;
lossDs_m = std::unique_ptr<LossDataSink>(new LossDataSink(getName(), !Options::asciidump));
// PSIBF, AVFEQBF, ANSYSBF, FFAGBF
// for your own format field, you should add your own getFieldFromFile() function by yourself.
......@@ -1117,9 +1118,9 @@ void Cyclotron::getFieldFromFile_AVFEQ(const double &scaleFactor) {
*gmsg << "* rescaling of the fields with factor: " << BP.Bfact << endl;
fstream fp;
if((Ippl::getNodes()) == 1 && Options::info)
if((Ippl::getNodes()) == 1 && Options::info)
fp.open("data/gnu.out", ios::out);
double tmp;
int count = 0;
......@@ -1203,7 +1204,7 @@ void Cyclotron::getFieldFromFile_Carbon(const double &scaleFactor) {
for(int i = 0; i < Bfield.nrad; i++) {
for(int k = 0; k < Bfield.ntet; k++) {
fp1 << BP.rmin + (i * BP.delr) << " \t " << k*(BP.tetmin + BP.dtet) << " \t " << Bfield.bfld[idx(i, k)] << endl;
Vector_t tmpR = Vector_t (BP.rmin + (i * BP.delr), 0.0, k * (BP.tetmin + BP.dtet));
Vector_t tmpE(0.0, 0.0, 0.0), tmpB(0.0, 0.0, 0.0);
tmpR /= 1000.0; // -> mm to m
......
......@@ -23,6 +23,7 @@
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "Structure/LossDataSink.h"
#include "Utilities/Options.h"
#include "Physics/Physics.h"
#include <memory>
......
......@@ -27,8 +27,6 @@
#include <memory>
using namespace Options;
#include <fstream>
#include <memory>
......
......@@ -29,10 +29,10 @@
#include <cmath>
#include "Utilities/OpalException.h"
#include "Utilities/GeneralClassicException.h"
#include "BeamlineGeometry/Euclid3DGeometry.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Elements/OpalRing.h"
#include "Physics/Physics.h"
double Offset::float_tolerance = 1e-12;
......@@ -86,12 +86,12 @@ void Offset::accept(BeamlineVisitor & visitor) const {
}
EMField &Offset::getField() {
throw OpalException("Offset::getField()",
throw GeneralClassicException("Offset::getField()",
"No field defined for Offset");
}
const EMField &Offset::getField() const {
throw OpalException("Offset::getField() const",
throw GeneralClassicException("Offset::getField() const",
"No field defined for Offset");
}
......@@ -162,7 +162,7 @@ std::ostream& operator<<(std::ostream& out, const Vector_t& vec) {
double Offset::getTheta(Vector_t vec1, Vector_t vec2) {
if (fabs(vec1(2)) > 1e-9 || fabs(vec2(2)) > 1e-9)
throw OpalException("Offset::getTheta(...)",
throw GeneralClassicException("Offset::getTheta(...)",
"Rotations out of midplane are not implemented");
// probably not the most efficient, but only called at set up
double theta = atan2(vec2(1), vec2(0))-atan2(vec1(1), vec1(0));
......@@ -181,7 +181,7 @@ Vector_t Offset::rotate(Vector_t vec, double theta) {
void Offset::updateGeometry() {
if (!_is_local)
throw OpalException("Offset::updateGeometry(...)",
throw GeneralClassicException("Offset::updateGeometry(...)",
"Global offset needs a local coordinate system");
Vector_t translation = getEndPosition();
double length = sqrt(translation(0)*translation(0)+
......@@ -249,7 +249,7 @@ std::ostream& operator<<(std::ostream& out, const Offset& off) {
bool Offset::bends() const {
if (geometry_m == NULL) {
throw OpalException("Offset::bends",
throw GeneralClassicException("Offset::bends",
"Try to determine if Offset bends when geometry_m not allocated");
}
Rotation3D rotation = geometry_m->getTotalTransform().getRotation();
......
......@@ -45,9 +45,9 @@ class Fieldmap;
* @param _is_local parameter is True if everything is in the coordinate system
* of the last placed object. It is expected that everything will be in a local
* coordinate system before tracking begins (this is expected by, for example,
* OpalRing). This is expected to be set by the visit function in e.g.
* Ring). This is expected to be set by the visit function in e.g.
* ParallelCyclotronTracker.
* @param geometry the geometry that OpalRingSection uses to do displacements
* @param geometry the geometry that RingSection uses to do displacements
* This has to be a pointer because SRotatedGeometry
* does not have an defined assignment op. SRotatedGeometry does not have
* a assignment op because BGeometryBase does not have an assignment op...
......@@ -202,16 +202,16 @@ class Offset : public Component {
void updateGeometry();
bool isGeometryAllocated() const;
/// Not implemented - throws OpalException
/// Not implemented - throws GeneralClassicException
EMField &getField();
/// Not implemented - throws OpalException
/// Not implemented - throws GeneralClassicException
const EMField &getField() const;
/** Calculate the angle between vectors on the midplane
*
* Returns theta in domain -pi, pi. A positive angle means a rotation
* anticlockwise from vec1 to vec2.
*
* Throws an OpalException if vec1, vec2 are not in the midplane i.e.
* Throws an GeneralClassicException if vec1, vec2 are not in the midplane i.e.
* non-zero z.
*/
static double getTheta(Vector_t vec1, Vector_t vec2);
......
......@@ -24,6 +24,7 @@
#include "AbsBeamline/BeamlineVisitor.h"
#include "Physics/Physics.h"
#include "Structure/LossDataSink.h"
#include "Utilities/Options.h"
#include <iostream>
#include <fstream>
using Physics::pi;
......
......@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "Elements/OpalRing.h"
#include "AbsBeamline/Ring.h"
#include <sstream>
#include <limits>
......@@ -36,84 +36,82 @@
#include "AbsBeamline/BeamlineVisitor.h"
#include "Structure/LossDataSink.h"
#include "Algorithms/PartBunch.h"
#include "Utilities/OpalException.h"
#include "Utilities/OpalRingSection.h"
// fairly generous tolerance here... maybe too generous? Maybe should be
// user parameter?
const double OpalRing::lengthTolerance_m = 1e-2;
const double OpalRing::angleTolerance_m = 1e-2;
OpalRing::OpalRing(std::string ring)
: Component(ring), planarArcGeometry_m(1, 1),
refPartBunch_m(NULL),
lossDS_m(NULL),
beamRInit_m(0.), beamPRInit_m(0.), beamPhiInit_m(0.),
latticeRInit_m(0.), latticePhiInit_m(0.), latticeThetaInit_m(0.),
isLocked_m(false), isClosed_m(true),
symmetry_m(0), cyclHarm_m(0), rfFreq_m(0),
phiStep_m(Physics::pi/100.),
ringSections_m(),
section_list_m() {
const double Ring::lengthTolerance_m = 1e-2;
const double Ring::angleTolerance_m = 1e-2;
Ring::Ring(std::string ring)
: Component(ring), planarArcGeometry_m(1, 1),
refPartBunch_m(NULL),
lossDS_m(NULL),
beamRInit_m(0.), beamPRInit_m(0.), beamPhiInit_m(0.),
latticeRInit_m(0.), latticePhiInit_m(0.), latticeThetaInit_m(0.),
isLocked_m(false), isClosed_m(true),
symmetry_m(0), cyclHarm_m(0), rfFreq_m(0),
phiStep_m(Physics::pi/100.),
ringSections_m(),
section_list_m() {
setRefPartBunch(NULL);
}
void OpalRing::accept(BeamlineVisitor& visitor) const {
visitor.visitOpalRing(*this);
void Ring::accept(BeamlineVisitor& visitor) const {
visitor.visitRing(*this);
}
OpalRing::OpalRing(const OpalRing& ring)
: Component(ring.getName()),
planarArcGeometry_m(ring.planarArcGeometry_m),
lossDS_m(NULL),
beamRInit_m(ring.beamRInit_m),
beamPRInit_m(ring.beamPRInit_m),
beamPhiInit_m(ring.beamPhiInit_m),
latticeRInit_m(ring.latticeRInit_m),
latticePhiInit_m(ring.latticePhiInit_m),
latticeThetaInit_m(ring.latticeThetaInit_m),
isLocked_m(ring.isLocked_m),
isClosed_m(ring.isClosed_m),
symmetry_m(ring.symmetry_m),
cyclHarm_m(ring.cyclHarm_m),
phiStep_m(ring.phiStep_m),
ringSections_m(),
section_list_m(ring.section_list_m.size()) {
Ring::Ring(const Ring& ring)
: Component(ring.getName()),
planarArcGeometry_m(ring.planarArcGeometry_m),
lossDS_m(NULL),
beamRInit_m(ring.beamRInit_m),
beamPRInit_m(ring.beamPRInit_m),
beamPhiInit_m(ring.beamPhiInit_m),
latticeRInit_m(ring.latticeRInit_m),
latticePhiInit_m(ring.latticePhiInit_m),
latticeThetaInit_m(ring.latticeThetaInit_m),
isLocked_m(ring.isLocked_m),
isClosed_m(ring.isClosed_m),
symmetry_m(ring.symmetry_m),
cyclHarm_m(ring.cyclHarm_m),
phiStep_m(ring.phiStep_m),
ringSections_m(),
section_list_m(ring.section_list_m.size()) {
setRefPartBunch(ring.refPartBunch_m);
if (ring.lossDS_m != NULL)
throw OpalException("OpalRing::OpalRing(const OpalRing&)",
"Can't copy construct LossDataSink so copy constructor fails");
throw GeneralClassicException("Ring::Ring(const Ring&)",
"Can't copy construct LossDataSink so copy constructor fails");
for (size_t i = 0; i < section_list_m.size(); ++i) {
section_list_m[i] = new OpalRingSection(*ring.section_list_m[i]);
section_list_m[i] = new RingSection(*ring.section_list_m[i]);
}
buildRingSections();
}
OpalRing::~OpalRing() {
Ring::~Ring() {
if (lossDS_m != NULL)
delete lossDS_m;
for (size_t i = 0; i < section_list_m.size(); ++i)
delete section_list_m[i];
}
bool OpalRing::apply(const size_t &id, const double &t, Vector_t &E,
Vector_t &B) {
bool flagNeedUpdate =
apply(refPartBunch_m->R[id], refPartBunch_m->get_centroid(), t, E, B);
if(flagNeedUpdate) {
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
gmsgALL << getName() << ": particle " << id
<< " at " << refPartBunch_m->R[id]
<< " out of the field map boundary" << endl;
lossDS_m->addParticle(refPartBunch_m->R[id], refPartBunch_m->P[id], id);
lossDS_m->save();
refPartBunch_m->Bin[id] = -1;
}
return flagNeedUpdate;
bool Ring::apply(const size_t &id, const double &t, Vector_t &E,
Vector_t &B) {
bool flagNeedUpdate =
apply(refPartBunch_m->R[id], refPartBunch_m->get_centroid(), t, E, B);
if(flagNeedUpdate) {
Inform gmsgALL("OPAL ", INFORM_ALL_NODES);
gmsgALL << getName() << ": particle " << id
<< " at " << refPartBunch_m->R[id]
<< " out of the field map boundary" << endl;
lossDS_m->addParticle(refPartBunch_m->R[id], refPartBunch_m->P[id], id);
lossDS_m->save();
refPartBunch_m->Bin[id] = -1;
}
return flagNeedUpdate;
}
bool OpalRing::apply(const size_t &id, const double &t,
double E[], double B[]) {
bool Ring::apply(const size_t &id, const double &t,
double E[], double B[]) {
Vector_t Ev(0, 0, 0), Bv(0, 0, 0);
if(apply(id, t, Ev, Bv))
......@@ -129,12 +127,12 @@ bool OpalRing::apply(const size_t &id, const double &t,
return false;
}
bool OpalRing::apply(const Vector_t &R, const Vector_t &centroid,
const double &t, Vector_t &E, Vector_t &B) {
bool Ring::apply(const Vector_t &R, const Vector_t &centroid,
const double &t, Vector_t &E, Vector_t &B) {
B = Vector_t(0.0, 0.0, 0.0);
E = Vector_t(0.0, 0.0, 0.0);
std::vector<OpalRingSection*> sections = getSectionsAt(R);
std::vector<RingSection*> sections = getSectionsAt(R);
bool outOfBounds = true;
// assume field maps don't set B, E to 0...
for (size_t i = 0; i < sections.size(); ++i) {
......@@ -144,45 +142,45 @@ bool OpalRing::apply(const Vector_t &R, const Vector_t &centroid,
B += B_temp;
E += E_temp;
}
// std::cerr << "OpalRing::apply " << sections.size() << " Pos: " << R << " B: " << B << std::endl;
// std::cerr << "Ring::apply " << sections.size() << " Pos: " << R << " B: " << B << std::endl;
return outOfBounds;
}
void OpalRing::setLossDataSink(LossDataSink* sink) {
void Ring::setLossDataSink(LossDataSink* sink) {
if (lossDS_m != NULL) {
delete lossDS_m;
}
lossDS_m = sink;
}
void OpalRing::getDimensions(double &zBegin, double &zEnd) const {
throw OpalException("OpalRing::getDimensions",
"Cannot get s-dimension of a ring");
void Ring::getDimensions(double &zBegin, double &zEnd) const {
throw GeneralClassicException("Ring::getDimensions",
"Cannot get s-dimension of a ring");
}
void OpalRing::initialise(PartBunch *bunch) {
void Ring::initialise(PartBunch *bunch) {
online_m = true;
setRefPartBunch(bunch);
setLossDataSink(new LossDataSink(getName(), false));
}
void OpalRing::initialise(PartBunch * bunch, double &startField,
double &endField, const double &scaleFactor) {
void Ring::initialise(PartBunch * bunch, double &startField,
double &endField, const double &scaleFactor) {
initialise(bunch);
}
void OpalRing::finalise() {
void Ring::finalise() {
online_m = false;
setRefPartBunch(NULL);
setLossDataSink(NULL);
}
void OpalRing::setRefPartBunch(PartBunch* bunch) {
void Ring::setRefPartBunch(PartBunch* bunch) {
RefPartBunch_m = bunch; // inherited from Component
refPartBunch_m = bunch; // private data (obeys style guide)
}
std::vector<Opal