root/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ompi_dist_graph_neighbors_f

   1 /*
   2  * Copyright (c) 2011-2013 The University of Tennessee and The University
   3  *                         of Tennessee Research Foundation.  All rights
   4  *                         reserved.
   5  * Copyright (c) 2011-2013 Inria.  All rights reserved.
   6  * Copyright (c) 2011-2013 Université Bordeaux 1
   7  * Copyright (c) 2015      Research Organization for Information Science
   8  *                         and Technology (RIST). All rights reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #include "ompi_config.h"
  17 
  18 #include "ompi/mpi/fortran/mpif-h/bindings.h"
  19 #include "ompi/mpi/fortran/base/constants.h"
  20 
  21 #if OMPI_BUILD_MPI_PROFILING
  22 #if OPAL_HAVE_WEAK_SYMBOLS
  23 #pragma weak PMPI_DIST_GRAPH_NEIGHBORS = ompi_dist_graph_neighbors_f
  24 #pragma weak pmpi_dist_graph_neighbors = ompi_dist_graph_neighbors_f
  25 #pragma weak pmpi_dist_graph_neighbors_ = ompi_dist_graph_neighbors_f
  26 #pragma weak pmpi_dist_graph_neighbors__ = ompi_dist_graph_neighbors_f
  27 
  28 #pragma weak PMPI_Dist_graph_neighbors_f = ompi_dist_graph_neighbors_f
  29 #pragma weak PMPI_Dist_graph_neighbors_f08 = ompi_dist_graph_neighbors_f
  30 #else
  31 OMPI_GENERATE_F77_BINDINGS (PMPI_DIST_GRAPH_NEIGHBORS,
  32                             pmpi_dist_graph_neighbors,
  33                             pmpi_dist_graph_neighbors_,
  34                             pmpi_dist_graph_neighbors__,
  35                             pompi_dist_graph_neighbors_f,
  36                             (MPI_Fint* comm, MPI_Fint* maxindegree, MPI_Fint* sources, MPI_Fint* sourceweights, MPI_Fint* maxoutdegree, MPI_Fint* destinations, MPI_Fint* destweights, MPI_Fint *ierr),
  37                             (comm, maxindegree, sources, sourceweights, maxoutdegree, destinations, destweights, ierr) )
  38 #endif
  39 #endif
  40 
  41 #if OPAL_HAVE_WEAK_SYMBOLS
  42 #pragma weak MPI_DIST_GRAPH_NEIGHBORS = ompi_dist_graph_neighbors_f
  43 #pragma weak mpi_dist_graph_neighbors = ompi_dist_graph_neighbors_f
  44 #pragma weak mpi_dist_graph_neighbors_ = ompi_dist_graph_neighbors_f
  45 #pragma weak mpi_dist_graph_neighbors__ = ompi_dist_graph_neighbors_f
  46 
  47 #pragma weak MPI_Dist_graph_neighbors_f = ompi_dist_graph_neighbors_f
  48 #pragma weak MPI_Dist_graph_neighbors_f08 = ompi_dist_graph_neighbors_f
  49 #else
  50 #if ! OMPI_BUILD_MPI_PROFILING
  51 OMPI_GENERATE_F77_BINDINGS (MPI_DIST_GRAPH_NEIGHBORS,
  52                             mpi_dist_graph_neighbors,
  53                             mpi_dist_graph_neighbors_,
  54                             mpi_dist_graph_neighbors__,
  55                             ompi_dist_graph_neighbors_f,
  56                             (MPI_Fint* comm, MPI_Fint* maxindegree, MPI_Fint* sources, MPI_Fint* sourceweights, MPI_Fint* maxoutdegree, MPI_Fint* destinations, MPI_Fint* destweights, MPI_Fint *ierr),
  57                             (comm, maxindegree, sources, sourceweights, maxoutdegree, destinations, destweights, ierr) )
  58 #endif
  59 
  60 #if OMPI_BUILD_MPI_PROFILING && ! OPAL_HAVE_WEAK_SYMBOLS
  61 #define ompi_dist_graph_neighbors_f pompi_dist_graph_neighbors_f
  62 #endif
  63 #endif
  64 
  65 
  66 void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree,
  67                                  MPI_Fint* sources, MPI_Fint* sourceweights,
  68                                  MPI_Fint* maxoutdegree, MPI_Fint* destinations,
  69                                  MPI_Fint* destweights,
  70                                  MPI_Fint *ierr)
  71 {
  72     MPI_Comm c_comm;
  73     OMPI_ARRAY_NAME_DECL(sources);
  74     OMPI_ARRAY_NAME_DECL(sourceweights);
  75     OMPI_ARRAY_NAME_DECL(destinations);
  76     OMPI_ARRAY_NAME_DECL(destweights);
  77 
  78     c_comm = PMPI_Comm_f2c(*comm);
  79 
  80     OMPI_ARRAY_FINT_2_INT_ALLOC(sources, *maxindegree);
  81     if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) {
  82         OMPI_ARRAY_FINT_2_INT_ALLOC(sourceweights, *maxindegree);
  83     }
  84     OMPI_ARRAY_FINT_2_INT_ALLOC(destinations, *maxoutdegree);
  85     if( !OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ) {
  86         OMPI_ARRAY_FINT_2_INT_ALLOC(destweights, *maxoutdegree);
  87     }
  88 
  89     *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree),
  90                                                       OMPI_ARRAY_NAME_CONVERT(sources),
  91                                                       OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights),
  92                                                       OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations),
  93                                                       OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights)));
  94     if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
  95         OMPI_ARRAY_INT_2_FINT(sources, *maxindegree);
  96         if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) {
  97             OMPI_ARRAY_INT_2_FINT(sourceweights, *maxindegree);
  98         }
  99         OMPI_ARRAY_INT_2_FINT(destinations, *maxoutdegree);
 100         if( !OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ) {
 101             OMPI_ARRAY_INT_2_FINT(destweights, *maxoutdegree);
 102         }
 103     } else {
 104         OMPI_ARRAY_FINT_2_INT_CLEANUP(sources);
 105         if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) {
 106             OMPI_ARRAY_FINT_2_INT_CLEANUP(sourceweights);
 107         }
 108         OMPI_ARRAY_FINT_2_INT_CLEANUP(destinations);
 109         if( !OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ) {
 110             OMPI_ARRAY_FINT_2_INT_CLEANUP(destweights);
 111         }
 112     }
 113 }
 114 

/* [<][>][^][v][top][bottom][index][help] */