Commit 91c6d77b authored by snuverink_j's avatar snuverink_j
Browse files

cleanup unused code, some from #62

parent cb4eaa54
......@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string interPol_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......
......@@ -24,10 +24,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string interPol_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......
......@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string interPol_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......@@ -247,16 +243,4 @@ int main(int argc, char *argv[])
testmsg << " nx= " << nx << " ny= " << ny << " nz= " << nz;
testmsg << " ||d||= " << fabs(realDiff) << endl;
return 0;
}
/***************************************************************************
* $RCSfile: TestFFT-SSP.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:36 $
***************************************************************************/
/***************************************************************************
* $RCSfile: addheaderfooter,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $
* IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $
***************************************************************************/
}
\ No newline at end of file
......@@ -49,10 +49,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string interPol_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......
......@@ -51,10 +51,6 @@ bool Configure(int argc, char *argv[], InterPolT *interPol,
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string interPol_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......
......@@ -26,9 +26,6 @@ bool Configure(int argc, char *argv[],
Inform msg("Configure ");
Inform errmsg("Error ");
string bc_str;
string dist_str;
for (int i=1; i < argc; ++i) {
string s(argv[i]);
if (s == "-grid") {
......@@ -167,8 +164,8 @@ int main(int argc, char *argv[])
BareField<double,D> RFieldSPStan_save(layoutSPStan);
BareField<std::complex<double>,D> CFieldSPStan0h(layoutSPStan0h);
INFOMSG("RFieldSPStan layout= " << layoutSPStan << endl;);
INFOMSG("CFieldSPStan0h layout= " << layoutSPStan0h << endl;);
INFOMSG("RFieldSPStan layout= " << layoutSPStan << endl);
INFOMSG("CFieldSPStan0h layout= " << layoutSPStan0h << endl);
// For calling FieldDebug functions from debugger, set up output format:
setFormat(4,3);
......
......@@ -195,7 +195,7 @@ void PwrSpec<T,Dim>::CICforward(ChargedParticles<T,Dim> *univ)
rho_m[gDomainL_m] = rhocic_m[gDomainL_m];
INFOMSG("rhocic_m= " << sum(rhocic_m) << " sum(M)= " << sum(univ->M) << " rho_m= " << sum(rho_m) << endl;);
INFOMSG("rhocic_m= " << sum(rhocic_m) << " sum(M)= " << sum(univ->M) << " rho_m= " << sum(rho_m) << endl);
}
/***************************************************************************
......
......@@ -474,7 +474,7 @@ public:
smsg->put(tmp[i]);
bool res = Ippl::Comm->send(smsg, 0, tag);
if (! res)
ERRORMSG("Ippl::Comm->send(smsg, 0, tag) failed " << endl;);
ERRORMSG("Ippl::Comm->send(smsg, 0, tag) failed " << endl);
}
}
......
......@@ -211,8 +211,6 @@ int main(int argc, char *argv[]){
Inform msg(argv[0]);
Inform msg2all(argv[0],INFORM_ALL_NODES);
// variable declarations
int i,j,k;
// indices of the 3D array of cells
int nx, ny, nz;
// total number of cells along the x, y, and z axes, respectively
......
......@@ -38,9 +38,6 @@ class BoundaryGeometry;
// store element name, max phase
typedef std::pair<std::string, double > MaxPhasesT;
typedef std::map<double, double> energyEvolution_t;
typedef energyEvolution_t::value_type energyEvData_t;
// Class OpalData
// ------------------------------------------------------------------------
......
......@@ -899,7 +899,7 @@ void ParallelCyclotronTracker::visitRFCavity(const RFCavity &as) {
RFCavity *elptr = dynamic_cast<RFCavity *>(as.clone());
myElements.push_back(elptr);
if((elptr->getComponentType() != "SINGLEGAP") && (elptr->getComponentType() != "DOUBLEGAP")) {
if ( elptr->getComponentType() != "SINGLEGAP" ) {
*gmsg << (elptr->getComponentType()) << endl;
throw OpalException("ParallelCyclotronTracker::visitRFCavity",
"The ParallelCyclotronTracker can only play with cyclotron type RF system currently ...");
......@@ -1633,7 +1633,7 @@ double ParallelCyclotronTracker::getHarmonicNumber() const {
return elcycl->getCyclHarm();
throw OpalException("ParallelCyclotronTracker::getHarmonicNumber()",
std::string("The first item in the FieldDimensions list does not ")
+std::string("seem to be an Ring or a Cyclotron element"));
+std::string("seem to be a Ring or a Cyclotron element"));
}
......
......@@ -52,8 +52,6 @@ int LOMB_class::period(std::vector<LOMB_TYPE> *indata, std::vector<LOMB_TYPE> *o
LOMB_TYPE pt;
CI_lt p, q;
CI_vd ai;
/*---------------------------------------------------------------------------*/
wi.erase(wi.begin(), wi.end());
......@@ -266,10 +264,7 @@ int LOMB_class::moment(std::vector<LOMB_TYPE> *indata, double *ave, double *adev
int n;
double pnr, s, ep;
std::vector<double> xvec;
CI_lt p, q;
CI_vd xp;
/*---------------------------------------------------------------------------*/
p = indata->begin();
......
......@@ -496,9 +496,9 @@ void AmrYtWriter::writeBunch(const AmrPartBunch* bunch_p,
std::string filePrefix(LevelDir);
filePrefix += '/';
filePrefix += "DATA_";
bool groupSets(false), setBuf(true);
if (gotsome) {
bool groupSets(false), setBuf(true);
for(amrex::NFilesIter nfi(nOutFiles, filePrefix, groupSets, setBuf); nfi.ReadyToWrite(); ++nfi) {
std::ofstream& myStream = (std::ofstream&) nfi.Stream();
//
......
......@@ -39,7 +39,7 @@ public:
* @param step we write
* @param bin energy bin we write (multi-bunch simulation)
*/
AmrYtWriter(int step, int bin = 0);
explicit AmrYtWriter(int step, int bin = 0);
/*!
* Write yt files to the simulation subdirectory
......
......@@ -534,7 +534,7 @@ double RFCavity::getAutoPhaseEstimateFallback(double E0, double t0, double q, do
}
double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const double &q, const double &mass) {
std::vector<double> t, E, t2, E2;
std::vector<double> t, E, t2, E2;
std::vector<double> F;
std::vector< std::pair< double, double > > G;
gsl_spline *onAxisInterpolants;
......@@ -543,6 +543,7 @@ double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const
double phi = 0.0, tmp_phi, dphi = 0.5 * Physics::pi / 180.;
double dz = 1.0, length = 0.0;
fieldmap_m->getOnaxisEz(G);
if (G.size() == 0) return 0.0;
double begin = (G.front()).first;
double end = (G.back()).first;
std::unique_ptr<double[]> zvals( new double[G.size()]);
......@@ -628,9 +629,9 @@ double RFCavity::getAutoPhaseEstimate(const double &E0, const double &t0, const
t[i] = t[i - 1] + getdT(i, E, dz, mass);
t2[i] = t2[i - 1] + getdT(i, E2, dz, mass);
E[i] = E[i - 1];
E[i] = E [i - 1];
E2[i] = E2[i - 1];
E[i] += q * scale_m * getdE(i, t, dz, phi, frequency_m, F) ;
E[i] += q * scale_m * getdE(i, t, dz, phi, frequency_m, F) ;
E2[i] += q * scale_m * getdE(i, t2, dz, phi + dphi, frequency_m, F);
}
......
......@@ -199,7 +199,6 @@ void TravelingWave::initialise(PartBunchBase<double, 3> *bunch, double &startFie
}
Inform msg("TravelingWave ", *gmsg);
std::stringstream errormsg;
RefPartBunch_m = bunch;
double zBegin = 0.0, zEnd = 0.0;
......
......@@ -345,7 +345,7 @@ void PartBunch::resizeMesh() {
R[n](1) < ymin || R[n](1) > ymax) {
// delete the particle
INFOMSG(level2 << "destroyed particle with id=" << ID[n] << endl;);
INFOMSG(level2 << "destroyed particle with id=" << ID[n] << endl);
destroy(1, n);
}
......@@ -831,38 +831,6 @@ void PartBunch::updateFields(const Vector_t& /*hr*/, const Vector_t& origin) {
vbc_m);
}
/**
* Here we emit particles from the cathode. All particles in a new simulation (not a restart) initially reside in the bin
container "pbin_m" and are not part of the beam bunch (so they cannot "see" fields, space charge etc.). In pbin_m, particles
are sorted into the bins of a time histogram that describes the longitudinal time distribution of the beam, where the number
of bins is given by \f$NBIN \times SBIN\f$. \f$NBIN\f$ and \f$SBIN\f$ are parameters given when defining the initial beam
distribution. During emission, the time step of the simulation is set so that an integral number of these bins are emitted each step.
Once all of the particles have been emitted, the simulation time step is reset to the value defined in the input file.
A typical integration time step, \f$\Delta t\f$, is broken down into 3 sub-steps:
1) Drift particles for \f$\frac{\Delta t}{2}\f$.
2) Calculate fields and advance momentum.
3) Drift particles for \f$\frac{\Delta t}{2}\f$ at the new momentum to complete the
full time step.
The difficulty for emission is that at the cathode position there is a step function discontinuity in the fields. If we
apply the typical integration time step across this boundary, we get an artificial numerical bunching of the beam, especially
at very high accelerating fields. This function takes the cathode position boundary into account in order to achieve
smoother particle emission.
During an emission step, an integral number of time bins from the distribution histogram are emitted. However, each particle
contained in those time bins will actually be emitted from the cathode at a different time, so will only spend some fraction
of the total time step, \f$\Delta t_{full-timestep}\f$, in the simulation. The trick to emission is to give each particle
a unique time step, \f$Delta t_{temp}\f$, that is equal to the actual time during the emission step that the particle
exists in the simulation. For the next integration time step, the particle's time step is set back to the global time step,
\f$\Delta t_{full-timestep}\f$.
*/
inline
PartBunch::VectorPair_t PartBunch::getEExtrema() {
const Vector_t maxE = max(eg_m);
......
......@@ -290,6 +290,10 @@ MapType Fieldmap::readHeader(std::string Filename) {
if (Filename == "1DPROFILE1-DEFAULT")
return T1DProfile1;
if (Filename.empty())
throw GeneralClassicException("Fieldmap::readHeader()",
"No field map file specified");
if (!fs::exists(Filename))
throw GeneralClassicException("Fieldmap::readHeader()",
"File \"" + Filename + "\" doesn't exist");
......
......@@ -374,17 +374,6 @@ template <class Tmplt> std::istream& operator>>(std::istream& in, MMatrix<Tmplt>
///////////////// INTERFACES
const gsl_matrix* MMatrix_to_gsl(const MMatrix<double>& m)
{
if(m._matrix == NULL) throw(GeneralClassicException("MMatrix_to_gsl", "Attempt to reference uninitialised matrix"));
return (gsl_matrix*)m._matrix;
}
const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<m_complex>& m)
{
if(m._matrix == NULL) throw(GeneralClassicException("MMatrix_to_gsl", "Attempt to reference uninitialised matrix"));
return (gsl_matrix_complex*)m._matrix;
}
MMatrix<double> re(MMatrix<m_complex> mc)
{
......
......@@ -172,10 +172,7 @@ public:
friend MMatrix<m_complex>& operator +=(MMatrix<m_complex>& m1, const MMatrix<m_complex>& m2);
friend MMatrix<double>& operator +=(MMatrix<double>& m1, const MMatrix<double>& m2);
template <class Tmplt2> friend MMatrix<Tmplt2> operator + (MMatrix<Tmplt2> m1, const MMatrix<Tmplt2> m2);
friend const gsl_matrix* MMatrix_to_gsl(const MMatrix<double>& m);
friend const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<gsl_complex>& m);
friend class MMatrix<double>; //To do the eigenvector problem, MMatrix<double> needs to see MMatrix<complex>'s _matrix
......@@ -233,10 +230,6 @@ MMatrix<double> im(MMatrix<m_complex> m);
MMatrix<m_complex> complex(MMatrix<double> real);
MMatrix<m_complex> complex(MMatrix<double> real, MMatrix<double> imaginary);
//return pointer to gsl_matrix objects that store matrix data in m
const gsl_matrix* MMatrix_to_gsl(const MMatrix<double>& m);
const gsl_matrix_complex* MMatrix_to_gsl(const MMatrix<gsl_complex>& m);
//////////////////////////// MMatrix declaration end ///////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment