2004-01-21 03:05:46 +03:00
|
|
|
/*
|
|
|
|
* $HEADERS$
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-21 03:05:46 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-05-21 23:32:18 +04:00
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "errhandler/errhandler.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-01-21 03:05:46 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
2004-01-21 03:05:46 +03:00
|
|
|
#pragma weak MPI_Comm_f2c = PMPI_Comm_f2c
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILING_DEFINES
|
2004-04-20 22:50:43 +04:00
|
|
|
#include "mpi/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2004-07-30 06:58:53 +04:00
|
|
|
static const char FUNC_NAME[] = "MPI_Comm_f2c";
|
2004-06-23 00:21:35 +04:00
|
|
|
|
2004-01-21 03:05:46 +03:00
|
|
|
|
2004-05-21 23:32:18 +04:00
|
|
|
MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
|
|
|
|
{
|
|
|
|
size_t o_index= (size_t) comm;
|
|
|
|
|
|
|
|
if ( MPI_PARAM_CHECK ) {
|
2004-06-23 00:21:35 +04:00
|
|
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
2004-08-14 16:28:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Per MPI-2:4.12.4, do not invoke an error handler if we get an
|
|
|
|
invalid fortran handle */
|
2004-05-21 23:32:18 +04:00
|
|
|
|
2004-08-14 16:28:25 +04:00
|
|
|
if ( 0 > o_index ||
|
|
|
|
o_index >= ompi_pointer_array_get_size(&ompi_mpi_communicators)) {
|
|
|
|
return MPI_COMM_NULL;
|
2004-05-21 23:32:18 +04:00
|
|
|
}
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
return ompi_mpi_communicators.addr[o_index];
|
2004-01-21 03:05:46 +03:00
|
|
|
}
|