Commit c462f348 authored by snuverink_j's avatar snuverink_j

Merge branch '289-cleanup-unused-and-outdated-files' into 'master'

Resolve "Cleanup unused and outdated files"

Closes #289

See merge request OPAL/src!81
parents 5566e18e ec8c4bcf
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef __READ_SPLIT_FROM_FILE__
#define __READ_SPLIT_FROM_FILE__
#include "mpi.h"
#include "Util/OptPilotException.h"
#include "Comm/Splitter.h"
class ReadSplitFromFile : public Splitter {
public:
ReadSplitFromFile(MPI_Comm comm = MPI_COMM_WORLD) : comm_m(comm) {
MPI_Comm_rank(comm_m, &rank_m);
MPI_Comm_size(comm_m, &size_m);
iAmOptimizer_m = false;
iAmWorker_m = false;
iAmPilot_m = false;
if(size_m < 3)
throw OptPilotException("CommSplitter::CommSplitter", "Need 3 or more cores to split!");
split();
}
virtual ~ReadSplitFromFile()
{}
void freeComm() {
MPI_Group_free(&gpw);
MPI_Group_free(&gpo);
MPI_Group_free(&all);
//MPI_Comm_free(&pilot_opt);
//MPI_Comm_free(&pilot_worker);
}
bool isOptimizer() { return iAmOptimizer_m; }
bool isWorker() { return iAmWorker_m; }
bool isPilot() { return iAmPilot_m; }
MPI_Comm myInternalComm() {
return myInternalComm_m;
}
MPI_Comm myExternalComm() {
return myExternalComm_m;
}
MPI_Comm PilotListenerComm() {
if(isPilot())
return PilotListener_m;
else
return MPI_COMM_NULL;
}
MPI_Comm PilotOptimizerComm() {
if(isPilot())
return myInternalComm_m;
else
return MPI_COMM_NULL;
}
MPI_Comm PilotWorkerComm() {
if(isPilot())
return myExternalComm_m;
else
return MPI_COMM_NULL;
}
int PilotRank() {
return 0;
}
int OptMaster() {
return 1;
}
private:
//typedef std::vector<MPI_Comm> Communicators;
MPI_Comm comm_m;
MPI_Comm PilotListener_m;
MPI_Comm myInternalComm_m;
MPI_Comm myExternalComm_m;
MPI_Group all;
MPI_Group gpo;
MPI_Group gpw;
MPI_Comm pilot_opt;
MPI_Comm pilot_worker;
int rank_m;
int size_m;
bool iAmOptimizer_m;
bool iAmWorker_m;
bool iAmPilot_m;
void split() {
MPI_Comm_group(comm_m, &all);
int rpilot_opt[2] = { 0, 1 };
MPI_Group_incl(all, 2, rpilot_opt, &gpo);
MPI_Comm_create(comm_m, gpo, &pilot_opt);
//XXX: for now every worker has only one core
int ropt[1] = { 1 };
MPI_Group_excl(all, 1, ropt, &gpw );
MPI_Comm_create(comm_m, gpw, &pilot_worker);
PilotListener_m = MPI_COMM_WORLD;
if(rank_m == 0) {
myInternalComm_m = pilot_opt;
myExternalComm_m = pilot_worker;
iAmPilot_m = true;
} else if(rank_m == 1) {
myInternalComm_m = MPI_COMM_SELF;
myExternalComm_m = pilot_opt;
iAmOptimizer_m = true;
} else {
myInternalComm_m = MPI_COMM_SELF;
myExternalComm_m = pilot_worker;
iAmWorker_m = true;
}
}
};
#endif
This diff is collapsed.
#ifndef OPAL_AutophaseTracker_H
#define OPAL_AutophaseTracker_H
//
// Copyright & License: See Copyright.readme in src directory
//
#include "Algorithms/PartBunchBase.h"
#include "Steppers/BorisPusher.h"
#include "Algorithms/PartData.h"
#include "Algorithms/PBunchDefs.h"
class ClassicField;
#include "Elements/OpalBeamline.h"
#include "Beamlines/Beamline.h"
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/CCollimator.h"
#include "AbsBeamline/FlexibleCollimator.h"
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/Degrader.h"
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/Drift.h"
#include "AbsBeamline/ElementBase.h"
#include "AbsBeamline/Lambertson.h"
#include "AbsBeamline/Marker.h"
#include "AbsBeamline/Monitor.h"
#include "AbsBeamline/Multipole.h"
#include "AbsBeamline/Probe.h"
#include "AbsBeamline/RBend.h"
#include "AbsBeamline/RFCavity.h"
#include "AbsBeamline/TravelingWave.h"
#include "AbsBeamline/RFQuadrupole.h"
#include "AbsBeamline/SBend.h"
#include "AbsBeamline/Separator.h"
#include "AbsBeamline/Septum.h"
#include "AbsBeamline/Solenoid.h"
#include "AbsBeamline/ParallelPlate.h"
#include "AbsBeamline/CyclotronValley.h"
#include "Algorithms/DefaultVisitor.h"
#include <queue>
#define AP_VISITELEMENT(elem) virtual void visit##elem(const elem &el) \
{ itsOpalBeamline_m.visit(el, *this, &itsBunch_m); }
#define AP_IGNOREELEMENT(elem) virtual void visit##elem(const elem &) { }
class AutophaseTracker: public DefaultVisitor {
public:
AutophaseTracker(const Beamline &beamline,
const PartData &ref,
const double &T0,
double initialR,
double initialP);
virtual ~AutophaseTracker();
void execute(const std::queue<double> &dtAllTracks,
const std::queue<double> &maxZ,
const std::queue<unsigned long long> &maxTrackSteps);
void save(const std::string &fname);
virtual void visitBeamline(const Beamline &bl);
AP_VISITELEMENT(AlignWrapper)
AP_IGNOREELEMENT(BeamBeam)
AP_IGNOREELEMENT(CCollimator)
AP_IGNOREELEMENT(Corrector)
AP_IGNOREELEMENT(CyclotronValley)
AP_IGNOREELEMENT(Degrader)
AP_IGNOREELEMENT(Diagnostic)
AP_IGNOREELEMENT(Drift)
AP_IGNOREELEMENT(Lambertson)
AP_IGNOREELEMENT(Marker)
AP_IGNOREELEMENT(Monitor)
AP_IGNOREELEMENT(Multipole)
AP_IGNOREELEMENT(ParallelPlate)
AP_IGNOREELEMENT(Probe)
AP_IGNOREELEMENT(RBend)
AP_VISITELEMENT(RFCavity)
AP_IGNOREELEMENT(RFQuadrupole)
AP_IGNOREELEMENT(SBend)
AP_IGNOREELEMENT(Separator)
AP_IGNOREELEMENT(Septum)
AP_IGNOREELEMENT(Solenoid)
AP_VISITELEMENT(TravelingWave)
private:
double APtrack(const std::shared_ptr<Component> &cavity, double cavity_start, const double &phi) const;
void track(double uptoSPos,
size_t &step,
std::queue<double> &dtAllTracks,
std::queue<double> &maxZ,
std::queue<unsigned long long> &maxTrackSteps);
double getEnergyMeV(const Vector_t &p);
void evaluateField();
std::shared_ptr<Component> getNextCavity(const std::shared_ptr<Component> &current);
void advanceTime(size_t & step, const size_t maxSteps, const double beginNextCavity);
double guessCavityPhase(const std::shared_ptr<Component> &);
double optimizeCavityPhase(const std::shared_ptr<Component> &,
double initialPhase,
size_t currentStep,
double dt);
double getBeginCavity(const std::shared_ptr<Component> &);
double getEndCavity(const std::shared_ptr<Component> &);
void sendCavityPhases();
void receiveCavityPhases();
void printCavityPhases();
OpalBeamline itsOpalBeamline_m;
PartBunchBase<double, 3> itsBunch_m;
BorisPusher itsPusher_m;
Layout_t *particleLayout_m;
IpplTimings::TimerRef timeIntegrationTimer_m;
IpplTimings::TimerRef fieldEvaluationTimer_m;
};
inline
void AutophaseTracker::visitBeamline(const Beamline &bl) {
bl.iterate(*dynamic_cast<BeamlineVisitor *>(this), false);
}
inline
double AutophaseTracker::getEnergyMeV(const Vector_t &p) {
return (sqrt(dot(p, p) + 1.0) - 1.0) * itsBunch_m.getM() * 1e-6;
}
inline
double AutophaseTracker::getBeginCavity(const std::shared_ptr<Component> &comp) {
if (comp == NULL) return -1e6;
double startComp = 0.0, endComp = 0.0;
comp->getDimensions(startComp, endComp);
return startComp;
}
inline
double AutophaseTracker::getEndCavity(const std::shared_ptr<Component> &comp) {
if (comp == NULL) return -1e6;
double startComp = 0.0, endComp = 0.0;
comp->getDimensions(startComp, endComp);
return endComp;
}
#endif
\ No newline at end of file
This diff is collapsed.
#ifndef CLASSIC_BeamBeam3D_HH
#define CLASSIC_BeamBeam3D_HH
// ------------------------------------------------------------------------
// $RCSfile: BeamBeam3D.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamBeam3D
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:35 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/BeamBeam.h"
#include "Algorithms/OpalParticle.h"
#include "BeamlineGeometry/NullGeometry.h"
#include "Fields/NullField.h"
#include "FixedAlgebra/FMatrix.h"
#include <complex>
#include <vector>
template <class T, unsigned Dim>
class PartBunchBase;
template <class T, int N> class FTps;
template <class T, int N> class FVps;
typedef FTps<double, 6> Series;
typedef FVps<double, 6> Map;
// Class BeamBeam3D
// ------------------------------------------------------------------------
/// A concrete representation for a beam-beam interaction.
// The ``strong'' bunch has a Gaussian distribution of the form
// [pre]
// N(x,y,s) = c * exp(- transpose(z - delta) sigma**(-1) (z - delta)),
// [/pre]
// with the definitions
// [ol]
// [li] [b]z[/b]: position vector in space,
// [li] [b]delta[/b]: centroid of strong bunch in global reference system,
// [li] [b]sigma[/b]: "beam" matrix in the TRANSPORT sense,
// [li] [b]c[/b]: a normalising factor, such that the total charge is Q,
// [li] [b]sigma(i,i)[/b]: standard deviation sigma(i) in direction i,
// [li] [b]r(i,j)[/b]: = sigma(i,j) / sqrt(sigma(i,i)*sigma(i,j)),
// correlations between phase space coordinates $i$ and $j$.
// [/ol]
// ***** MISSING ***** This class needs further work, based on the report
// 6D Beam-Beam Kick including Coupled Motion by Leunissen et al.
class BeamBeam3D: public BeamBeam {
public:
/// Collection of lattice functions and emittances.
struct Beta {
double betax, alphax, etax, etapx, emitx;
double betay, alphay, etay, etapy, emity;
double sigt, sige;
};
/// Constructor with given name.
explicit BeamBeam3D(const std::string &name);
BeamBeam3D();
BeamBeam3D(const BeamBeam3D &right);
virtual ~BeamBeam3D();
/// Apply visitor to BeamBeam.
virtual void accept(BeamlineVisitor &) const;
/// Return exact copy of the element.
virtual ElementBase *clone() const;
/// Return a channel to an attribute.
virtual Channel *getChannel(const std::string &aKey, bool create = false);
/// Return the zero electromagnetic field.
virtual NullField &getField();
/// Return the zero electromagnetic field. Version for const object.
virtual const NullField &getField() const;
/// Return the null geometry.
virtual NullGeometry &getGeometry();
/// Return the null geometry. Version for const object.
virtual const NullGeometry &getGeometry() const;
/// Return an image of the element.
virtual ElementImage *getImage() const;
/// Return type name string.
virtual ElementBase::ElementType getType() const;
/// Get the bunch charge.
// Return number of particles times the particle charge in the strong
// bunch. Units are proton charges.
virtual double getBunchCharge() const;
/// Get the moment matrix for the strong bunch.
// Return matrix of second momenta. Units are square metres.
virtual const Matrix3D &getBunchMoment() const;
/// Get displacement vector for the strong bunch.
// Return the displacement in metres.
virtual const Vector3D &getBunchDisplacement() const;
/// Set the pointer to the complex error function.
// Changing this pointer allows use of a different, potentially
// faster algorithm for determination of the kick.
void setErrorFunctionPointer
(std::complex<double> (*fun)(std::complex<double>));
/// Set the crossing angle.
void setCrossingAngle(double);
/// Set the proportionality factor.
void setBeamBeamParameter(double);
/// Store the description of the strong beam.
// [b]disp[/b] is the displacement of the closed orbit of the strong beam.
// [b]latFun[/b] is the collection of lattice functions and emittances of
// the strong beam.
void setBeamDescription(const Vector3D &disp, const Beta &latFun);
/// Select number of slices for strong beam.
void setSlices(int);
/// Track a particle bunch.
virtual void trackBunch
(PartBunchBase<double, 3> *, const PartData &, bool revBeam, bool revTrack) const;
/// Track a transfer map.
virtual void trackMap
(Map &map, const PartData &, bool revBeam, bool revTrack) const;
private:
// Representation of a single slice in the strong beam.
struct Slice {
double xstar, ystar, zstar; // Slice position.
double sigx, sigpx, sigy, sigpy; // Standard deviations.
};
// Not implemented.
void operator=(const BeamBeam3D &);
// Lorenz boost.
void boost(PartBunchBase<double, 3> *bunch) const;
void boost(Map &map) const;
// Inverse Lorenz boost.
void boosti(PartBunchBase<double, 3> *bunch) const;
void boosti(Map &map) const;
// Compute internal quantities.
void computeF();
void computeSlices();
// Apply synchro-beam collision.
void synchroBeamCollision(PartBunchBase<double, 3> *bunch) const;
void synchroBeamCollision(Map &map) const;
// Apply beam-beam kick for one slice.
void bbf(double sepx, double sepy, double sigxx, double sigyy,
double &bbfx, double &bbfy, double &bbgx, double &bbgy)
const;
void bbf(const Series &sepx, const Series &sepy,
const Series &sigxx, const Series &sigyy,
Series &bbfx, Series &bbfy, Series &bbgx, Series &bbgy)
const;
// The zero magnetic field.
NullField field;
// The geometry (a straight geometry with zero length).
NullGeometry geometry;
// The pointer to the complex error function.
// Can be replaced by a call to setErrorFunctionPointer().
std::complex<double> (*errorFunction)(std::complex<double>);
// The crossing angle.
double phi;
double cphi, sphi, tphi;
// Factor describing the effect of one slice.
double F;
// The beam-beam parameter.
double xiyn;
// The extent of the strong beam.
double sigx, sigy;
// The normalising matrix.
FMatrix<double, 6, 6> D;
// Displacement of the strong beam.
Vector3D displacement;
// Lattice functions for the strong beam.
Beta lf;
// The table of slices.
std::vector<Slice> slices;
int nsli;
// Maximum normalised amplitudes of this beam.
mutable double axmax, aymax;
};
#endif // CLASSIC_BeamBeam3D_HH
\ No newline at end of file
set (_SRCS
Hamiltonian.cpp
CavityAutophaser.cpp
Ctunes.cpp
IndexMap.cpp
OrbitThreader.cpp
BeamBeam3D.cpp
Hamiltonian.cpp
LieMapper.cpp
MapAnalyser.cpp
lomb.cpp
NilTracker.cpp
MapAnalyser.cpp
MPSplitIntegrator.cpp
ThickMapper.cpp
ThickTracker.cpp
# AutophaseTracker.cpp
CavityAutophaser.cpp
Ctunes.cpp
lomb.cpp
OrbitThreader.cpp
ParallelTTracker.cpp
ParallelCyclotronTracker.cpp
ParallelSliceTracker.cpp
StatisticalErrors.cpp
StatisticalErrorsUtilities.cpp
ThickMapper.cpp
ThickTracker.cpp
TransportMapper.cpp
bet/EnvelopeSlice.cpp
bet/EnvelopeBunch.cpp
......@@ -41,8 +39,6 @@ include_directories (
add_opal_sources(${_SRCS})
set (HDRS
#AutophaseTracker.h
BeamBeam3D.h
CavityAutophaser.h
Ctunes.h
Hamiltonian.h
......
......@@ -86,13 +86,12 @@ add_subdirectory (Classic)
add_subdirectory (Distribution)
add_subdirectory (Editor)
add_subdirectory (Elements)
add_subdirectory (Errors)
add_subdirectory (Expressions)
add_subdirectory (Lines)
add_subdirectory (Match)
add_subdirectory (OpalConfigure)
add_subdirectory (OpalParser)
add_subdirectory (Optimize)
add_subdirectory (Match)
add_subdirectory (PhysicsActions)
add_subdirectory (Sample)
add_subdirectory (Solvers)
......
......@@ -17,15 +17,7 @@ add_subdirectory(Parser)
add_subdirectory(Physics)
add_subdirectory(Solvers)
add_subdirectory(Structure)
add_subdirectory(Utilities)
add_subdirectory(TrimCoils)
install (FILES Utilities/ClassicException.h Utilities/ClassicRandom.h Utilities/Options.h Utilities/OptionTypes.h
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/Utilities"
)
add_subdirectory(Utilities)
set(OPAL_SRCS "${OPAL_SRCS}" PARENT_SCOPE)
#Turn on gcov
set(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
#include "gtest/gtest.h"
//#include "AbsBeamline/Bend.h"
#include "Fields/Fieldmap.h"
#include "AbsBeamline/BeamlineVisitor.h"
TEST(DivB, Zero)
{
int testparam = 5
EXPECT_EQ(testparam, 5);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
// =========================================================================
//
// Main.cc
// CLASSIC test program
//
// Author: F. C. Iselin, CERN, SL/AP Group
//
// Copyright (c) 1995 (see file Copyright.hh)
//
// =========================================================================
#include "Parser/ClassicParser.h"
#include "Parser/FileStream.h"
#include "Parser/TerminalStream.h"
#include <iostream>
int main(int argc, char *argv[]) {
std::cerr << "This is the CLASSIC test program, Version 1.0/1 (c) 1996."
<< std::endl;
ClassicParser parser;
if(argc < 2) {
// Run commands from standard input
TerminalStream is("CLASSIC");
parser.run(&is);
} else {
FileStream is(argv[1]);
std::cerr << "Reading input stream \"" << argv[1] << "\"." << std::endl;
FileStream::setEcho(true);
parser.run(&is);
std::cerr << "End of input stream \"" << argv[1] << "\"." << std::endl;
}
return 0;
}
Classic 5.0 Build Instructions for OPAL 1.1.5
---------------------------------------------
Replace the path with your one.
Date: April. 18 2009