Index: ompi/mpi/java/java/Datatype.java =================================================================== --- ompi/mpi/java/java/Datatype.java (revision 27719) +++ ompi/mpi/java/java/Datatype.java (working copy) @@ -558,8 +558,10 @@ public int Extent() throws MPIException { if(baseType == OBJECT || baseType == UNDEFINED) return ub - lb ; - else - return extent() / baseSize ; + else { + /* return extent() / baseSize ; JMS I think this is wrong */ + return extent(); + } } private native int extent(); @@ -578,8 +580,10 @@ public int Size() throws MPIException { if(baseType == OBJECT || baseType == UNDEFINED) return displacements.length; - else - return size() / baseSize ; + else { + /* return size() / baseSize ; JMS I think this is wrong */ + return size(); + } } private native int size(); @@ -599,8 +603,10 @@ public int Lb() throws MPIException { if(baseType == OBJECT || baseType == UNDEFINED) return lb; - else - return lB() / baseSize ; + else { + /* return lB() / baseSize ; JMS I think this is wrong */ + return lB(); + } } private native int lB(); @@ -620,8 +626,10 @@ public int Ub() throws MPIException { if(baseType == OBJECT || baseType == UNDEFINED) return ub; - else - return uB() / baseSize ; + else { + /* return uB() / baseSize ; JMS I think this is wrong */ + return uB() / baseSize ; + } } private native int uB(); @@ -818,6 +826,27 @@ array_of_types) ; } + /* + * JMS add proper documentation here + * JMS int != Aint! This needs to be fixed throughout. + */ + public static Datatype Resized(Datatype oldtype, + int lb, + int extent) throws MPIException { + return new Datatype(oldtype, lb, extent); + } + + /* + * Constructor used by 'Resized' + */ + private Datatype(Datatype oldtype, int lb, int extent) throws MPIException { + baseSize = oldtype.baseSize; + baseType = oldtype.baseType; + GetResized(oldtype, lb, extent); + } + + private native void GetResized(Datatype oldtype, int lb, int extent); + protected long handle; protected int baseType ; protected int baseSize ; // or private Index: ompi/mpi/java/c/mpi_Datatype.c =================================================================== --- ompi/mpi/java/c/mpi_Datatype.c (revision 27719) +++ ompi/mpi/java/c/mpi_Datatype.c (working copy) @@ -392,3 +392,23 @@ (*env)->SetLongField(env,jthis, ompi_java.DatatypehandleID, (jlong)type); } + +/* + * Class: mpi_Datatype + * Method: GetResized + * Signature: (III)V JMS ??? + */ +JNIEXPORT void JNICALL Java_mpi_Datatype_GetResized(JNIEnv *env, jobject jthis, + jobject oldtype, + jint lb, jint extent) +{ + MPI_Datatype type; + + ompi_java_clearFreeList(env) ; + + MPI_Type_create_resized((MPI_Datatype)((*env)->GetLongField(env,oldtype,ompi_java.DatatypehandleID)), + lb, extent, &type); + + (*env)->SetLongField(env, jthis, ompi_java.DatatypehandleID, (jlong)type); +} + Index: ompi/mpi/java/c/mpijava.exp =================================================================== --- ompi/mpi/java/c/mpijava.exp (revision 27719) +++ ompi/mpi/java/c/mpijava.exp (working copy) @@ -45,6 +45,7 @@ Java_mpi_Datatype_GetHvector Java_mpi_Datatype_GetIndexed Java_mpi_Datatype_GetHindexed +Java_mpi_Datatype_GetResized Java_mpi_Datatype_GetStruct Java_mpi_Datatype_extent Java_mpi_Datatype_size