JNIEXPORT jobject JNICALL Java_mpi_GraphComm_getDims(
        JNIEnv *env, jobject jthis, jlong comm)
{
    int maxInd, maxEdg;
    int rc = MPI_Graphdims_get((MPI_Comm)comm, &maxInd, &maxEdg);

    if(ompi_java_exceptionCheck(env, rc))
        return NULL;

    jintArray index = (*env)->NewIntArray(env, maxInd),
              edges = (*env)->NewIntArray(env, maxEdg);

    jint *jIndex, *jEdges;
    int  *cIndex, *cEdges;
    ompi_java_getIntArray(env, index, &jIndex, &cIndex);
    ompi_java_getIntArray(env, edges, &jEdges, &cEdges);

    rc = MPI_Graph_get((MPI_Comm)comm, maxInd, maxEdg, cIndex, cEdges);
    ompi_java_exceptionCheck(env, rc);

    ompi_java_releaseIntArray(env, index, jIndex, cIndex);
    ompi_java_releaseIntArray(env, edges, jEdges, cEdges);

    return (*env)->NewObject(env, ompi_java.GraphParmsClass,
                             ompi_java.GraphParmsInit, index, edges);
}
Example #2
0
void ompi_graph_get_f(MPI_Fint *comm, MPI_Fint *maxindex,
		     MPI_Fint *maxedges, MPI_Fint *indx,
		     MPI_Fint *edges, MPI_Fint *ierr)
{
    int c_ierr;
    MPI_Comm c_comm;
    OMPI_ARRAY_NAME_DECL(indx);
    OMPI_ARRAY_NAME_DECL(edges);

    c_comm = MPI_Comm_f2c(*comm);
    OMPI_ARRAY_FINT_2_INT_ALLOC(indx, *maxindex);
    OMPI_ARRAY_FINT_2_INT_ALLOC(edges, *maxedges);

    c_ierr = MPI_Graph_get(c_comm,
                           OMPI_FINT_2_INT(*maxindex),
                           OMPI_FINT_2_INT(*maxedges),
                           OMPI_ARRAY_NAME_CONVERT(indx),
                           OMPI_ARRAY_NAME_CONVERT(edges));
    if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

    if (MPI_SUCCESS == c_ierr) {
        OMPI_ARRAY_INT_2_FINT(indx, *maxindex);
        OMPI_ARRAY_INT_2_FINT(edges, *maxedges);
    } else {
        OMPI_ARRAY_FINT_2_INT_CLEANUP(indx);
        OMPI_ARRAY_FINT_2_INT_CLEANUP(edges);
    }
}
Example #3
0
FORT_DLL_SPEC void FORT_CALL mpi_graph_get_ ( MPI_Fint *v1, MPI_Fint *v2, MPI_Fint *v3, MPI_Fint *v4, MPI_Fint *v5, MPI_Fint *ierr ){
    *ierr = MPI_Graph_get( (MPI_Comm)(*v1), *v2, *v3, v4, v5 );
}