caffeinterface
Class CaffeArrayFix

java.lang.Object
  extended by caffe.CaffeClass
      extended by caffeinterface.CaffeArrayFix

public class CaffeArrayFix
extends caffe.CaffeClass

This class creates a simple interface for use of putting arrays into the CAFFE data base and getting them from the data base. CAFFE assumes arrays are indexed from 1, rather than 0. Thus this class appends the input array by one such that the actual data in the array starts in the 1 index of the new array. While getting arrays, it removes the first empty element of the array gotten from the data base.

Author:
ahaas

Field Summary
 
Fields inherited from class caffe.CaffeClass
db
 
Constructor Summary
CaffeArrayFix()
           
 
Method Summary
 double[] get1Darray(java.lang.String varName)
          Gets a 1-D array from the database.
 double[][] get2Darray(java.lang.String varName)
          Gets a 2-D array from the database.
 void put1Darray(java.lang.String varName, double[] var, int imax)
          Puts a 1-D array into the database.
 void put2Darray(java.lang.String varName, double[][] var, int imax, int jmax)
          Puts a 2-D array in the database.
 
Methods inherited from class caffe.CaffeClass
callLocalApp, compute, debug, defaults, getDb, getLocalData, getMilliTime, loadClass, putLocalData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaffeArrayFix

public CaffeArrayFix()
Method Detail

put1Darray

public void put1Darray(java.lang.String varName,
                       double[] var,
                       int imax)
Puts a 1-D array into the database.

Parameters:
varName - the name of the array.
var - the values.
imax - length of the array of values.

get1Darray

public double[] get1Darray(java.lang.String varName)
Gets a 1-D array from the database. This array will not have a meaningless leading element.

Parameters:
varName - the name of the array.
Returns:
a new array of size equal to the number of elements actually stored.

put2Darray

public void put2Darray(java.lang.String varName,
                       double[][] var,
                       int imax,
                       int jmax)
Puts a 2-D array in the database.

Parameters:
varName - the name of the array.
var - the values.
imax - the number of rows in the array.
jmax - the number of columns in the array.

get2Darray

public double[][] get2Darray(java.lang.String varName)
Gets a 2-D array from the database.

Parameters:
varName - the name of the array.
Returns:
a new 2-D array containing just the values in the requested array, leaving out the redundant row and column.