public class Ensemble
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Ensemble()
Creates a new instance of Ensemble
|
Ensemble(Ensemble ens)
Create a deep copy clone of an ensemble object
|
Modifier and Type | Method and Description |
---|---|
void |
add(Particle p)
Add a particle to ensemble
|
Ensemble |
deepCopy()
Create a deep copy object of this ensemble
|
protected java.util.TreeSet<Particle> |
deepCopyParticles(Ensemble ens)
Make a deep copy of the ensemble's particle container.
|
int |
getCount()
Get size of ensemble
|
java.util.Iterator<Particle> |
iterator()
Iterate through ensemble
|
boolean |
load(java.io.File file)
Populate the ensemble from a data file.
|
boolean |
load(java.lang.String strFile)
Populate the ensemble from a data file.
|
static void |
main(java.lang.String[] arg)
Test driver for testing Ensemble class.
|
CovarianceMatrix |
phaseCovariance()
Get the correlation matrix of the ensemble in homogeneous coordinates
|
PhaseVector |
phaseMean()
Compute the centroid of the ensemble
|
double |
potentialQuadExpansion(R3 pt,
double Q,
PhaseMatrix matSigma)
Computes the electric potential from a quadrupole multipole expansion.
|
double |
potentialSummation(R3 ptFld)
Computes the Coulomb potential of the ensemble at the given field point.
|
void |
print(java.io.PrintWriter os)
Print out contents of the ensemble.
|
static Ensemble |
restoreUrl(java.lang.String strUrl)
Creates an Ensemble from a file store.
|
double[] |
rmsEmittances()
Compute the rms emittances in each phase plane
|
boolean |
save(java.io.File file)
Save ensemble state to persisten disk file.
|
static void |
testPersistence(java.io.PrintWriter osLog)
Test the file persistence mechanism.
|
double |
totalCharge()
Get the total charge of the ensemble
|
R3 |
totalCurrent()
Get the total current of the ensemble.
|
public Ensemble()
public Ensemble(Ensemble ens)
ens
- ensemble object to be deep copiedpublic static Ensemble restoreUrl(java.lang.String strUrl) throws java.io.IOException
strUrl
- the URL of the file storejava.io.IOException
- unable to read file at URLpublic Ensemble deepCopy()
public void add(Particle p)
public java.util.Iterator<Particle> iterator()
public int getCount()
public PhaseVector phaseMean()
public CovarianceMatrix phaseCovariance()
public double[] rmsEmittances()
public R3 totalCurrent()
NOTE: If the momentum components of the particle phases are not the velocities, the return value must be scaled. For example, if the trace space values are used then the returned value must be multiplied by beta*c.
public double totalCharge()
public double potentialSummation(R3 ptFld)
The potentials from every ensemble particle are summed at the field point and no averaging is performed. Thus, vary large potential values may occur if the field point is sufficiently near an ensemble particle.
ptFld
- field point to evaluate the potentialpublic double potentialQuadExpansion(R3 pt, double Q, PhaseMatrix matSigma)
Use this method when the ensemble particles all have the same charge, since the covariance matrix is used to compute the moments of the multipole expansion. The covariance matrix is with respect to the phase coordinates and, thus, all particles receive equal weighting.
This method uses the multipoles up to the quadrupole moment, as taken from the covariance matrix. The expansion is taken from the centroid of the distribution, as such the dipole moments are zero at that point. Thus, the result potential field appears to be generated from the centroid as a point particle along with the quadrupole fields due to the cross moments.
This method is intended for determining the potential at many fields points for the same ensemble configuration. To avoid repeated calculations of the covariance matrix (using getSigma()) this matrix should be called once and passed to this method on each invocation with the same ensemble configuration.
pt
- field point to evaluate the potentialpublic boolean load(java.lang.String strFile)
strFile
- descriptor of file containing persistent datapublic boolean load(java.io.File file)
file
- descriptor of file containing persistent datapublic boolean save(java.io.File file)
file
- file containing persistent datapublic void print(java.io.PrintWriter os)
public static void main(java.lang.String[] arg)
public static void testPersistence(java.io.PrintWriter osLog)
osLog
- output stream to send logging information