spis.Util.List
Class PartList

java.lang.Object
  extended byspis.Util.List.PointList
      extended byspis.Util.List.PartList
Direct Known Subclasses:
RichPartList

public class PartList
extends PointList

Class Name : PartList
Project ref : SPIS project
File name : PartList.java
File type : class
Copyright : ONERA, 2 Av. E. Belin, 31055 Toulouse cedex, France http://www.onecert.fr
Status : under development
Creation : 25/08/2003
Modification :

Description : List of particles.
Minimal extension of PointList class (by derivation) to describe a particle:
velocity and particle flag are added o position and cell index.
Performs basic operations on particles:
- applyFunc: applies a function on particles
- sort: sorts particles
They should be overriden in most derived classes (to take into account variable particle weight or type, or to sort extra Tables...

Versions and anomalies correction :

Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 JF Roussel, roussel@onecert.frCreation


Version:
0.1
Author:
JF Roussel

Field Summary
protected  IntScalTable flagT
          flag of the particle: -1=no_particle=unoccupied_position 0=in_volume, 1=arrived_on_1st_surface_mesh 2=arrived_on_2nd_surface_mesh
private  FloatScalTable fst
          temporary buffer FloatScalTable (stored in object to avoid memory-reallocation cost)
private  FloatScalTable fst2
          temporary buffer FloatScalTable (stored in object to avoid memory-reallocation cost)
static TestOfInt isEmpty
          Tests whether a particle slot is unoccupied
static TestOfInt isInVol
          Tests whether a particle is in the volume
static TestOfInt isNotInVol
          Tests whether a particle is not in the volume
static TestOfInt isOccupied
          Tests whether a particle slot is occupied
static TestOfInt isOnSurf1
          Tests whether a particle is on 1st surface (boundary)
static TestOfInt isOnSurf2
          Tests whether a particle is on 2nd surface (spacecraft)
protected  Part part
          physical particle type (not used in derived classes with variable particle types)
static ModifInt setEmpty
          Declares a particle slot is unoccupied
static ModifInt setInVol
          Declares a particle is in the volume
static ModifInt setOnSurf1
          Declares a particle is on 1st surface (boundary)
static ModifInt setOnSurf2
          Declares a particle is on 2nd surface (spacecraft)
protected  SurfMesh sm1
          pointer to the surface mesh the index refers to, for particles on a first surface
protected  SurfMesh sm2
          pointer to the surface mesh the index refers to, for particles on a second surface
protected  VeloVectTable veloT
          velocity of the particle
protected  float weight
          particle weight, i.e. number of physical particles represnted by a super-particle (not used in derived classes with variable particle types)
 
Fields inherited from class spis.Util.List.PointList
dim, endId, indexT, posT, startId, vm
 
Constructor Summary
PartList(PartList pl)
          copy constructor (variable arrays are copied, whereas for meshes and particle type pointers only are copied)
PartList(VolMesh vm, SurfMesh bdSurfMesh, SurfMesh scSurfMesh, Part particle, float w)
          Constructor of an empty list (maybe to suppress later)
PartList(VolMesh vm, SurfMesh bdSurfMesh, SurfMesh scSurfMesh, Part particle, float w, int dim)
          Constructor of a list of a given dimension
PartList(VolMesh vm, SurfMesh bdSurfMesh, SurfMesh scSurfMesh, Part particle, float w, IntScalTable flagT_, SpaceVectTable posT, IntScalTable indexT, VeloVectTable veloT_)
          Constructor with full data
 
Method Summary
 void applyFunc(IntScalTable indexTable, FunctionOfParticle f, VectTable refDirection, boolean intensive, boolean indexedFunction, ScalSurfField matModId, ScalSurfField matId, FloatScalTable result)
          Applies the supplied function f to the particles of this list.
 void applyFuncDeprecated(TestOfInt selectPart, IntScalTable selectTable, IntScalTable indexTable, FunctionOfParticleE f, float factor, FloatScalTable result)
          Applies the supplied function of energy f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true.
 void applyFuncDeprecated(TestOfInt selectPart, IntScalTable selectTable, IntScalTable indexTable, FunctionOfParticleETheta f, VectTable refDir_, float factor, FloatScalTable result)
          Applies the supplied function of energy and angle f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true.
 void applyFuncDeprecated(TestOfInt selectPart, IntScalTable selectTable, IntScalTable indexTable, FunctionOfParticleNothing f, float factor, FloatScalTable result)
          Applies the supplied function of nothing f (a constant) to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true.
 void applyFuncDeprecated(TestOfInt selectPart, IntScalTable selectTable, IntScalTable indexTable, FunctionOfParticle f, VectTable refDir, float factor, FloatScalTable result)
          Applies the supplied function of energy f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true.
 void clean(TestOfInt selectPart, IntScalTable selectTable)
          Cleans the list, excluding particles verifying selectPart.test(selectTable[i])
 void computeChargeOverMass(FloatScalTable chargeOverMass)
           
 void concat(PartList plIn)
          concatenates the provided list plIn to this list.
 void extract(PartList plOut, TestOfInt extractTest)
          Extracts the particles of this list fullfilling the condition extractTest.test(flag) to the other list plOut.
 PartList extractFraction(float ratio)
          extracts a fraction of the list (at random)
 void generateSurfaceSample(SurfMesh sm, SurfSampler sampler, float time)
          generates a sample of particles following the passed sampler for velocities, and uniformely on surface mesh for positions.
 void generateVolumeSample(VolSampler sampler)
          generates a sample of particles following the passed sampler for velocities, and uniformely in volume mesh for positions.
 IntScalTable getFlagTable()
           
 TestOfInt getIsOnThisSurfMesh(SurfMesh sm)
           
 Part getPart()
           
 PartList getPartListCopy()
          returns a copy of this list (to be overriden by sub-types)
 PartList getSimilar()
          returns a similar PartList, with same subtype and particle type(s) (and fixed weight), but empty (to be overriden by sub-types (derived classes)
 SurfMesh getSm1()
          return surface mesh 1, usually the external boundary mesh
 SurfMesh getSm2()
          return surface mesh 2, usually the spacecraft mesh
 VeloVectTable getVeloTable()
           
 float getWeight()
           
 void init(int dim)
          intialisations
 void initBuffers(int dim)
          buffer intialisations
 void inject(PartList plIn)
          injects the provided list plIn into this list.
 void setDim(int dimension)
          sets the list dimension to dim: resizes the tables if needed, not preserving data (except if no resizing is needed).
 void setDimPreserve(int dimension)
          sets the list dimension to dim: resizes the tables if needed, not preserving data (except if no resizing is needed).
 
Methods inherited from class spis.Util.List.PointList
declareDim, getDim, getEndId, getIndexTable, getPosTable, getStartId, getVm, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

part

protected Part part
physical particle type (not used in derived classes with variable particle types)


weight

protected float weight
particle weight, i.e. number of physical particles represnted by a super-particle (not used in derived classes with variable particle types)


veloT

protected VeloVectTable veloT
velocity of the particle


flagT

protected IntScalTable flagT
flag of the particle: -1=no_particle=unoccupied_position 0=in_volume, 1=arrived_on_1st_surface_mesh 2=arrived_on_2nd_surface_mesh


sm1

protected SurfMesh sm1
pointer to the surface mesh the index refers to, for particles on a first surface


sm2

protected SurfMesh sm2
pointer to the surface mesh the index refers to, for particles on a second surface


isEmpty

public static TestOfInt isEmpty
Tests whether a particle slot is unoccupied


isOccupied

public static TestOfInt isOccupied
Tests whether a particle slot is occupied


isInVol

public static TestOfInt isInVol
Tests whether a particle is in the volume


isNotInVol

public static TestOfInt isNotInVol
Tests whether a particle is not in the volume


isOnSurf1

public static TestOfInt isOnSurf1
Tests whether a particle is on 1st surface (boundary)


isOnSurf2

public static TestOfInt isOnSurf2
Tests whether a particle is on 2nd surface (spacecraft)


setEmpty

public static ModifInt setEmpty
Declares a particle slot is unoccupied


setInVol

public static ModifInt setInVol
Declares a particle is in the volume


setOnSurf1

public static ModifInt setOnSurf1
Declares a particle is on 1st surface (boundary)


setOnSurf2

public static ModifInt setOnSurf2
Declares a particle is on 2nd surface (spacecraft)


fst

private FloatScalTable fst
temporary buffer FloatScalTable (stored in object to avoid memory-reallocation cost)


fst2

private FloatScalTable fst2
temporary buffer FloatScalTable (stored in object to avoid memory-reallocation cost)

Constructor Detail

PartList

public PartList(VolMesh vm,
                SurfMesh bdSurfMesh,
                SurfMesh scSurfMesh,
                Part particle,
                float w)
Constructor of an empty list (maybe to suppress later)


PartList

public PartList(VolMesh vm,
                SurfMesh bdSurfMesh,
                SurfMesh scSurfMesh,
                Part particle,
                float w,
                int dim)
Constructor of a list of a given dimension

Parameters:
vm - reference volume mesh of the list
bdSurfMesh - boundary surface mesh (No 1)
scSurfMesh - spacecraft surface mesh (No 2)
particle - particles this table is filled with
w - weight of the particles this table is filled with
dim - dimension of the tables to be allocated

PartList

public PartList(VolMesh vm,
                SurfMesh bdSurfMesh,
                SurfMesh scSurfMesh,
                Part particle,
                float w,
                IntScalTable flagT_,
                SpaceVectTable posT,
                IntScalTable indexT,
                VeloVectTable veloT_)
Constructor with full data

Parameters:
vm - reference volume mesh of the list
bdSurfMesh - boundary surface mesh (No 1)
scSurfMesh - spacecraft surface mesh (No 2)
particle - particles this table is filled with
w - weight of the particles this table is filled with
posT - position table
indexT - index table

PartList

public PartList(PartList pl)
copy constructor (variable arrays are copied, whereas for meshes and particle type pointers only are copied)

Method Detail

init

public void init(int dim)
intialisations


initBuffers

public void initBuffers(int dim)
buffer intialisations


extract

public void extract(PartList plOut,
                    TestOfInt extractTest)
Extracts the particles of this list fullfilling the condition extractTest.test(flag) to the other list plOut.
This list is not modified and plOut is dimensionned to the right dimension. This list and PlOut must be of the same sub-type (e.g. either both or non of subtype RichPartList).
All needed global data of this list are copied to plOut:
part, weigth, meshes...
Status: under development.

Versions and anomalies correction :
Version numberAuthor (name, e-mail) Corrections/Modifications
0.1 JF Roussel, roussel@onecert.frCreation



applyFunc

public void applyFunc(IntScalTable indexTable,
                      FunctionOfParticle f,
                      VectTable refDirection,
                      boolean intensive,
                      boolean indexedFunction,
                      ScalSurfField matModId,
                      ScalSurfField matId,
                      FloatScalTable result)
Applies the supplied function f to the particles of this list.
For the particle n, with indexTable[n] = i (i is typically the Id of the mesh element the particle belongs to), the function f increments the element i of the result Table (typically increments the yield/function on surface element i).
Options are:
- sub-type of FunctionOfParticle f (of (E), (E,Theta) or ())
- intensive or extensive function (respectively average or sum over particles)
- indexed function: if true, the function has 3 extra parameters, material model Id, material Id, particle type Id (used for material interactions)

Parameters:
indexTable - array of the elements the particle belongs to
f - function to be applied
refDirection - reference direcction for angle dependence (usually normal to surface)
intensive - if true, intense function => average is computed instead of sum
indexedFunction - if true, applies the function with 3 extra parameters
matModId - material model Id field (1st extra param if indexedFunction, can be null if not)
matId - material Id field (2nd extra param if indexedFunction, can be null if not)
result - result (index of the array = indexTable value)
See Also:

- this PartList sub-type: RichPartList is handled

applyFuncDeprecated

public void applyFuncDeprecated(TestOfInt selectPart,
                                IntScalTable selectTable,
                                IntScalTable indexTable,
                                FunctionOfParticle f,
                                VectTable refDir,
                                float factor,
                                FloatScalTable result)
Applies the supplied function of energy f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true. The typical use is to select particles arrived on a given surface mesh by comparing the flag table to the surfMesh number (selectPart = isOnSurf1/2, selectVal = indexT).
For the particle n of indexTable[n] = i (typically surface element number), the result of the function f increments the element i of the result Table (typically increments the yield/function on a surface element). It is supposed to be an extensive function, it is thus multiplied by the particle weight.
Summary of table indexing:
- selectTable and indexTable index i: they are indexed by particle index (they are thus dependent of this PartList implementation, and the user is limited to providing one of the tables of this PartList class, normally flagT and indexT)
- result: it is indexed by the values of indexTable (normally the surface index, but some thing may be used)

Status: under development. MUST STILL BE OVERRIDEN IN DERIVED TYPES (RichPartList) TBD


applyFuncDeprecated

public void applyFuncDeprecated(TestOfInt selectPart,
                                IntScalTable selectTable,
                                IntScalTable indexTable,
                                FunctionOfParticleETheta f,
                                VectTable refDir_,
                                float factor,
                                FloatScalTable result)
Applies the supplied function of energy and angle f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true. The typical use is to select particles arrived on a given surface mesh by comparing the flag table to the surfMesh number (selectPart = isOnSurf1/2, selectVal = indexT).
For the particle n of indexTable[n] = i (typically surface element number), the result of the function f increments the element i of the result Table (typically increments the yield/function on a surface element). It is supposed to be an extensive function, it is thus multiplied by the particle weight.
The angles are computed with respect to reference directions refDir, (typically normals to surfaces) The refDir table indexing system must be identical to result indexing, i.e. through indexT values (typically the surface element index).
Summary of table indexing:
- selectTable and indexTable index i: they are indexed by particle index (they are thus dependent of this PartList implementation, and the user is limited to providing one of the tables of this PartList class, normally flagT and indexT)
- refDir and result: they are indexed by the values of indexTable (normally the surface index, but some thing may be used)

Exemple to apply a microscopic interaction yield onto a particle list:
partList.applyFunc(partList.isOnSurf2, partList.getFlagTable(), partList.getIndexTable(), microYield, partList.getSm1().getSurfNormals, results);

Status: under development. MUST STILL BE MODIFIED TO TAKE INTO ACCOUNT DERIVED TYPES (RichPartList)


applyFuncDeprecated

public void applyFuncDeprecated(TestOfInt selectPart,
                                IntScalTable selectTable,
                                IntScalTable indexTable,
                                FunctionOfParticleE f,
                                float factor,
                                FloatScalTable result)
Applies the supplied function of energy f to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true. The typical use is to select particles arrived on a given surface mesh by comparing the flag table to the surfMesh number (selectPart = isOnSurf1/2, selectVal = indexT).
For the particle n of indexTable[n] = i (typically surface element number), the result of the function f increments the element i of the result Table (typically increments the yield/function on a surface element). It is supposed to be an extensive function, it is thus multiplied by the particle weight.
Summary of table indexing:
- selectTable and indexTable index i: they are indexed by particle index (they are thus dependent of this PartList implementation, and the user is limited to providing one of the tables of this PartList class, normally flagT and indexT)
- result: it is indexed by the values of indexTable (normally the surface index, but some thing may be used)

Status: under development. MUST STILL BE OVERRIDEN IN DERIVED TYPES (RichPartList)


applyFuncDeprecated

public void applyFuncDeprecated(TestOfInt selectPart,
                                IntScalTable selectTable,
                                IntScalTable indexTable,
                                FunctionOfParticleNothing f,
                                float factor,
                                FloatScalTable result)
Applies the supplied function of nothing f (a constant) to selected paricles, the ones verifying selectPart.testOfInt(selectVal[i]) = true. The typical use is to select particles arrived on a given surface mesh by comparing the flag table to the surfMesh number (selectPart = isOnSurf1/2, selectVal = indexT).
For the particle n of indexTable[n] = i (typically surface element number), the result of the function f increments the element i of the result Table (typically increments the yield/function on a surface element). It is supposed to be an extensive quantity, it is thus multiplied by the particle weight.
Summary of table indexing:
- selectTable and indexTable index i: they are indexed by particle index (they are thus dependent of this PartList implementation, and the user is limited to providing one of the tables of this PartList class, normally flagT and indexT)
- result: it is indexed by the values of indexTable (normally the surface index, but some thing may be used)

Status: under development. MUST STILL BE MODIFIED TO TAKE INTO ACCOUNT DERIVED TYPES (RichPartList)


generateVolumeSample

public void generateVolumeSample(VolSampler sampler)
generates a sample of particles following the passed sampler for velocities, and uniformely in volume mesh for positions.


generateSurfaceSample

public void generateSurfaceSample(SurfMesh sm,
                                  SurfSampler sampler,
                                  float time)
generates a sample of particles following the passed sampler for velocities, and uniformely on surface mesh for positions.

Parameters:
sm - surface mesh the smapling has to done on
sampler - surface sampler => generates random velocities following a given law
time - physical integration duration producing that sample

extractFraction

public PartList extractFraction(float ratio)
extracts a fraction of the list (at random)

Parameters:
ratio - fraction of the list to be extracted
Returns:
the extracted sublist

inject

public void inject(PartList plIn)
injects the provided list plIn into this list.
Lists must be of the same sub-type, and have same particle type
It amounts to concatenating the lists after updating the particles flag and index (transform "on surface i" into "in cell j").

Parameters:
plIn - input list
See Also:
concat(PartList)

concat

public void concat(PartList plIn)
concatenates the provided list plIn to this list.
Lists must be of the same sub-type, and have same particle type (if it does not have a null particle type (because a RichPartList => individual particle types)).

Parameters:
plIn - input list to concatenate to this list

clean

public void clean(TestOfInt selectPart,
                  IntScalTable selectTable)
Cleans the list, excluding particles verifying selectPart.test(selectTable[i])

Parameters:
selectPart -
selectTable -

computeChargeOverMass

public void computeChargeOverMass(FloatScalTable chargeOverMass)

setDim

public void setDim(int dimension)
sets the list dimension to dim: resizes the tables if needed, not preserving data (except if no resizing is needed).

Overrides:
setDim in class PointList

setDimPreserve

public void setDimPreserve(int dimension)
sets the list dimension to dim: resizes the tables if needed, not preserving data (except if no resizing is needed).

Overrides:
setDimPreserve in class PointList

getSimilar

public PartList getSimilar()
returns a similar PartList, with same subtype and particle type(s) (and fixed weight), but empty (to be overriden by sub-types (derived classes)


getPartListCopy

public PartList getPartListCopy()
returns a copy of this list (to be overriden by sub-types)


getPart

public Part getPart()

getWeight

public float getWeight()

getVeloTable

public VeloVectTable getVeloTable()

getFlagTable

public IntScalTable getFlagTable()

getSm1

public SurfMesh getSm1()
return surface mesh 1, usually the external boundary mesh


getSm2

public SurfMesh getSm2()
return surface mesh 2, usually the spacecraft mesh


getIsOnThisSurfMesh

public TestOfInt getIsOnThisSurfMesh(SurfMesh sm)