|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.miv.pherd.Particle
public abstract class Particle
Base class for particles.
This class is the basis used to build particles classes. It has a unique identifier, a position as a point in space, a weight as a scalar, and references a cell that contains it.
This class is abstract, the only method that must be implemented is the move(int)
method. This method must store in the nextPos field the position of the particle
at the next time step. The current time step is given as argument.
| Field Summary | |
|---|---|
protected HashMap<String,Object> |
attributes
The particle attributes. |
protected ParticleBox |
box
The particle box containing this particle. |
protected Cell |
cell
Cell containing this particle. |
protected Object |
id
Particle identifier. |
protected boolean |
moved
Flag used to avoid doing work on a particle that did not moved. |
protected Point3 |
nextPos
The computed next particle position. |
protected Point3 |
pos
Particle position. |
protected double |
weight
The particle importance. |
| Constructor Summary | |
|---|---|
Particle(Object id)
Particle at (0,0,0). |
|
Particle(Object id,
double x,
double y,
double z)
New particle at (x,y,z). |
|
| Method Summary | |
|---|---|
boolean |
closeTo(Particle other)
Like closeTo(Particle, double) with a delta of 0.001f. |
boolean |
closeTo(Particle other,
double delta)
Is the given particle close to this one. |
Object |
getAttribute(String attribute)
The value associated with one of the particle attributes. |
Iterator<String> |
getAttributeKeyIterator()
Iterator on the set of attribute keys. |
Cell |
getCell()
The cell actually responsible for this particle. |
Object |
getId()
The particle unique identifier. |
Point3 |
getPosition()
Particle position. |
double |
getWeight()
Particle importance, or weight or mass. |
protected void |
initPos(double x,
double y,
double z)
Can be used in the constructor to initialise a first position. |
abstract void |
inserted()
The particle was just inserted in a particle box. |
abstract void |
move(int time)
Should compute the next position from the current position. |
void |
nextStep(int time)
Copy the next computed position from the current position. |
void |
removeAttribute(String attribute)
|
abstract void |
removed()
The particle is about to be removed from the particle box. |
void |
setAttribute(String attribute,
Object... values)
|
protected void |
setBox(ParticleBox box)
Called by the particle box when this particle is inserted in it. |
void |
setCell(Cell responsible)
Cell of the n-tree that handles this particle. |
void |
setWeight(double newWeight)
The importance (weight, mass, etc.) of the particle. |
void |
suicide()
Make this particle disappear from its particle box. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Object id
protected Point3 pos
protected Point3 nextPos
protected double weight
protected Cell cell
protected ParticleBox box
protected HashMap<String,Object> attributes
protected boolean moved
nextStep(int), and should be set
to true in move(int) in order to effectively move the particle.
| Constructor Detail |
|---|
public Particle(Object id,
double x,
double y,
double z)
id - Particle identifier.x - Abscissa position.y - Ordinate position.z - Depth position.public Particle(Object id)
id - Particle identifier.| Method Detail |
|---|
protected void initPos(double x,
double y,
double z)
x - Abscissa position.y - Ordinate position.z - Depth position.public Object getId()
public Point3 getPosition()
public Cell getCell()
public boolean closeTo(Particle other)
closeTo(Particle, double) with a delta of 0.001f.
other - The other particle to test.
public boolean closeTo(Particle other,
double delta)
other - The other particle to test.delta - The distance threshold (included) to consider the other
particle is close to this one.
public double getWeight()
public Object getAttribute(String attribute)
attribute - The attribute.
public Iterator<String> getAttributeKeyIterator()
public void setCell(Cell responsible)
responsible - The cell that is now responsible for this particle.public void setWeight(double newWeight)
newWeight - The new value.
public void setAttribute(String attribute,
Object... values)
public void removeAttribute(String attribute)
public abstract void move(int time)
moved must be set to "true" if this method did
something and to false to avoid processing this particle any further
if nothing has been done. This allows to avoid unwanted computation for
particles that do not move.
time - The current iteration.public abstract void inserted()
public abstract void removed()
public void nextStep(int time)
time - The current iteration.protected void setBox(ParticleBox box)
box - The particle box that now contains this particle.public void suicide()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||