use of java.nio.ShortBuffer in project ffx by mjschnie.
the class Unsigned16BitIntegerMatrixReductionBuf method receiveItems.
// Hidden operations.
/**
* {@inheritDoc}
*
* Receive as many items as possible from the given byte buffer to this
* buffer.
* <P>
* The <TT>receiveItems()</TT> method must not block the calling thread; if
* it does, all message I/O in MP will be blocked.
*/
protected int receiveItems(int i, int num, ByteBuffer buffer) {
ShortBuffer shortbuffer = buffer.asShortBuffer();
num = Math.min(num, shortbuffer.remaining());
int n = 0;
int r = i2r(i);
int row = r * myRowStride + myLowerRow;
int c = i2c(i);
int col = c * myColStride + myLowerCol;
int ncols = Math.min(myColCount - c, num);
while (r < myRowCount && ncols > 0) {
int[] myMatrix_row = myMatrix[row];
for (c = 0; c < ncols; ++c) {
myMatrix_row[col] = myOp.op(myMatrix_row[col], shortbuffer.get()) & 0xFFFF;
col += myColStride;
}
num -= ncols;
n += ncols;
++r;
row += myRowStride;
col = myLowerCol;
ncols = Math.min(myColCount, num);
}
buffer.position(buffer.position() + 2 * n);
return n;
}
use of java.nio.ShortBuffer in project ffx by mjschnie.
the class Signed16BitIntegerMatrixBuf method receiveItems.
/**
* {@inheritDoc}
*
* Receive as many items as possible from the given byte buffer to this
* buffer.
* <P>
* The <TT>receiveItems()</TT> method must not block the calling thread; if
* it does, all message I/O in MP will be blocked.
*/
protected int receiveItems(int i, int num, ByteBuffer buffer) {
ShortBuffer shortbuffer = buffer.asShortBuffer();
num = Math.min(num, shortbuffer.remaining());
int n = 0;
int r = i2r(i);
int row = r * myRowStride + myLowerRow;
int c = i2c(i);
int col = c * myColStride + myLowerCol;
int ncols = Math.min(myColCount - c, num);
while (r < myRowCount && ncols > 0) {
int[] myMatrix_row = myMatrix[row];
for (c = 0; c < ncols; ++c) {
myMatrix_row[col] = shortbuffer.get();
col += myColStride;
}
num -= ncols;
n += ncols;
++r;
row += myRowStride;
col = myLowerCol;
ncols = Math.min(myColCount, num);
}
buffer.position(buffer.position() + 2 * n);
return n;
}
use of java.nio.ShortBuffer in project ffx by mjschnie.
the class Signed16BitIntegerMatrixReductionBuf method receiveItems.
// Hidden operations.
/**
* {@inheritDoc}
*
* Receive as many items as possible from the given byte buffer to this
* buffer.
* <P>
* The <TT>receiveItems()</TT> method must not block the calling thread; if
* it does, all message I/O in MP will be blocked.
*/
protected int receiveItems(int i, int num, ByteBuffer buffer) {
ShortBuffer shortbuffer = buffer.asShortBuffer();
num = Math.min(num, shortbuffer.remaining());
int n = 0;
int r = i2r(i);
int row = r * myRowStride + myLowerRow;
int c = i2c(i);
int col = c * myColStride + myLowerCol;
int ncols = Math.min(myColCount - c, num);
while (r < myRowCount && ncols > 0) {
int[] myMatrix_row = myMatrix[row];
for (c = 0; c < ncols; ++c) {
myMatrix_row[col] = myOp.op(myMatrix_row[col], shortbuffer.get());
col += myColStride;
}
num -= ncols;
n += ncols;
++r;
row += myRowStride;
col = myLowerCol;
ncols = Math.min(myColCount, num);
}
buffer.position(buffer.position() + 2 * n);
return n;
}
use of java.nio.ShortBuffer in project ffx by mjschnie.
the class ShortMatrixBuf method receiveItems.
/**
* {@inheritDoc}
*
* Receive as many items as possible from the given byte buffer to this
* buffer.
* <P>
* The <TT>receiveItems()</TT> method must not block the calling thread; if
* it does, all message I/O in MP will be blocked.
*/
protected int receiveItems(int i, int num, ByteBuffer buffer) {
ShortBuffer shortbuffer = buffer.asShortBuffer();
num = Math.min(num, shortbuffer.remaining());
int n = 0;
int r = i2r(i);
int row = r * myRowStride + myLowerRow;
int c = i2c(i);
int col = c * myColStride + myLowerCol;
int ncols = Math.min(myColCount - c, num);
while (r < myRowCount && ncols > 0) {
short[] myMatrix_row = myMatrix[row];
for (c = 0; c < ncols; ++c) {
myMatrix_row[col] = shortbuffer.get();
col += myColStride;
}
num -= ncols;
n += ncols;
++r;
row += myRowStride;
col = myLowerCol;
ncols = Math.min(myColCount, num);
}
buffer.position(buffer.position() + 2 * n);
return n;
}
use of java.nio.ShortBuffer in project ffx by mjschnie.
the class ShortMatrixReductionBuf method receiveItems.
// Hidden operations.
/**
* {@inheritDoc}
*
* Receive as many items as possible from the given byte buffer to this
* buffer.
* <P>
* The <TT>receiveItems()</TT> method must not block the calling thread; if
* it does, all message I/O in MP will be blocked.
*/
protected int receiveItems(int i, int num, ByteBuffer buffer) {
ShortBuffer shortbuffer = buffer.asShortBuffer();
num = Math.min(num, shortbuffer.remaining());
int n = 0;
int r = i2r(i);
int row = r * myRowStride + myLowerRow;
int c = i2c(i);
int col = c * myColStride + myLowerCol;
int ncols = Math.min(myColCount - c, num);
while (r < myRowCount && ncols > 0) {
short[] myMatrix_row = myMatrix[row];
for (c = 0; c < ncols; ++c) {
myMatrix_row[col] = myOp.op(myMatrix_row[col], shortbuffer.get());
col += myColStride;
}
num -= ncols;
n += ncols;
++r;
row += myRowStride;
col = myLowerCol;
ncols = Math.min(myColCount, num);
}
buffer.position(buffer.position() + 2 * n);
return n;
}
Aggregations