spis.Util.Table
Class VectTable

java.lang.Object
  extended byspis.Util.Table.Table
      extended byspis.Util.Table.VectTable
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SpaceVectTable, VeloVectTable

public abstract class VectTable
extends Table
implements java.io.Serializable

Class Name : VectTable
Project ref : SPIS project
File name : VectTable.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 : Table of vectors (i.e. 1 column).

Versions and anomalies correction :

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


Version:
0.1
Author:
JF Roussel
See Also:
Serialized Form

Constructor Summary
VectTable(Geom geometry, float[][] values)
          Constructor with array passed.
VectTable(Geom geometry, float[][] values, int tableDimension, int vectDimension)
          Constructor with full data
Values must be of dimension [length(at least)][dim(at least)] (checked)
VectTable(Geom geometry, int tableDimension, int vectDimension)
          Default constructor
 
Method Summary
 void add(float[] vect)
          Adds a constant vector to this table.
 void add(VectTable vt)
          Adds another vectTable to this one.
 void addData(float[] x)
          adds value x at the end of the table, of which size increases by one (data are preserved, a copy of x array is made)
 void checkSameDims(VectTable tab)
          checks equality of array both dimensions (table dimension and vector dimension)
 void checkSameVectDim(float[] vect)
          checks equality of vector dimension
 void checkSameVectDim(VectTable tab)
          checks equality of vector dimension
 void checkVectDimIsLarger(int size)
          checks equality of vector dimension (filled size, not dimensioned size)
 void computeScalProd(VectTable vt, FloatScalTable scalProd)
          Computes the scalar product of this table with the passed table vt
 float[] computeTableSum()
          Returns the sum of the Table vectors.
 void divide(FloatScalTable fst)
          Divides this table by FloatScalTable fst.
 void equalPolarVeloIncrement(VectTable a, int ArId, int AthetaId, VectTable v, int VrId, int VthetaId, VectTable x, int rId, int dVrId, int dVthetaId, float dt)
          Computes the velocity increment in polar coordinates due to a given acceleration during time dt..
 VectTable getCopy()
          replaces the copy constructor for this abstract class (to be overriden by derived classes)
 Geom getGeom()
          Returns the geometry these vectors are based on
 float[][] getValues()
          Returns the table values
 int getVectDim()
          Returns the dimension of the table vectors
 void linComb(float a1, VectTable vt, float a2)
          Performs the following linear comination on this table: this = a1 this + a2 t.
 void mult(float coeff)
          Multiplies this table by float coeff
 void mult(FloatScalTable fst)
          Multiplies this table by FloatScalTable fst.
 void mult(FloatScalTable fst, float coeff)
          Multiplies this table by FloatScalTable fst and float coeff.
 void normalise()
          normalises the vectors of this table (to length 1)
 void reset()
          Sets this table to zero value (dimension unchanged)
 FloatScalTable returnNorm()
          Returns the scalar table of the norms of the vectors of this table
 FloatScalTable returnScalProd(float[] v)
          Returns the result of the scalar product of this table and the passed vector v, as a scalar table
 FloatScalTable returnScalProd(VectTable vt)
          Returns the result of the scalar product of this table with the passed table vt, as a scalar table
 void set(float[] value)
          Sets table value (uniform)
 void set(VectTable inTable)
          Copies the values of the passed table onto this table (same dimensions requested and checked)
 void setDim(int dim)
          Sets logical dimension to dim and resizes the table if necessary to be large enough (does not preserve data (except if no resizing is needed))
 void setDimPreserve(int dim)
          Sets logical dimension to dim and resizes the table if necessary to be large enough, preserving the data
 void setLengthPreserve(int length)
          Sets allocated array length at least to length, preserving the data (used to force a large resizing of table instead of numerous small resizings when the total needed space can be computed)
 void setMult(VectTable tab, float coeff)
          Sets this table to tab x coeff (array dimensions must be identical, this is checked)
 void setMult(VectTable tab, float coeff, int start, int end)
          Sets this table to tab x coeff, but for vector coordinate index "start" to "end" only (array dimensions must be sufficient, this is checked)
 void substract(VectTable vt)
          Substracts another vectTable from this one.
 void vectProd(VectTable vt)
          Computes the vector product: this = this x vt.
 
Methods inherited from class spis.Util.Table.Table
checkSameDim, declareDim, getDim
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectTable

public VectTable(Geom geometry,
                 int tableDimension,
                 int vectDimension)
Default constructor


VectTable

public VectTable(Geom geometry,
                 float[][] values)
Constructor with array passed.
No dimensions checked, values 2D array must be rectangular, not null.


VectTable

public VectTable(Geom geometry,
                 float[][] values,
                 int tableDimension,
                 int vectDimension)
Constructor with full data
Values must be of dimension [length(at least)][dim(at least)] (checked)

Method Detail

getCopy

public VectTable getCopy()
replaces the copy constructor for this abstract class (to be overriden by derived classes)


mult

public void mult(float coeff)
Multiplies this table by float coeff


mult

public void mult(FloatScalTable fst,
                 float coeff)
Multiplies this table by FloatScalTable fst and float coeff. Both tables must be of the same dimension (checked).


mult

public void mult(FloatScalTable fst)
Multiplies this table by FloatScalTable fst. Both tables must be of the same dimension (checked).


divide

public void divide(FloatScalTable fst)
Divides this table by FloatScalTable fst. Both tables must be of the same dimension (checked).


add

public void add(VectTable vt)
Adds another vectTable to this one. Tables and vectors must be of the same dimension (checked).


add

public void add(float[] vect)
Adds a constant vector to this table. Tables and vectors must be of the same dimension (checked).


substract

public void substract(VectTable vt)
Substracts another vectTable from this one. Tables and vectors must be of the same dimension (checked).


linComb

public void linComb(float a1,
                    VectTable vt,
                    float a2)
Performs the following linear comination on this table: this = a1 this + a2 t. Both tables must be of same dimension (checked).


vectProd

public void vectProd(VectTable vt)
Computes the vector product: this = this x vt.


returnScalProd

public FloatScalTable returnScalProd(VectTable vt)
Returns the result of the scalar product of this table with the passed table vt, as a scalar table


returnScalProd

public FloatScalTable returnScalProd(float[] v)
Returns the result of the scalar product of this table and the passed vector v, as a scalar table


returnNorm

public FloatScalTable returnNorm()
Returns the scalar table of the norms of the vectors of this table


computeScalProd

public void computeScalProd(VectTable vt,
                            FloatScalTable scalProd)
Computes the scalar product of this table with the passed table vt

Parameters:
vt - other table to compute the scalar product again
scalProd - the result

setMult

public void setMult(VectTable tab,
                    float coeff)
Sets this table to tab x coeff (array dimensions must be identical, this is checked)


setMult

public void setMult(VectTable tab,
                    float coeff,
                    int start,
                    int end)
Sets this table to tab x coeff, but for vector coordinate index "start" to "end" only (array dimensions must be sufficient, this is checked)


normalise

public void normalise()
normalises the vectors of this table (to length 1)


equalPolarVeloIncrement

public void equalPolarVeloIncrement(VectTable a,
                                    int ArId,
                                    int AthetaId,
                                    VectTable v,
                                    int VrId,
                                    int VthetaId,
                                    VectTable x,
                                    int rId,
                                    int dVrId,
                                    int dVthetaId,
                                    float dt)
Computes the velocity increment in polar coordinates due to a given acceleration during time dt.. Can be used for 2D polar and 3D cylindrical geometry (hence the need of flexibility implemented through index passing.
- Ar (radial acceleration) is the ArId-th coordinate of acceleration a
- Atheta (azimuthal acceleration) is the AthetaId-th coordinate of a
- r (radius) is the rId-th coordinate of position x
- Vr (radial velocity) is the VrId-th coordinate of velocity v
- Vtheta (azimuthal velocity) is the VthetaId-th coordinate of v
- dVr (radial velocity) is the dVrId-th coordinate of this table (= dV)
- dVtheta (azimuthal velocity) is the dVthetaId-th coordinate of dV
Does not check for zero r (causes exception). This must be added here or somewhere else (a minimum r should be defined in Geom class)


checkSameDims

public void checkSameDims(VectTable tab)
checks equality of array both dimensions (table dimension and vector dimension)


checkVectDimIsLarger

public void checkVectDimIsLarger(int size)
checks equality of vector dimension (filled size, not dimensioned size)


checkSameVectDim

public void checkSameVectDim(VectTable tab)
checks equality of vector dimension


checkSameVectDim

public void checkSameVectDim(float[] vect)
checks equality of vector dimension


computeTableSum

public float[] computeTableSum()
Returns the sum of the Table vectors.


addData

public void addData(float[] x)
adds value x at the end of the table, of which size increases by one (data are preserved, a copy of x array is made)


setDim

public void setDim(int dim)
Sets logical dimension to dim and resizes the table if necessary to be large enough (does not preserve data (except if no resizing is needed))

Specified by:
setDim in class Table

setDimPreserve

public void setDimPreserve(int dim)
Sets logical dimension to dim and resizes the table if necessary to be large enough, preserving the data

Specified by:
setDimPreserve in class Table

setLengthPreserve

public void setLengthPreserve(int length)
Sets allocated array length at least to length, preserving the data (used to force a large resizing of table instead of numerous small resizings when the total needed space can be computed)


set

public void set(float[] value)
Sets table value (uniform)


set

public void set(VectTable inTable)
Copies the values of the passed table onto this table (same dimensions requested and checked)


reset

public void reset()
Sets this table to zero value (dimension unchanged)

Specified by:
reset in class Table

getValues

public float[][] getValues()
Returns the table values


getVectDim

public int getVectDim()
Returns the dimension of the table vectors


getGeom

public Geom getGeom()
Returns the geometry these vectors are based on