cz.cuni.jagrlib.piece
Class SimpleSLEDataStore

java.lang.Object
  extended by cz.cuni.jagrlib.DefaultProperty
      extended by cz.cuni.jagrlib.Piece
          extended by cz.cuni.jagrlib.piece.SimpleSLEDataStore
All Implemented Interfaces:
Breakable, Property, SLEData, SLEDataStore, Template

public class SimpleSLEDataStore
extends Piece
implements SLEDataStore

Data object holding system of linear equations (SLE) data - actual data storage w/o any smartness.

Since:
0.26

Field Summary
protected static java.lang.String CATEGORY
          Object category.
protected  int columns
          Number of unknown variables (matrix columns).
protected  double[][] matrix
          Complete rectangular matrix A as in Ax=b.
protected  double[] reflectance
          Solution vector x as in Ax=b.
static RegPiece reg
          Static registration instance for this class.
protected  double[] right
          Right-hand side b as in Ax=b.
protected  int rows
          Number of equations (matrix rows).
protected  double[] solution
          Solution vector x as in Ax=b.
protected static java.lang.String TEMPLATE_NAME
          Object template identifier.
protected  double[] weight
          Solution vector x as in Ax=b.
 
Fields inherited from class cz.cuni.jagrlib.Piece
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak
 
Fields inherited from interface cz.cuni.jagrlib.iface.SLEData
NULL
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Fields inherited from interface cz.cuni.jagrlib.Template
ALL_PLUGS, C_1D, C_2D, C_3D, C_ALPHA, C_BINARY, C_BREP, C_CAMERA, C_CIRCLE, C_CLIP, C_COMPRESSION, C_CURVE, C_DATA, C_DRAW, C_EDITOR, C_ELLIPSE, C_FILL, C_FILTER, C_FLOAT, C_FUNCTION, C_IMAGE, C_INTEGER, C_IO, C_LIGHT, C_LINE, C_METRIC, C_POLYGON, C_PROJECTION, C_RADIOSITY, C_RASTER, C_RENDER, C_SAMPLE, C_SCENE, C_SET, C_SOLID, C_TEXT, C_TRANSFORM, C_VECTOR, C_VIEWER, C_WORKER, CAT_EMPTY, EMPTY, IFACE, JAGRLIB, JAGRLIB2, MANIPULATOR_COMBO, MANIPULATOR_CUSTOM, MANIPULATOR_DEFAULT, MANIPULATOR_MULTILINE, PL_ALPHAMASK, PL_BITMASK, PL_CAUSTIC, PL_CODEC, PL_COLORMAP, PL_COMPARE, PL_DATA, PL_DIRECT, PL_EDITOR, PL_FILTER, PL_FUNCTION, PL_IMAGE, PL_IMPORT, PL_INPUT, PL_INTERSECTION, PL_LIGHTSOURCE, PL_ORDER, PL_OUTPUT, PL_PALETTE, PL_PHOTON, PL_PROPERTY, PL_QUANTIZER, PL_RASTER, PL_RENDER, PL_SHADOW, PL_STREAM, PL_TRANSFORM, PL_TRIGGER, PL_VOLUME, PL_WINDOW, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_LONG, TYPE_OBJECT, TYPE_STRING
 
Constructor Summary
SimpleSLEDataStore()
           
 
Method Summary
 int actualComponent()
          Get actual component number.
 double getCoeff(int row, int col)
          Reads a single matrix coefficient.
 double[] getColumn(int col, double[] result)
          Reads the whole matrix column.
 int getColumns()
          Number of unknowns = number of matrix columns (usually number of unknowns is equal to number of equations).
 double[][] getMatrix()
          Reads the whole matrix.
 double[] getReflectance(double[] reflectance)
          Reads the whole reflectance vector.
 double getReflectance(int i)
          Reads a single reflectance (radiosity: element albedo).
 double[] getRight(double[] result)
          Reads the whole right-side vector.
 double getRight(int row)
          Reads a single element of the right-side vector.
 double[] getRow(int row, double[] result)
          Reads the whole matrix row.
 int getRows()
          Number of equations = number of matrix rows (usually number of unknowns is equal to number of equations).
 double[] getSolution(double[] result)
          Reads the whole solution vector.
 double getSolution(int col)
          Reads a single unknown (element of solution vector).
 double[] getWeight(double[] values)
          Reads the whole weight vector.
 double getWeight(int i)
          Reads a single weight (radiosity: element area).
 void init(int rows, int columns)
          Initializes the SLE.
 int nextCoeffInColumnChanged(int row, int col)
          Returns row-index of next coefficient which was changed since last resetChanges() call.
 int nextCoeffInRowChanged(int row, int col)
          Returns column-index of next coefficient which was changed since last resetChanges() call.
 int nextRightChanged(int row)
          Returns index of next right-side element which was changed since last resetChanges() call.
 void resetChanges()
          Resets (acknowledges) all SLE changes.
 void setCoeff(int row, int col, double value)
          Sets a single matrix coefficient.
 void setColumn(int col, double[] values)
          Sets the whole matrix column.
 void setComponent(int c)
          Set actual component (non-mandatory).
 void setReflectance(double[] reflectance)
          Sets the whole reflectance vector.
 void setReflectance(int i, double value)
          Sets a single reflectance (radiosity: element albedo).
 void setRight(double[] values)
          Sets the whole right-side vector.
 void setRight(int row, double value)
          Sets a single element of the right-side vector.
 void setRow(int row, double[] values)
          Sets the whole matrix row.
 void setSolution(double[] values)
          Writes the whole solution vector.
 void setSolution(int col, double value)
          Writes value of a single unknown.
static int setTemplate(Template t, int ord)
          General-purpose registration routine.
 void setWeight(double[] values)
          Sets the whole weight vector en bloc.
 void setWeight(int i, double value)
          Sets a single weight (radiosity: element area).
 
Methods inherited from class cz.cuni.jagrlib.Piece
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop
 
Methods inherited from class cz.cuni.jagrlib.DefaultProperty
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Field Detail

rows

protected int rows
Number of equations (matrix rows).


columns

protected int columns
Number of unknown variables (matrix columns).


matrix

protected double[][] matrix
Complete rectangular matrix A as in Ax=b.


right

protected double[] right
Right-hand side b as in Ax=b.


solution

protected double[] solution
Solution vector x as in Ax=b.


weight

protected double[] weight
Solution vector x as in Ax=b.


reflectance

protected double[] reflectance
Solution vector x as in Ax=b.


TEMPLATE_NAME

protected static final java.lang.String TEMPLATE_NAME
Object template identifier.

See Also:
Constant Field Values

CATEGORY

protected static final java.lang.String CATEGORY
Object category.

See Also:
Constant Field Values

reg

public static final RegPiece reg
Static registration instance for this class. Automatically initialized in class-loading time.

Constructor Detail

SimpleSLEDataStore

public SimpleSLEDataStore()
Method Detail

getRows

public int getRows()
Number of equations = number of matrix rows (usually number of unknowns is equal to number of equations).

Specified by:
getRows in interface SLEData

getColumns

public int getColumns()
Number of unknowns = number of matrix columns (usually number of unknowns is equal to number of equations).

Specified by:
getColumns in interface SLEData

getCoeff

public double getCoeff(int row,
                       int col)
Reads a single matrix coefficient.

Specified by:
getCoeff in interface SLEData

getRow

public double[] getRow(int row,
                       double[] result)
Reads the whole matrix row.

Specified by:
getRow in interface SLEData

getColumn

public double[] getColumn(int col,
                          double[] result)
Reads the whole matrix column.

Specified by:
getColumn in interface SLEData

getMatrix

public double[][] getMatrix()
Reads the whole matrix.

Specified by:
getMatrix in interface SLEData

getRight

public double getRight(int row)
Reads a single element of the right-side vector.

Specified by:
getRight in interface SLEData

getRight

public double[] getRight(double[] result)
Reads the whole right-side vector.

Specified by:
getRight in interface SLEData
Parameters:
result - Pre-allocated array to hold result (can be null).

getSolution

public double getSolution(int col)
Reads a single unknown (element of solution vector).

Specified by:
getSolution in interface SLEData

getSolution

public double[] getSolution(double[] result)
Reads the whole solution vector.

Specified by:
getSolution in interface SLEData

setSolution

public void setSolution(int col,
                        double value)
Writes value of a single unknown.

Specified by:
setSolution in interface SLEData

setSolution

public void setSolution(double[] values)
Writes the whole solution vector.

Specified by:
setSolution in interface SLEData

init

public void init(int rows,
                 int columns)
Initializes the SLE. All values will be set to 0.0.

Specified by:
init in interface SLEDataStore

setCoeff

public void setCoeff(int row,
                     int col,
                     double value)
Sets a single matrix coefficient. Preferred metod in sparse-matrix implementations..

Specified by:
setCoeff in interface SLEDataStore

setRow

public void setRow(int row,
                   double[] values)
Sets the whole matrix row.

Specified by:
setRow in interface SLEDataStore

setColumn

public void setColumn(int col,
                      double[] values)
Sets the whole matrix column.

Specified by:
setColumn in interface SLEDataStore

setRight

public void setRight(int row,
                     double value)
Sets a single element of the right-side vector.

Specified by:
setRight in interface SLEDataStore

setRight

public void setRight(double[] values)
Sets the whole right-side vector.

Specified by:
setRight in interface SLEDataStore

nextRightChanged

public int nextRightChanged(int row)
Returns index of next right-side element which was changed since last resetChanges() call.

Specified by:
nextRightChanged in interface SLEData

nextCoeffInRowChanged

public int nextCoeffInRowChanged(int row,
                                 int col)
Returns column-index of next coefficient which was changed since last resetChanges() call. Passes through the given matrix row..

Specified by:
nextCoeffInRowChanged in interface SLEData

nextCoeffInColumnChanged

public int nextCoeffInColumnChanged(int row,
                                    int col)
Returns row-index of next coefficient which was changed since last resetChanges() call. Passes through the given matrix column..

Specified by:
nextCoeffInColumnChanged in interface SLEData

resetChanges

public void resetChanges()
Resets (acknowledges) all SLE changes.

Specified by:
resetChanges in interface SLEData

getWeight

public double getWeight(int i)
Reads a single weight (radiosity: element area).

Specified by:
getWeight in interface SLEData

getWeight

public double[] getWeight(double[] values)
Reads the whole weight vector.

Specified by:
getWeight in interface SLEData
Parameters:
values - Pre-allocated array to hold result (can be null).

getReflectance

public double getReflectance(int i)
Reads a single reflectance (radiosity: element albedo).

Specified by:
getReflectance in interface SLEData

getReflectance

public double[] getReflectance(double[] reflectance)
Reads the whole reflectance vector.

Specified by:
getReflectance in interface SLEData
Parameters:
reflectance - Pre-allocated array to hold result (can be null).

setWeight

public void setWeight(int i,
                      double value)
Sets a single weight (radiosity: element area).

Specified by:
setWeight in interface SLEDataStore

setWeight

public void setWeight(double[] values)
Sets the whole weight vector en bloc.

Specified by:
setWeight in interface SLEDataStore

setReflectance

public void setReflectance(int i,
                           double value)
Sets a single reflectance (radiosity: element albedo).

Specified by:
setReflectance in interface SLEDataStore

setReflectance

public void setReflectance(double[] reflectance)
Sets the whole reflectance vector.

Specified by:
setReflectance in interface SLEDataStore

actualComponent

public int actualComponent()
Get actual component number.

Specified by:
actualComponent in interface SLEData

setComponent

public void setComponent(int c)
Set actual component (non-mandatory).

Specified by:
setComponent in interface SLEData

setTemplate

public static int setTemplate(Template t,
                              int ord)
General-purpose registration routine. Sets all plugs, strings, etc. to the given Template.