|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.miv.pherd.ntree.Cell
public class Cell
A cell of the n-Tree. TODO: dès qu'une particule est ajoutée il peut y avoir mitose. Dès qu'une particule est enlevée il y a fusion. Cependant, durant le déplacement des particules (qui se fait de manière itérative, toutes les particules calculent leur nouvelle position, puis bougent. Ne serait-il pas plus efficace de réadapter l'arbre uniquement une fois que toutes les particules on bougé, et non pas à chaque particule ? C'est la raison pour laquelle certaines méthodes sont suffixées par "Direct". Elles agissent directement. Les méthodes équivalentes sans le suffixe "Direct" elles fonctionne itérativement.
NTree| Field Summary | |
|---|---|
protected CellData |
data
The data specific to a given particle simulation. |
protected int |
depth
Depth in the tree (distance from the root). |
protected String |
id
The cell identifier. |
protected int |
index
Cell index in its mother. |
protected Cell |
parent
Mother cell. |
protected HashMap<Object,Particle> |
particles
Particle bucket. |
protected int |
population
The total particle population handled by this cell, counting its subcells population, as only leafs contains particles. |
protected CellSpace |
space
The space occupied by this cell. |
protected Cell[] |
sub
Daughter cells. |
protected NTree |
tree
The tree containing me. |
| Constructor Summary | |
|---|---|
protected |
Cell(Cell parent,
int index,
CellSpace space,
CellData data)
Used to create a subcell. |
|
Cell(NTree tree,
CellSpace space,
String id,
CellData data)
Create a root cell in a given space. |
| Method Summary | |
|---|---|
void |
addParticle(Particle particle)
Add a particle in the n-Tree. |
boolean |
contains(double x,
double y,
double z)
Does this cell contains the given position ?. |
boolean |
contains(Particle particle)
Does this cell contains the position of the given particle ?. |
protected void |
describe(NTreeListener listener)
Send the state of this cell to the given listener, then recurse on all subcells if any. |
protected void |
fusion()
|
CellData |
getData()
This cell data. |
int |
getDepth()
Depth of this cell. |
String |
getId()
Cell identifier. |
int |
getIndex()
The cell index in its mother cell. |
Cell |
getParent()
The parent cell, if any. |
Iterator<? extends Particle> |
getParticles()
Set of stored particles, if this cell is a leaf, else null. |
int |
getPopulation()
The total population of particle this cell stores. |
CellSpace |
getSpace()
This cell space region. |
Cell |
getSub(int i)
The i-th subcell or null if there is a leaf cell. |
NTree |
getTree()
The cell tree. |
boolean |
hasParticle(Particle particle)
True if the cell has the particle as a child. |
boolean |
isLeaf()
Is this cell a leaf?. |
boolean |
isRoot()
Is this cell a root cell?. |
boolean |
isValid()
|
protected void |
mitosis()
Subdivide a cell into several sub-cells according to the currently used cell space. |
void |
particleMoved(Particle particle)
Message from a particle to indicate it moved. |
void |
recompute()
Recursively check cells to see if they need fusion or subdivision and send a recompute signal to all cell data elements. |
void |
removeParticle(Object id)
Remove a particle from the n-Tree. |
protected void |
resize(Point3 min,
Point3 max)
Resize the cell space so that |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String id
protected NTree tree
protected int depth
protected int index
protected Cell parent
protected Cell[] sub
protected CellSpace space
protected CellData data
protected HashMap<Object,Particle> particles
protected int population
| Constructor Detail |
|---|
public Cell(NTree tree,
CellSpace space,
String id,
CellData data)
tree - The n-tree containing this root cell.space - The space occupied by this cell.data - The cell data.
protected Cell(Cell parent,
int index,
CellSpace space,
CellData data)
parent - The parent cell.index - The cell index in its parent.space - The space occupied by this cell.data - The cell data.| Method Detail |
|---|
public NTree getTree()
public String getId()
public boolean isLeaf()
public boolean isRoot()
public int getPopulation()
public Cell getParent()
public Cell getSub(int i)
i - The subcell index.
public int getDepth()
public int getIndex()
public CellSpace getSpace()
public CellData getData()
public Iterator<? extends Particle> getParticles()
public boolean contains(Particle particle)
particle - The particle to classify.
hasParticle(Particle)
public boolean contains(double x,
double y,
double z)
x - The abscissa.y - The ordinate.z - The depth.
public boolean hasParticle(Particle particle)
particle - The particle to test.
contains(Particle)public void addParticle(Particle particle)
recompute()
method will be called.
particle - The particle to add.public void removeParticle(Object id)
recompute() method will be called.
id - The particle identifier.public void particleMoved(Particle particle)
recompute()
method is called.
particle - The particle that moved.public void recompute()
protected void mitosis()
protected void fusion()
protected void describe(NTreeListener listener)
listener - The listener that should receive the subtree description.
protected void resize(Point3 min,
Point3 max)
min - The lowest new space point.max - The hihest new space point.public String toString()
toString in class Objectpublic boolean isValid()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||