edu.unh.sdb.datasource
Class BasicBlock

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataBlock
          extended by edu.unh.sdb.datasource.BasicBlock
All Implemented Interfaces:
Indexable
Direct Known Subclasses:
CacheDataBlock, DSPartitionedStencilIterator

public class BasicBlock
extends DataBlock


Field Summary
protected  int leastSignificantAxis
           
protected  int[] steps
           
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
BasicBlock(ISBounds isb, RecordDescriptor recordDesc)
          Construct a datablock with the given bounds and number of attributes.
BasicBlock(ISBounds isb, RecordDescriptor recordDesc, AxisOrdering ordering)
          Construct a datablock with the given bounds and axisordering.
BasicBlock(ISBounds isb, RecordDescriptor recordDesc, Values data)
          Construct a BasicBlock with the given data and ISBounds.
 
Method Summary
protected  void copyData(int srcOffset, int dstOffset, int rodDataSize)
           
protected  void copyData(int srcOffset, int dstOffset, int[] rsMapping)
           
protected  void copyData(int srcOffset, int dstOffset, int[] componentFields, int[] compositeFields)
           
 void datum(ByteDatum datum, int[] coords)
          Given an array of coordinates, load the corresponding datum into the datum argument.
 void datum(Datum datum, IndexSpaceID did)
          Given IndexSpaceID, load the corresponding datum into the datum argument.
 void datum(Datum dtm, IndexSpaceID did, FieldIDMapper mp)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.
 void datum(Datum dtm, IndexSpaceID did, RecordSpec recSpec)
          Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.
 void datum(Datum datum, int[] coords)
          Given an array of coordinates, load the corresponding datum into the datum argument.
 Datum datum(IndexSpaceID did)
          Given an IndexSpaceID, return the corresponding datum.( this only works for float implementation )
 Datum datum(IndexSpaceID did, RecordSpec spec)
          Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.
 void datum(ShortDatum datum, int[] coords)
          Given an array of coordinates, load the corresponding datum into the datum argument.
 byte getByte(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a short.
 double getDouble(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as an int.
 void getDoubles(double[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated double array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray.
protected  int getFieldPos(int oneDIndex, int fieldNumber)
           
 float getFloat(IndexSpaceID did, int fieldNumber)
          get the float attribute for a given IndexSpaceID and attributeID, convert if needed
 void getFloats(float[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated float array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray.
 int getInt(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as an int.
 void getInts(int[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated int array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray.
 short getShort(IndexSpaceID did, int fieldNumber)
          get the field value at the ISID position as a short.
 void getShorts(short[] dstArray, RecordSpec recordSpec, boolean pointOrder)
          User passes in a pre-allocated short array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray.
 Values getValues()
          return the Values (data) store in this basicBlock
 Values getValues(int attr)
          return a Values array consisting of the data for the specified attribute.
 void psubblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds)
          this subblock does not check the bounds
protected  void setAttributeOrderRod(java.nio.ByteBuffer byteBuffer, int rodSize, int startDatumArrayOffset, int datumArrayStep, int dstAttributeID, int attributeByteSize, int sourcetype)
          given a rod of data of one attribute, copy the spedified attribute into the corresponding location in the BasicBlock , used for attribute order binaryFiledataSoure
 void setBytes(int attr, byte[] newValues)
          Assign attribute values for all points in the block
 void setDatum(IndexSpaceID isid, Datum d)
          Set the location specified by the IndexSpaceID to the given datum.
 void setDoubles(int attr, double[] newValues)
          Assign attribute values for all points in the block
 void setField(int index, byte byteData, int fieldID)
          set a byte field value at certain index( index of conceptual datum for an one D array )
 void setField(int index, double doubleData, int fieldID)
          set a double field value at certain index( index of conceptual datum for an one D array )
 void setField(int fieldIndex, float floatData)
          set a field value, the index is the index of the field in this 1D array
 void setField(int index, float floatData, int fieldID)
          set a float field value at certain index( index of conceptual datum for an one D array )
 void setField(int index, int intData, int fieldID)
          set a int field value at certain index( index of conceptual datum for an one D array )
 void setField(int index, short shortData, int fieldID)
          set a short field value at certain index( index of conceptual datum for an one D array )
 void setFloats(float[] newVals)
          set the entire attribute array block to the passed argument.
 void setFloats(int attr, float[] newValues)
          Assign attribute values for all points in the block
 void setInts(int attr, int[] newValues)
          Assign attribute values for all points in the block
protected  void setRod(java.nio.ByteBuffer byteBuffer, int rodSize, int startDatumArrayOffset, int datumArrayStep, FieldIDMapper mp, RecordDescriptor sourceRecordDesc)
          given a rod of data ( byte buffer), copy the specified field into the corresponding location in the BasicBlock, dstBlock is considered as compositeBlock, the srcBlock is the componentBlock
protected  void setRod(java.nio.ByteBuffer byteBuffer, int rodSize, int startDatumArrayOffset, int datumArrayStep, RecordSpec recSpec, RecordDescriptor sourceRecordDesc)
          given a rod of data ( byte buffer), copy the specified field in corresponding location in the BasicBlock, dstBlock is considered as composite , the srcBlock is the component
 void setShorts(int attr, short[] newValues)
          Assign attribute values for all points in the block
 void setValues(int attr, Values newValues)
          Assign attribute values for all points in the block
 boolean setValues(Values vals)
          Set all values at once.
protected  void subblock(BasicBlock dstBlock, ISBounds inDestBounds, ISBounds srcBounds)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
protected  void subblock(BasicBlock dstBlock, ISBounds inDestBounds, ISBounds srcBounds, RecordSpec rs, FieldIDMapper fim)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds)
          this is the old interface, the query bounds is check to ensure correctness
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds, FieldIDMapper mp)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 void subblock(DataBlock dstBlock, ISBounds dstBounds, ISBounds srcBounds, RecordSpec spec)
          Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds.
 
Methods inherited from class edu.unh.sdb.datasource.DataBlock
setByAttribute, setByte, setBytes, setBytesByAttribute, setBytesByPoint, setDouble, setDoubles, setDoublesByAttribute, setDoublesByPoint, setFloat, setFloats, setFloatsByAttribute, setFloatsByPoint, setInt, setInts, setIntsByAttribute, setIntsByPoint, setShort, setShorts, setShortsByAttribute, setShortsByPoint, setValuesByAttribute, setValuesByPoint, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leastSignificantAxis

protected int leastSignificantAxis

steps

protected int[] steps
Constructor Detail

BasicBlock

public BasicBlock(ISBounds isb,
                  RecordDescriptor recordDesc,
                  Values data)
Construct a BasicBlock with the given data and ISBounds. The default axis axisOrdering is used, and the bounds will be moved to the origin.


BasicBlock

public BasicBlock(ISBounds isb,
                  RecordDescriptor recordDesc)
Construct a datablock with the given bounds and number of attributes. The data array for the block will be created based on the data type in recordDesc


BasicBlock

public BasicBlock(ISBounds isb,
                  RecordDescriptor recordDesc,
                  AxisOrdering ordering)
Construct a datablock with the given bounds and axisordering. The data array for the block will be created based on the data type in recordDesc

Method Detail

getFieldPos

protected final int getFieldPos(int oneDIndex,
                                int fieldNumber)

getValues

public Values getValues()
return the Values (data) store in this basicBlock

Overrides:
getValues in class DataBlock

getValues

public Values getValues(int attr)
return a Values array consisting of the data for the specified attribute.

Overrides:
getValues in class DataCollection

setField

public final void setField(int index,
                           int intData,
                           int fieldID)
set a int field value at certain index( index of conceptual datum for an one D array )


setField

public final void setField(int index,
                           double doubleData,
                           int fieldID)
set a double field value at certain index( index of conceptual datum for an one D array )


setField

public final void setField(int index,
                           short shortData,
                           int fieldID)
set a short field value at certain index( index of conceptual datum for an one D array )


setField

public final void setField(int index,
                           byte byteData,
                           int fieldID)
set a byte field value at certain index( index of conceptual datum for an one D array )


setField

public final void setField(int index,
                           float floatData,
                           int fieldID)
set a float field value at certain index( index of conceptual datum for an one D array )


setField

public void setField(int fieldIndex,
                     float floatData)
set a field value, the index is the index of the field in this 1D array


getFloat

public float getFloat(IndexSpaceID did,
                      int fieldNumber)
get the float attribute for a given IndexSpaceID and attributeID, convert if needed

Overrides:
getFloat in class DataCollection

getDouble

public double getDouble(IndexSpaceID did,
                        int fieldNumber)
get the field value at the ISID position as an int. Convert type if necessary.

Overrides:
getDouble in class DataCollection

getInt

public int getInt(IndexSpaceID did,
                  int fieldNumber)
get the field value at the ISID position as an int. Convert type if necessary.

Overrides:
getInt in class DataCollection

getShort

public short getShort(IndexSpaceID did,
                      int fieldNumber)
get the field value at the ISID position as a short. Convert type if necessary.

Overrides:
getShort in class DataCollection

getByte

public byte getByte(IndexSpaceID did,
                    int fieldNumber)
get the field value at the ISID position as a short. Convert type if necessary.

Overrides:
getByte in class DataCollection

getFloats

public void getFloats(float[] dstArray,
                      RecordSpec recordSpec,
                      boolean pointOrder)
User passes in a pre-allocated float array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean parameter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into floats if they are not stored as float in this BasicBlock.


getInts

public void getInts(int[] dstArray,
                    RecordSpec recordSpec,
                    boolean pointOrder)
User passes in a pre-allocated int array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into ints if they are not stored as ints in this BasicBlock.


getShorts

public void getShorts(short[] dstArray,
                      RecordSpec recordSpec,
                      boolean pointOrder)
User passes in a pre-allocated short array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into shorts if they are not stored as shorts in this BasicBlock.


getDoubles

public void getDoubles(double[] dstArray,
                       RecordSpec recordSpec,
                       boolean pointOrder)
User passes in a pre-allocated double array, attributes specified by recordSpec are copied from the BasicBlock to the dstArray. attribute IDs and their storage order are specified in RecordSpec. the boolean paramerter indicates if the attribute in the dstArray in stored in a Point Order or AttributeOrder Attributes are changed into doubles if they are not stored as doulbes in this BasicBlock.


setValues

public boolean setValues(Values vals)
Set all values at once. The input Values must be of the correct length (which is tested) and are assumed to have the correct data order and axis order. Return of true indicates that implementation occurred.

Overrides:
setValues in class DataBlock

setFloats

public void setFloats(float[] newVals)
set the entire attribute array block to the passed argument. If the array size is not correct, should generate an error. If storage type is not float, do nothing (should convert).


setDoubles

public void setDoubles(int attr,
                       double[] newValues)
Assign attribute values for all points in the block

Overrides:
setDoubles in class DataBlock

setFloats

public void setFloats(int attr,
                      float[] newValues)
Assign attribute values for all points in the block

Overrides:
setFloats in class DataBlock

setInts

public void setInts(int attr,
                    int[] newValues)
Assign attribute values for all points in the block

Overrides:
setInts in class DataBlock

setShorts

public void setShorts(int attr,
                      short[] newValues)
Assign attribute values for all points in the block

Overrides:
setShorts in class DataBlock

setBytes

public void setBytes(int attr,
                     byte[] newValues)
Assign attribute values for all points in the block

Overrides:
setBytes in class DataBlock

setValues

public void setValues(int attr,
                      Values newValues)
Assign attribute values for all points in the block

Overrides:
setValues in class DataBlock

datum

public Datum datum(IndexSpaceID did)
Given an IndexSpaceID, return the corresponding datum.( this only works for float implementation )

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  IndexSpaceID did)
Given IndexSpaceID, load the corresponding datum into the datum argument. (this only works for float implementation )

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum datum,
                  int[] coords)
Given an array of coordinates, load the corresponding datum into the datum argument.

Overrides:
datum in class DataCollection

datum

public void datum(ShortDatum datum,
                  int[] coords)
Given an array of coordinates, load the corresponding datum into the datum argument.


datum

public void datum(ByteDatum datum,
                  int[] coords)
Given an array of coordinates, load the corresponding datum into the datum argument.


datum

public Datum datum(IndexSpaceID did,
                   RecordSpec spec)
Given an IndexSpaceID, return the corresponding datum with attributes specified in the RecordSpec.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

datum

public void datum(Datum dtm,
                  IndexSpaceID did,
                  FieldIDMapper mp)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding FieldIDMapper.

Specified by:
datum in interface Indexable
Specified by:
datum in class DataCollection

datum

public void datum(Datum dtm,
                  IndexSpaceID did,
                  RecordSpec recSpec)
Get the Datum and fill its values in the passed Datum at positions specified by the corresponding RecordSpec.

Specified by:
datum in interface Indexable
Overrides:
datum in class DataCollection

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds)
this is the old interface, the query bounds is check to ensure correctness

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

psubblock

public void psubblock(DataBlock dstBlock,
                      ISBounds dstBounds,
                      ISBounds srcBounds)
this subblock does not check the bounds


subblock

protected void subblock(BasicBlock dstBlock,
                        ISBounds inDestBounds,
                        ISBounds srcBounds)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. Note: currently we assume the datablock is BasicBlock, and the space of this basicblock has been allocated in advance AND is correctly sized.


subblock

protected void subblock(BasicBlock dstBlock,
                        ISBounds inDestBounds,
                        ISBounds srcBounds,
                        RecordSpec rs,
                        FieldIDMapper fim)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. Note: currently we assume the datablock is BasicBlock, and the space of this basicblock has been allocated in advance AND is correctly sized.


copyData

protected void copyData(int srcOffset,
                        int dstOffset,
                        int[] componentFields,
                        int[] compositeFields)

copyData

protected void copyData(int srcOffset,
                        int dstOffset,
                        int[] rsMapping)

copyData

protected void copyData(int srcOffset,
                        int dstOffset,
                        int rodDataSize)

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     FieldIDMapper mp)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The FieldIDMapper argument determines the mapping between datums in this DataBlock and datums in the argument DataBlock. It is valid to pass a null argument for FieldIDMapper; this means use all attributes. ( Non-BasicBlock arguments are not implemented.)

Specified by:
subblock in interface Indexable
Specified by:
subblock in class DataCollection

subblock

public void subblock(DataBlock dstBlock,
                     ISBounds dstBounds,
                     ISBounds srcBounds,
                     RecordSpec spec)
Reads a subblock defined by srcBounds into the region of the Datablock argument defined by dstBounds. The RecordSpec argument specifies a subset of the attributes of this DataSource to be written into the DataBlock datums.( not implemented)

Specified by:
subblock in interface Indexable
Overrides:
subblock in class DataCollection

setDatum

public void setDatum(IndexSpaceID isid,
                     Datum d)
Set the location specified by the IndexSpaceID to the given datum.

Specified by:
setDatum in class DataBlock

setRod

protected void setRod(java.nio.ByteBuffer byteBuffer,
                      int rodSize,
                      int startDatumArrayOffset,
                      int datumArrayStep,
                      FieldIDMapper mp,
                      RecordDescriptor sourceRecordDesc)
given a rod of data ( byte buffer), copy the specified field into the corresponding location in the BasicBlock, dstBlock is considered as compositeBlock, the srcBlock is the componentBlock


setAttributeOrderRod

protected void setAttributeOrderRod(java.nio.ByteBuffer byteBuffer,
                                    int rodSize,
                                    int startDatumArrayOffset,
                                    int datumArrayStep,
                                    int dstAttributeID,
                                    int attributeByteSize,
                                    int sourcetype)
given a rod of data of one attribute, copy the spedified attribute into the corresponding location in the BasicBlock , used for attribute order binaryFiledataSoure


setRod

protected void setRod(java.nio.ByteBuffer byteBuffer,
                      int rodSize,
                      int startDatumArrayOffset,
                      int datumArrayStep,
                      RecordSpec recSpec,
                      RecordDescriptor sourceRecordDesc)
given a rod of data ( byte buffer), copy the specified field in corresponding location in the BasicBlock, dstBlock is considered as composite , the srcBlock is the component