private void getTrueLbExtent() throws MPIException { MPI.check(); int lbExt[] = new int[2]; getTrueLbExtent(handle, lbExt); trueLb = lbExt[0] / baseSize; trueExtent = lbExt[1] / baseSize; }
/** * Stores attribute value associated with a key. * * <p>Java binding of the MPI operation {@code MPI_TYPE_SET_ATTR}. * * @param keyval attribute key * @param value attribute value * @throws MPIException */ public void setAttr(int keyval, Object value) throws MPIException { MPI.check(); setAttr(handle, keyval, MPI.attrSet(value)); }
/** * Frees an attribute key. * * <p>Java binding of the MPI operation {@code MPI_TYPE_FREE_KEYVAL}. * * @param keyval attribute key * @throws MPIException */ public static void freeKeyval(int keyval) throws MPIException { MPI.check(); freeKeyval_jni(keyval); }
/** * Create a new attribute key. * * <p>Java binding of the MPI operation {@code MPI_TYPE_CREATE_KEYVAL}. * * @return attribute key for future access * @throws MPIException */ public static int createKeyval() throws MPIException { MPI.check(); return createKeyval_jni(); }
/** * Return the print name from the datatype. * * @return name of the datatype * @throws MPIException */ public String getName() throws MPIException { MPI.check(); return getName(handle); }
/** * Sets the print name for the datatype. * * @param name name for the datatype * @throws MPIException */ public void setName(String name) throws MPIException { MPI.check(); setName(handle, name); }
/** * Create a datatype with a new lower bound and extent from an existing datatype. * * <p>Java binding of the MPI operation {@code MPI_TYPE_CREATE_RESIZED}. * * @param oldType input datatype * @param lb new lower bound of datatype (address integer) * @param extent new extent of datatype (address integer) * @return new datatype * @throws MPIException */ public static Datatype createResized(Datatype oldType, int lb, int extent) throws MPIException { MPI.check(); long handle = getResized(oldType.handle, lb, extent); return new Datatype(oldType, handle); }
/** * Returns the total size of a datatype - the number of buffer elements it represents. * * <p>Java binding of the MPI operation {@code MPI_TYPE_SIZE}. * * @return datatype size * @throws MPIException */ public int getSize() throws MPIException { MPI.check(); return getSize(handle) / baseSize; }
/** * Identical to {@code createIndexed} except that the displacements are expressed directly in * terms of the buffer index, rather than the units of the old type. * * <p>Java binding of the MPI operation {@code MPI_TYPE_HINDEXED}. * * @param blockLengths number of elements per block * @param displacements byte displacement in buffer for each block * @param oldType old datatype * @return new datatype * @throws MPIException */ public static Datatype createHIndexed(int[] blockLengths, int[] displacements, Datatype oldType) throws MPIException { MPI.check(); long handle = getHIndexed(blockLengths, displacements, oldType.handle); return new Datatype(oldType, handle); }
/** * Identical to {@code createVector} except that the stride is expressed directly in terms of the * buffer index, rather than the units of the old type. * * <p>Java binding of the MPI operation {@code MPI_TYPE_HVECTOR}. * * @param count number of blocks * @param blockLength number of elements in each * @param stride number of bytes between start of each block * @param oldType old datatype * @return new datatype * @throws MPIException */ public static Datatype createHVector(int count, int blockLength, int stride, Datatype oldType) throws MPIException { MPI.check(); long handle = getHVector(count, blockLength, stride, oldType.handle); return new Datatype(oldType, handle); }
/** * Construct new datatype representing replication of old datatype into contiguous locations. * * <p>Java binding of the MPI operation {@code MPI_TYPE_CONTIGUOUS}. * * <p>The base type of the new datatype is the same as the base type of {@code oldType}. * * @param count replication count * @param oldType old datatype * @return new datatype * @throws MPIException */ public static Datatype createContiguous(int count, Datatype oldType) throws MPIException { MPI.check(); return new Datatype(oldType, getContiguous(count, oldType.handle)); }
/** * Java binding of {@code MPI_TYPE_DUP}. * * @return new datatype * @throws MPIException */ public Datatype dup() throws MPIException { MPI.check(); return new Datatype(this, dup(handle)); }
/** * Frees the datatype. * * <p>Java binding of the MPI operation {@code MPI_TYPE_FREE}. * * @throws MPIException */ @Override public void free() throws MPIException { MPI.check(); handle = free(handle); }
/** * Commits a derived datatype. Java binding of the MPI operation {@code MPI_TYPE_COMMIT}. * * @throws MPIException */ public void commit() throws MPIException { MPI.check(); commit(handle); }
/** * Retrieves attribute value by key. * * <p>Java binding of the MPI operation {@code MPI_TYPE_GET_ATTR}. * * @param keyval attribute key * @return attribute value or null if no attribute is associated with the key. * @throws MPIException */ public Object getAttr(int keyval) throws MPIException { MPI.check(); Object obj = getAttr(handle, keyval); return obj instanceof byte[] ? MPI.attrGet((byte[]) obj) : obj; }
/** * Deletes an attribute value associated with a key. * * <p>Java binding of the MPI operation {@code MPI_TYPE_DELETE_ATTR}. * * @param keyval attribute key * @throws MPIException */ public void deleteAttr(int keyval) throws MPIException { MPI.check(); deleteAttr(handle, keyval); }
/** * The most general type constructor. * * <p>Java binding of the MPI operation {@code MPI_TYPE_STRUCT}. * * <p>The number of blocks is taken to be size of the {@code blockLengths} argument. The second * and third arguments, {@code displacements}, and {@code types}, should be the same size. * * @param blockLengths number of elements in each block * @param displacements byte displacement of each block * @param types type of elements in each block * @return new datatype * @throws MPIException */ public static Datatype createStruct(int[] blockLengths, int[] displacements, Datatype[] types) throws MPIException { MPI.check(); long handle = getStruct(blockLengths, displacements, types); return new Datatype(MPI.BYTE, handle); }