-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/binding/cxx/initcxx.cxx
        -:    0:Graph:initcxx.gcno
        -:    0:Data:initcxx.gcda
        -:    0:Runs:509
        -:    0:Programs:136
        -:    1:/* -*- Mode: C++; c-basic-offset:4 ; -*- */
        -:    2:/*  
        -:    3: *  (C) 2001 by Argonne National Laboratory.
        -:    4: *      See COPYRIGHT in top-level directory.
        -:    5: *
        -:    6: * This file is automatically generated by buildiface -nosep
        -:    7: * DO NOT EDIT
        -:    8: */
        -:    9:/* style: c++ header */
        -:   10:
        -:   11:#include "mpi.h"
        -:   12:#include <stdarg.h>
        -:   13:#include "mpichconf.h"
        -:   14:
        -:   15:// #define MPIX_TRACE_MEMORY
        -:   16:#ifdef MPIX_TRACE_MEMORY
        -:   17:int _mpi_lineno = __LINE__;
        -:   18:// We need stdlib.h for size_t.  But that can cause problems if the
        -:   19:// header isn't C++ clean.  Instead, we just include a definition
        -:   20:// for size_t.  If this is not the correct size, then edit this line
        -:   21:// (Note that this is needed only when memory tracing is enabled)
        -:   22:typedef unsigned int size_t;
        -:   23:extern "C" void *MPIU_trmalloc( unsigned int, int, const char [] );
        -:   24:extern "C" void MPIU_trfree( void *, int, const char [] );
        -:   25:extern "C" void MPIU_trdump( void *, int );
        -:   26:void *operator new(size_t size) {
        -:   27:    void *p = MPIU_trmalloc( (unsigned int) size, _mpi_lineno, __FILE__ );
        -:   28:    return p;}
        -:   29:void operator delete(void *p) {
        -:   30:    MPIU_trfree( p, _mpi_lineno, __FILE__ );}
        -:   31:void *operator new[]( size_t size) {
        -:   32:    void *p = MPIU_trmalloc( (unsigned int) size, _mpi_lineno, __FILE__ );
        -:   33:    return p;}
        -:   34:void operator delete[](void *p) {
        -:   35:    MPIU_trfree( p, _mpi_lineno, __FILE__ );}
        -:   36:#define MPIX_TRSummary() MPIU_trdump( 0, -1 )
        -:   37:#define MPIX_SetLineno _mpi_lineno = __LINE__ + 1
        -:   38:#else
        -:   39:#define MPIX_TRSummary()
        -:   40:#define MPIX_SetLineno
        -:   41:#endif
        -:   42:namespace MPI {
     1018:   43:Datatype CHAR(MPI_CHAR);
     1018:   44:Datatype UNSIGNED_CHAR(MPI_UNSIGNED_CHAR);
     1018:   45:Datatype BYTE(MPI_BYTE);
     1018:   46:Datatype SHORT(MPI_SHORT);
     1018:   47:Datatype UNSIGNED_SHORT(MPI_UNSIGNED_SHORT);
     1018:   48:Datatype INT(MPI_INT);
     1018:   49:Datatype UNSIGNED(MPI_UNSIGNED);
     1018:   50:Datatype LONG(MPI_LONG);
     1018:   51:Datatype UNSIGNED_LONG(MPI_UNSIGNED_LONG);
     1018:   52:Datatype FLOAT(MPI_FLOAT);
     1018:   53:Datatype DOUBLE(MPI_DOUBLE);
     1018:   54:Datatype LONG_DOUBLE(MPI_LONG_DOUBLE);
     1018:   55:Datatype LONG_LONG_INT(MPI_LONG_LONG_INT);
     1018:   56:Datatype LONG_LONG(MPI_LONG_LONG);
     1018:   57:Datatype PACKED(MPI_PACKED);
     1018:   58:Datatype LB(MPI_LB);
     1018:   59:Datatype UB(MPI_UB);
     1018:   60:Datatype FLOAT_INT(MPI_FLOAT_INT);
     1018:   61:Datatype DOUBLE_INT(MPI_DOUBLE_INT);
     1018:   62:Datatype LONG_INT(MPI_LONG_INT);
     1018:   63:Datatype SHORT_INT(MPI_SHORT_INT);
     1018:   64:Datatype LONG_DOUBLE_INT(MPI_LONG_DOUBLE_INT);
     1018:   65:Datatype REAL4(MPI_REAL4);
     1018:   66:Datatype REAL8(MPI_REAL8);
     1018:   67:Datatype REAL16(MPI_REAL16);
     1018:   68:Datatype COMPLEX8(MPI_COMPLEX8);
     1018:   69:Datatype COMPLEX16(MPI_COMPLEX16);
     1018:   70:Datatype COMPLEX32(MPI_COMPLEX32);
     1018:   71:Datatype INTEGER1(MPI_INTEGER1);
     1018:   72:Datatype INTEGER2(MPI_INTEGER2);
     1018:   73:Datatype INTEGER4(MPI_INTEGER4);
     1018:   74:Datatype INTEGER8(MPI_INTEGER8);
     1018:   75:Datatype INTEGER16(MPI_INTEGER16);
     1018:   76:Datatype WCHAR(MPI_WCHAR);
     1018:   77:Datatype SIGNED_CHAR(MPI_SIGNED_CHAR);
     1018:   78:Datatype UNSIGNED_LONG_LONG(MPI_UNSIGNED_LONG_LONG);
     1018:   79:Datatype TWOINT(MPI_2INT);
     1018:   80:Datatype BOOL(MPIR_CXX_BOOL);
     1018:   81:Datatype COMPLEX(MPIR_CXX_COMPLEX);
     1018:   82:Datatype DOUBLE_COMPLEX(MPIR_CXX_DOUBLE_COMPLEX);
     1018:   83:Datatype LONG_DOUBLE_COMPLEX(MPIR_CXX_LONG_DOUBLE_COMPLEX);
     1018:   84:Datatype DATATYPE_NULL;
        -:   85:
        -:   86:#ifdef HAVE_FORTRAN_BINDING
     1018:   87:Datatype INTEGER(MPI_INTEGER);
     1018:   88:Datatype REAL(MPI_REAL);
     1018:   89:Datatype DOUBLE_PRECISION(MPI_DOUBLE_PRECISION);
     1018:   90:Datatype F_COMPLEX(MPI_COMPLEX);
     1018:   91:Datatype F_DOUBLE_COMPLEX(MPI_DOUBLE_COMPLEX);
     1018:   92:Datatype LOGICAL(MPI_LOGICAL);
     1018:   93:Datatype CHARACTER(MPI_CHARACTER);
     1018:   94:Datatype TWOREAL(MPI_2REAL);
     1018:   95:Datatype TWODOUBLE_PRECISION(MPI_2DOUBLE_PRECISION);
     1018:   96:Datatype TWOINTEGER(MPI_2INTEGER);
        -:   97:#endif
     1018:   98:const Op MAX(MPI_MAX);
     1018:   99:const Op MIN(MPI_MIN);
     1018:  100:const Op SUM(MPI_SUM);
     1018:  101:const Op PROD(MPI_PROD);
     1018:  102:const Op LAND(MPI_LAND);
     1018:  103:const Op BAND(MPI_BAND);
     1018:  104:const Op LOR(MPI_LOR);
     1018:  105:const Op BOR(MPI_BOR);
     1018:  106:const Op LXOR(MPI_LXOR);
     1018:  107:const Op BXOR(MPI_BXOR);
     1018:  108:const Op MINLOC(MPI_MINLOC);
     1018:  109:const Op MAXLOC(MPI_MAXLOC);
     1018:  110:const Op REPLACE(MPI_REPLACE);
     1018:  111:const Op OP_NULL;
     1018:  112:Intracomm COMM_WORLD(MPI_COMM_WORLD);
     1018:  113:Intracomm COMM_SELF(MPI_COMM_SELF);
     1018:  114:const Group GROUP_EMPTY(MPI_GROUP_EMPTY);
     1018:  115:const Nullcomm COMM_NULL;
     1018:  116:const Group GROUP_NULL;
     1018:  117:const Request REQUEST_NULL;
     1018:  118:const Errhandler ERRHANDLER_NULL;
     1018:  119:const Errhandler ERRORS_RETURN(MPI_ERRORS_RETURN);
     1018:  120:const Errhandler ERRORS_ARE_FATAL(MPI_ERRORS_ARE_FATAL);
     1018:  121:const Errhandler ERRORS_THROW_EXCEPTIONS(MPIR_ERRORS_THROW_EXCEPTIONS);
     1018:  122:const Info INFO_NULL;
     1018:  123:const Win WIN_NULL;
     1018:  124: File FILE_NULL;
        -:  125:const int BSEND_OVERHEAD= MPI_BSEND_OVERHEAD;
        -:  126:const int KEYVAL_INVALID= MPI_KEYVAL_INVALID;
        -:  127:const int CART= MPI_CART;
        -:  128:const int GRAPH= MPI_GRAPH;
        -:  129:const int IDENT= MPI_IDENT;
        -:  130:const int SIMILAR= MPI_SIMILAR;
        -:  131:const int CONGRUENT= MPI_CONGRUENT;
        -:  132:const int UNEQUAL= MPI_UNEQUAL;
        -:  133:const int PROC_NULL= MPI_PROC_NULL;
        -:  134:const int ANY_TAG= MPI_ANY_TAG;
        -:  135:const int ANY_SOURCE= MPI_ANY_SOURCE;
        -:  136:const int ROOT= MPI_ROOT;
        -:  137:const int TAG_UB= MPI_TAG_UB;
        -:  138:const int IO= MPI_IO;
        -:  139:const int HOST= MPI_HOST;
        -:  140:const int WTIME_IS_GLOBAL= MPI_WTIME_IS_GLOBAL;
        -:  141:const int UNIVERSE_SIZE= MPI_UNIVERSE_SIZE;
        -:  142:const int LASTUSEDCODE= MPI_LASTUSEDCODE;
        -:  143:const int APPNUM= MPI_APPNUM;
        -:  144:const int MAX_PROCESSOR_NAME= MPI_MAX_PROCESSOR_NAME;
        -:  145:const int MAX_ERROR_STRING= MPI_MAX_ERROR_STRING;
        -:  146:const int MAX_PORT_NAME= MPI_MAX_PORT_NAME;
        -:  147:const int MAX_OBJECT_NAME= MPI_MAX_OBJECT_NAME;
        -:  148:const int MAX_INFO_VAL= MPI_MAX_INFO_VAL;
        -:  149:const int MAX_INFO_KEY= MPI_MAX_INFO_KEY;
        -:  150:const int UNDEFINED= MPI_UNDEFINED;
        -:  151:const int LOCK_EXCLUSIVE= MPI_LOCK_EXCLUSIVE;
        -:  152:const int LOCK_SHARED= MPI_LOCK_SHARED;
        -:  153:const int WIN_BASE= MPI_WIN_BASE;
        -:  154:const int WIN_DISP_UNIT= MPI_WIN_DISP_UNIT;
        -:  155:const int WIN_SIZE= MPI_WIN_SIZE;
        -:  156:const int SUCCESS= MPI_SUCCESS;
        -:  157:const int ERR_BUFFER= MPI_ERR_BUFFER;
        -:  158:const int ERR_COUNT= MPI_ERR_COUNT;
        -:  159:const int ERR_TYPE= MPI_ERR_TYPE;
        -:  160:const int ERR_TAG= MPI_ERR_TAG;
        -:  161:const int ERR_COMM= MPI_ERR_COMM;
        -:  162:const int ERR_RANK= MPI_ERR_RANK;
        -:  163:const int ERR_REQUEST= MPI_ERR_REQUEST;
        -:  164:const int ERR_ROOT= MPI_ERR_ROOT;
        -:  165:const int ERR_GROUP= MPI_ERR_GROUP;
        -:  166:const int ERR_OP= MPI_ERR_OP;
        -:  167:const int ERR_TOPOLOGY= MPI_ERR_TOPOLOGY;
        -:  168:const int ERR_DIMS= MPI_ERR_DIMS;
        -:  169:const int ERR_ARG= MPI_ERR_ARG;
        -:  170:const int ERR_UNKNOWN= MPI_ERR_UNKNOWN;
        -:  171:const int ERR_TRUNCATE= MPI_ERR_TRUNCATE;
        -:  172:const int ERR_OTHER= MPI_ERR_OTHER;
        -:  173:const int ERR_INTERN= MPI_ERR_INTERN;
        -:  174:const int ERR_PENDING= MPI_ERR_PENDING;
        -:  175:const int ERR_IN_STATUS= MPI_ERR_IN_STATUS;
        -:  176:const int ERR_LASTCODE= MPI_ERR_LASTCODE;
        -:  177:const int ERR_FILE= MPI_ERR_FILE;
        -:  178:const int ERR_ACCESS= MPI_ERR_ACCESS;
        -:  179:const int ERR_AMODE= MPI_ERR_AMODE;
        -:  180:const int ERR_BAD_FILE= MPI_ERR_BAD_FILE;
        -:  181:const int ERR_FILE_EXISTS= MPI_ERR_FILE_EXISTS;
        -:  182:const int ERR_FILE_IN_USE= MPI_ERR_FILE_IN_USE;
        -:  183:const int ERR_NO_SPACE= MPI_ERR_NO_SPACE;
        -:  184:const int ERR_NO_SUCH_FILE= MPI_ERR_NO_SUCH_FILE;
        -:  185:const int ERR_IO= MPI_ERR_IO;
        -:  186:const int ERR_READ_ONLY= MPI_ERR_READ_ONLY;
        -:  187:const int ERR_CONVERSION= MPI_ERR_CONVERSION;
        -:  188:const int ERR_DUP_DATAREP= MPI_ERR_DUP_DATAREP;
        -:  189:const int ERR_UNSUPPORTED_DATAREP= MPI_ERR_UNSUPPORTED_DATAREP;
        -:  190:const int ERR_INFO= MPI_ERR_INFO;
        -:  191:const int ERR_INFO_KEY= MPI_ERR_INFO_KEY;
        -:  192:const int ERR_INFO_VALUE= MPI_ERR_INFO_VALUE;
        -:  193:const int ERR_INFO_NOKEY= MPI_ERR_INFO_NOKEY;
        -:  194:const int ERR_NAME= MPI_ERR_NAME;
        -:  195:const int ERR_NO_MEM= MPI_ERR_NO_MEM;
        -:  196:const int ERR_NOT_SAME= MPI_ERR_NOT_SAME;
        -:  197:const int ERR_PORT= MPI_ERR_PORT;
        -:  198:const int ERR_QUOTA= MPI_ERR_QUOTA;
        -:  199:const int ERR_SERVICE= MPI_ERR_SERVICE;
        -:  200:const int ERR_SPAWN= MPI_ERR_SPAWN;
        -:  201:const int ERR_UNSUPPORTED_OPERATION= MPI_ERR_UNSUPPORTED_OPERATION;
        -:  202:const int ERR_WIN= MPI_ERR_WIN;
        -:  203:const int ERR_BASE= MPI_ERR_BASE;
        -:  204:const int ERR_LOCKTYPE= MPI_ERR_LOCKTYPE;
        -:  205:const int ERR_KEYVAL= MPI_ERR_KEYVAL;
        -:  206:const int ERR_RMA_CONFLICT= MPI_ERR_RMA_CONFLICT;
        -:  207:const int ERR_RMA_SYNC= MPI_ERR_RMA_SYNC;
        -:  208:const int ERR_SIZE= MPI_ERR_SIZE;
        -:  209:const int ERR_DISP= MPI_ERR_DISP;
        -:  210:const int ERR_ASSERT= MPI_ERR_ASSERT;
        -:  211:const int TYPECLASS_REAL= MPI_TYPECLASS_REAL;
        -:  212:const int TYPECLASS_INTEGER= MPI_TYPECLASS_INTEGER;
        -:  213:const int TYPECLASS_COMPLEX= MPI_TYPECLASS_COMPLEX;
        -:  214:#if defined(MPI_SEEK_SET) && !defined(MPICH_IGNORE_CXX_SEEK) && !defined(SEEK_SET)
        -:  215:const int SEEK_SET = MPI_SEEK_SET;
        -:  216:const int SEEK_END = MPI_SEEK_END;
        -:  217:const int SEEK_CUR = MPI_SEEK_CUR;
        -:  218:#endif
        -:  219:const int DISTRIBUTE_BLOCK = MPI_DISTRIBUTE_BLOCK;
        -:  220:const int DISTRIBUTE_CYCLIC = MPI_DISTRIBUTE_CYCLIC;
        -:  221:const int DISTRIBUTE_DFLT_DARG = MPI_DISTRIBUTE_DFLT_DARG;
        -:  222:const int DISTRIBUTE_NONE = MPI_DISTRIBUTE_NONE;
        -:  223:const int ORDER_C = MPI_ORDER_C;
        -:  224:const int ORDER_FORTRAN = MPI_ORDER_FORTRAN;
        -:  225:// Include these only if MPI-IO is available
        -:  226:#ifdef MPI_MODE_RDONLY
        -:  227:const int MAX_DATAREP_STRING = MPI_MAX_DATAREP_STRING;
        -:  228:const MPI_Offset DISPLACEMENT_CURRENT = MPI_DISPLACEMENT_CURRENT;
        -:  229:const int MODE_APPEND = MPI_MODE_APPEND;
        -:  230:const int MODE_CREATE = MPI_MODE_CREATE;
        -:  231:const int MODE_DELETE_ON_CLOSE = MPI_MODE_DELETE_ON_CLOSE;
        -:  232:const int MODE_EXCL = MPI_MODE_EXCL;
        -:  233:const int MODE_RDONLY = MPI_MODE_RDONLY;
        -:  234:const int MODE_RDWR = MPI_MODE_RDWR;
        -:  235:const int MODE_SEQUENTIAL = MPI_MODE_SEQUENTIAL;
        -:  236:const int MODE_UNIQUE_OPEN = MPI_MODE_UNIQUE_OPEN;
        -:  237:const int MODE_WRONLY = MPI_MODE_WRONLY;
        -:  238:#endif // IO
        -:  239:const int MODE_NOCHECK = MPI_MODE_NOCHECK;
        -:  240:const int MODE_NOPRECEDE = MPI_MODE_NOPRECEDE;
        -:  241:const int MODE_NOPUT = MPI_MODE_NOPUT;
        -:  242:const int MODE_NOSTORE = MPI_MODE_NOSTORE;
        -:  243:const int MODE_NOSUCCEED = MPI_MODE_NOSUCCEED;
        -:  244:const int COMBINER_CONTIGUOUS = MPI_COMBINER_CONTIGUOUS;
        -:  245:const int COMBINER_DARRAY = MPI_COMBINER_DARRAY;
        -:  246:const int COMBINER_DUP = MPI_COMBINER_DUP;
        -:  247:const int COMBINER_F90_COMPLEX = MPI_COMBINER_F90_COMPLEX;
        -:  248:const int COMBINER_F90_INTEGER = MPI_COMBINER_F90_INTEGER;
        -:  249:const int COMBINER_F90_REAL = MPI_COMBINER_F90_REAL;
        -:  250:const int COMBINER_HINDEXED_INTEGER = MPI_COMBINER_HINDEXED_INTEGER;
        -:  251:const int COMBINER_HINDEXED = MPI_COMBINER_HINDEXED;
        -:  252:const int COMBINER_HVECTOR_INTEGER = MPI_COMBINER_HVECTOR_INTEGER;
        -:  253:const int COMBINER_HVECTOR = MPI_COMBINER_HVECTOR;
        -:  254:const int COMBINER_INDEXED_BLOCK = MPI_COMBINER_INDEXED_BLOCK;
        -:  255:const int COMBINER_INDEXED = MPI_COMBINER_INDEXED;
        -:  256:const int COMBINER_NAMED = MPI_COMBINER_NAMED;
        -:  257:const int COMBINER_RESIZED = MPI_COMBINER_RESIZED;
        -:  258:const int COMBINER_STRUCT_INTEGER = MPI_COMBINER_STRUCT_INTEGER;
        -:  259:const int COMBINER_STRUCT = MPI_COMBINER_STRUCT;
        -:  260:const int COMBINER_SUBARRAY = MPI_COMBINER_SUBARRAY;
        -:  261:const int COMBINER_VECTOR = MPI_COMBINER_VECTOR;
        -:  262:const int THREAD_FUNNELED = MPI_THREAD_FUNNELED;
        -:  263:const int THREAD_MULTIPLE = MPI_THREAD_MULTIPLE;
        -:  264:const int THREAD_SERIALIZED = MPI_THREAD_SERIALIZED;
        -:  265:const int THREAD_SINGLE = MPI_THREAD_SINGLE;
        -:  266:const char ** const ARGV_NULL = 0;
        -:  267:const char *** const ARGVS_NULL = 0;
        -:  268:void * const BOTTOM = MPI_BOTTOM;
        -:  269:void * const IN_PLACE = MPI_IN_PLACE;
      506:  270:void Init( void ){
      506:  271:    MPI_Init( 0, 0 );
      506:  272:}
        2:  273:void Init( int &argc, char **&argv )
        -:  274:{
        2:  275:    MPI_Init( &argc, &argv );
        2:  276:}
        1:  277:int Init_thread( int v1 ){
        -:  278:    int provided;
        1:  279:    MPI_Init_thread( 0, 0, v1, &provided );
        -:  280:
        1:  281:    return provided;
        -:  282:}
    #####:  283:int Init_thread( int &argc, char **&argv, int req )
        -:  284:{
        -:  285:    int provided;
    #####:  286:    MPI_Init_thread( &argc, &argv, req, &provided );
    #####:  287:    return provided;
        -:  288:}
      509:  289:void Finalize( void ){
        -:  290:    MPIX_TRSummary();
      509:  291:    MPI_Finalize( );
      509:  292:}
      504:  293:bool Is_initialized(void)
        -:  294:    { 
        -:  295:	int flag;
        -:  296:
      504:  297:	MPI_Initialized( &flag );
        -:  298:
      504:  299:	return (flag != 0);
        -:  300:    }
       12:  301:void Compute_dims( int nnodes, int ndims, int dims[] )
        -:  302:    {
        -:  303:
       12:  304:	MPIX_CALL( MPI_Dims_create( nnodes, ndims, dims ) );
        -:  305:
       12:  306:    }
       17:  307:void Attach_buffer( void *buffer, int size )
        -:  308:    {
        -:  309:
       17:  310:	MPIX_CALL( MPI_Buffer_attach( buffer, size ) );
        -:  311:
       17:  312:    }
       17:  313:int Detach_buffer( void *&buffer )
        -:  314:    {
        -:  315:	int size;
        -:  316:
       17:  317:	MPIX_CALL( MPI_Buffer_detach( &buffer, &size ) );
        -:  318:
       17:  319:	return size;
        -:  320:    }
        4:  321:void Get_processor_name( char *name, int &resultlen ) 
        -:  322:    {
        -:  323:
        4:  324:    MPIX_CALL( MPI_Get_processor_name( name, &resultlen ) );
        -:  325:
        4:  326:    }
       20:  327:void Pcontrol( const int v, ... )
        -:  328:    {
        -:  329:	va_list ap;
       20:  330:        va_start(ap,v);
        -:  331:
       20:  332:	MPIX_CALL( MPI_Pcontrol( (int)v, ap ) );
        -:  333:
       20:  334:    }
        9:  335:int Get_error_class( int errcode ) 
        -:  336:    {
        -:  337:    int errclass;
        -:  338:
        9:  339:    MPIX_CALL( MPI_Error_class( errcode, &errclass ) );
        -:  340:
        9:  341:    return errclass;
        -:  342:    }
        6:  343:void Get_error_string( int errcode, char *name, int &resultlen ) 
        -:  344:    {
        -:  345:
        6:  346:    MPIX_CALL( MPI_Error_string( errcode, name, &resultlen ) );
        -:  347:
        6:  348:    }
        4:  349:Aint Get_address( void *ptr )
        -:  350:    {
        -:  351:    MPI_Aint a;
        -:  352:
        4:  353:    MPI_Get_address( ptr, &a );
        -:  354:
        4:  355:    return (Aint)a;
        -:  356:    }
        2:  357:void *Alloc_mem( Aint size, const Info &info )
        -:  358:    {
        -:  359:        void *result;
        -:  360:
        2:  361:        MPIX_CALL( MPI_Alloc_mem( size, (MPI_Info)info, &result ) );
        -:  362:
        2:  363:        return result;
        -:  364:    }
        2:  365:void Free_mem( void * base )
        -:  366:    {
        -:  367:
        2:  368:     MPIX_CALL( MPI_Free_mem( base ) );
        -:  369:
        2:  370:    }
        -:  371:
        -:  372:    extern "C" {
        -:  373:typedef void (*mpircallback)(void);
        -:  374:}
        -:  375:extern "C" void MPIR_Op_set_cxx( MPI_Op, void (*)(void) );
        -:  376:extern "C" 
        -:  377:void MPIR_Call_op_fn( void *invec, void *outvec, int len, MPI_Datatype dtype,
      943:  378:		     User_function *uop )
        -:  379:{
      943:  380:    MPI::Datatype cxxdtype = dtype;
      943:  381:    (*uop)( invec, outvec, len, cxxdtype );
      943:  382:}
       29:  383:void Op::Init( User_function *f, bool commute )
        -:  384:    {
        -:  385:
       29:  386:	MPIX_CALL( MPI_Op_create( (MPI_User_function *)f, 
        -:  387:				 (int) commute, &the_real_op ) ); 
       29:  388:	MPIR_Op_set_cxx( the_real_op, (mpircallback) MPIR_Call_op_fn );
        -:  389:
       29:  390:    }
        -:  391:#include "mpihandlemem.h"
        -:  392:#include "mpi_attr.h"
        -:  393:#include "mpi_lang.h"
        -:  394:static
        -:  395:int
        -:  396:MPIR_Comm_delete_attr_cxx_proxy(
        -:  397:    MPI_Comm_delete_attr_function* user_function,
        -:  398:    MPI_Comm comm,
        -:  399:    int keyval,
        -:  400:    MPIR_AttrType attrib_type,
        -:  401:    void* attrib,
        -:  402:    void* extra_state
       12:  403:    )
        -:  404:{
       12:  405:    void *value = NULL;
        -:  406:    /* Make sure that the attribute value is delivered as a pointer */
       12:  407:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  408:        value = &attrib;
        -:  409:    }
        -:  410:    else{
       12:  411:        value = attrib;
        -:  412:    }
       12:  413:    MPI::Comm::Delete_attr_function* f = (MPI::Comm::Delete_attr_function*)user_function;
        -:  414:    
        -:  415:    int ttype;
       12:  416:    MPI_Topo_test( comm, &ttype );
       12:  417:    if (ttype == MPI_UNDEFINED)
        -:  418:    {
       12:  419:        MPI_Comm_test_inter( comm, &ttype );
       12:  420:        if (ttype)
        -:  421:        {
    #####:  422:            MPI::Intercomm c = comm;
    #####:  423:            return f( c, keyval, value, extra_state );
        -:  424:        }
        -:  425:        else
        -:  426:        {
       12:  427:            MPI::Intracomm c = comm;
       12:  428:            return f( c, keyval, value, extra_state );
        -:  429:        }
        -:  430:    }
    #####:  431:    else if (ttype == MPI_CART)
        -:  432:    {
    #####:  433:        MPI::Cartcomm c = comm;
    #####:  434:        return f( c, keyval, value, extra_state );
        -:  435:    }
        -:  436:    else
        -:  437:    {
    #####:  438:        MPI::Graphcomm c = comm;
    #####:  439:        return f( c, keyval, value, extra_state );
        -:  440:    }
        -:  441:}
        -:  442:
        -:  443:static
        -:  444:int
        -:  445:MPIR_Comm_copy_attr_cxx_proxy(
        -:  446:    MPI_Comm_copy_attr_function* user_function,
        -:  447:    MPI_Comm comm,
        -:  448:    int keyval,
        -:  449:    void* extra_state,
        -:  450:    MPIR_AttrType attrib_type,
        -:  451:    void* attrib,
        -:  452:    void** new_value,
        -:  453:    int* flag
        6:  454:    )
        -:  455:{
        6:  456:    void *value = NULL;
        -:  457:    /* Make sure that the attribute value is delivered as a pointer */
        6:  458:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  459:        value = &attrib;
        -:  460:    }
        -:  461:    else{
        6:  462:        value = attrib;
        -:  463:    }
        -:  464:
        6:  465:    *flag = 0;
        6:  466:    MPI::Comm::Copy_attr_function* f = (MPI::Comm::Copy_attr_function*)user_function;
        -:  467:    
        -:  468:    int ttype;
        6:  469:    MPI_Topo_test( comm, &ttype );
        6:  470:    if (ttype == MPI_UNDEFINED)
        -:  471:    {
        6:  472:        MPI_Comm_test_inter( comm, &ttype );
        6:  473:        if (ttype)
        -:  474:        {
    #####:  475:            MPI::Intercomm c = comm;
    #####:  476:            return f( c, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  477:        }
        -:  478:        else
        -:  479:        {
        6:  480:            MPI::Intracomm c = comm;
        6:  481:            return f( c, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  482:        }
        -:  483:    }
    #####:  484:    else if (ttype == MPI_CART)
        -:  485:    {
    #####:  486:        MPI::Cartcomm c = comm;
    #####:  487:        return f( c, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  488:    }
        -:  489:    else
        -:  490:    {
    #####:  491:        MPI::Graphcomm c = comm;
    #####:  492:        return f( c, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  493:    }
        -:  494:}
        -:  495:
        -:  496:
      171:  497:int Comm::Create_keyval( Copy_attr_function *cf, Delete_attr_function *df, void *extra_state )
        -:  498:{
        -:  499:    int keyval;
        -:  500:
      171:  501:    if (cf == MPI::Comm::NULL_COPY_FN) cf = 0;
      171:  502:    if (df == MPI::Comm::NULL_DELETE_FN) df = 0;
      171:  503:    MPIX_CALL( MPI_Comm_create_keyval( (MPI_Comm_copy_attr_function *)cf, 
        -:  504:				       (MPI_Comm_delete_attr_function *)df,
        -:  505:				      &keyval, extra_state ) );
      171:  506:    MPIR_Keyval_set_proxy( keyval, MPIR_Comm_copy_attr_cxx_proxy, MPIR_Comm_delete_attr_cxx_proxy );
      171:  507:    return keyval;
        -:  508:}
        -:  509:
        -:  510:static
        -:  511:int
        -:  512:MPIR_Type_delete_attr_cxx_proxy(
        -:  513:    MPI_Type_delete_attr_function* user_function,
        -:  514:    MPI_Datatype datatype,
        -:  515:    int keyval,
        -:  516:    MPIR_AttrType attrib_type,
        -:  517:    void* attrib,
        -:  518:    void* extra_state
       12:  519:    )
        -:  520:{
       12:  521:    MPI::Datatype d = datatype;
       12:  522:    MPI::Datatype::Delete_attr_function* f = (MPI::Datatype::Delete_attr_function*)user_function;
       12:  523:    void *value = NULL;
        -:  524:    /* Make sure that the attribute value is delivered as a pointer */
       12:  525:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  526:        value = &attrib;
        -:  527:    }
        -:  528:    else{
       12:  529:        value = attrib;
        -:  530:    }
       12:  531:    return f( d, keyval, value, extra_state );
        -:  532:}
        -:  533:
        -:  534:static
        -:  535:int
        -:  536:MPIR_Type_copy_attr_cxx_proxy(
        -:  537:    MPI_Type_copy_attr_function* user_function,
        -:  538:    MPI_Datatype datatype,
        -:  539:    int keyval,
        -:  540:    void* extra_state,
        -:  541:    MPIR_AttrType attrib_type,
        -:  542:    void* attrib,
        -:  543:    void** new_value,
        -:  544:    int* flag
        6:  545:    )
        -:  546:{
        6:  547:    *flag = 0;
        6:  548:    MPI::Datatype d = datatype;
        6:  549:    MPI::Datatype::Copy_attr_function* f = (MPI::Datatype::Copy_attr_function*)user_function;
        6:  550:    void *value = NULL;
        -:  551:    /* Make sure that the attribute value is delivered as a pointer */
        6:  552:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  553:        value = &attrib;
        -:  554:    }
        -:  555:    else{
        6:  556:        value = attrib;
        -:  557:    }
        6:  558:    return f( d, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  559:}
        -:  560:
      198:  561:int Datatype::Create_keyval( Copy_attr_function *cf, Delete_attr_function *df, void *extra_state )
        -:  562:{
        -:  563:    int keyval;
        -:  564:
      198:  565:    if (cf == MPI::Datatype::NULL_COPY_FN) cf = 0;
      198:  566:    if (df == MPI::Datatype::NULL_DELETE_FN) df = 0;
      198:  567:    MPIX_CALL( MPI_Type_create_keyval( (MPI_Type_copy_attr_function *)cf, 
        -:  568:				       (MPI_Type_delete_attr_function *)df,
        -:  569:				      &keyval, extra_state ) );
      198:  570:    MPIR_Keyval_set_proxy( keyval, MPIR_Type_copy_attr_cxx_proxy, MPIR_Type_delete_attr_cxx_proxy );
      198:  571:    return keyval;
        -:  572:}
        -:  573:
        -:  574:static
        -:  575:int
        -:  576:MPIR_Win_delete_attr_cxx_proxy(
        -:  577:    MPI_Win_delete_attr_function* user_function,
        -:  578:    MPI_Win win,
        -:  579:    int keyval,
        -:  580:    MPIR_AttrType attrib_type,
        -:  581:    void* attrib,
        -:  582:    void* extra_state
        4:  583:    )
        -:  584:{
        4:  585:    MPI::Win w = win;
        4:  586:    MPI::Win::Delete_attr_function* f = (MPI::Win::Delete_attr_function*)user_function;
        4:  587:    void *value = NULL;
        -:  588:    /* Make sure that the attribute value is delivered as a pointer */
        4:  589:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  590:        value = &attrib;
        -:  591:    }
        -:  592:    else{
        4:  593:        value = attrib;
        -:  594:    }
        4:  595:    return f( w, keyval, value, extra_state );
        -:  596:}
        -:  597:
        -:  598:static
        -:  599:int
        -:  600:MPIR_Win_copy_attr_cxx_proxy(
        -:  601:    MPI_Win_copy_attr_function* user_function,
        -:  602:    MPI_Win win,
        -:  603:    int keyval,
        -:  604:    void* extra_state,
        -:  605:    MPIR_AttrType attrib_type,
        -:  606:    void* attrib,
        -:  607:    void** new_value,
        -:  608:    int* flag
    #####:  609:    )
        -:  610:{
    #####:  611:    *flag = 0;
    #####:  612:    MPI::Win w = win;
    #####:  613:    MPI::Win::Copy_attr_function* f = (MPI::Win::Copy_attr_function*)user_function;
    #####:  614:    void *value = NULL;
        -:  615:    /* Make sure that the attribute value is delivered as a pointer */
    #####:  616:    if(MPIR_ATTR_KIND(attrib_type) == MPIR_ATTR_KIND(MPIR_ATTR_INT)){
    #####:  617:        value = &attrib;
        -:  618:    }
        -:  619:    else{
    #####:  620:        value = attrib;
        -:  621:    }
    #####:  622:    return f( w, keyval, extra_state, value, new_value, *(bool*)flag );
        -:  623:}
        -:  624:
      134:  625:int Win::Create_keyval( Copy_attr_function *cf, Delete_attr_function *df, void *extra_state )
        -:  626:{
        -:  627:    int keyval;
        -:  628:
      134:  629:    if (cf == MPI::Win::NULL_COPY_FN) cf = 0;
      134:  630:    if (df == MPI::Win::NULL_DELETE_FN) df = 0;
      134:  631:    MPIX_CALL( MPI_Win_create_keyval( (MPI_Win_copy_attr_function *)cf, 
        -:  632:				       (MPI_Win_delete_attr_function *)df,
        -:  633:				      &keyval, extra_state ) );
      134:  634:    MPIR_Keyval_set_proxy( keyval, MPIR_Win_copy_attr_cxx_proxy, MPIR_Win_delete_attr_cxx_proxy );
      134:  635:    return keyval;
        -:  636:}
        -:  637:
        -:  638:// Provide a C routine that can call the C++ error handler, handling
        -:  639:// any calling-sequence change.  
        -:  640:extern "C" void MPIR_Errhandler_set_cxx( MPI_Errhandler, void (*)(void) );
        -:  641:extern "C" 
        -:  642:void MPIR_Call_errhandler_function( int kind, int *handle, int *errcode, 
        5:  643:			      void (*cxxfn)(void) )
        -:  644:{
        -:  645:    // Use horrible casts to get the correct routine signature
        5:  646:    switch (kind) {
        -:  647:    case 0: // comm
        -:  648:	    {
        1:  649:		MPI_Comm *ch = (MPI_Comm *)handle;
        -:  650:		int flag;
        1:  651:		MPI::Comm::Errhandler_function *f = (MPI::Comm::Errhandler_function *)cxxfn;
        -:  652:		// Make an actual Comm (inter or intra-comm)
        1:  653:		MPI_Comm_test_inter( *ch, &flag );
        1:  654:		if (flag) {
    #####:  655:		    MPI::Intercomm ic(*ch);
    #####:  656:		    (*f)( ic, errcode );
        -:  657:		}
        -:  658:		else {
        1:  659:		    MPI::Intracomm ic(*ch);
        1:  660:		    (*f)( ic, errcode );
        -:  661:		}
        -:  662:	    }
        -:  663:	    break;
        -:  664:#ifdef MPI_MODE_RDONLY
        -:  665:    case 1: // file
        -:  666:	    {
        4:  667:		MPI::File fh = (MPI_File)*(MPI_File*)handle;
        4:  668:		MPI::File::Errhandler_function *f = (MPI::File::Errhandler_function *)cxxfn;
        4:  669:		(*f)( fh, errcode );
        -:  670:	    }
        4:  671:	    break;
        -:  672:#endif // IO
        -:  673:    case 2: // win
        -:  674:	    {
    #####:  675:		MPI::Win fh = (MPI_Win)*(MPI_Win*)handle;
    #####:  676:		MPI::Win::Errhandler_function *f = (MPI::Win::Errhandler_function *)cxxfn;
    #####:  677:		(*f)( fh, errcode );
        -:  678:	    }
        -:  679:	    break;
        -:  680:    }
        5:  681:}
        -:  682:#ifdef MPI_MODE_RDONLY
        3:  683:Errhandler File::Create_errhandler( Errhandler_function *f )
        -:  684:{
        -:  685:    MPI_Errhandler eh;
        3:  686:    MPI::Errhandler e1;
        3:  687:    MPI_File_create_errhandler( (MPI_File_errhandler_function *)f, &eh );
        -:  688:    MPIR_Errhandler_set_cxx( eh, 
        3:  689:			     (mpircallback)MPIR_Call_errhandler_function );
        3:  690:    e1.the_real_errhandler = eh;
    #####:  691:    return e1;
        -:  692:}
        -:  693:#endif // IO
        2:  694:Errhandler Comm::Create_errhandler( Errhandler_function *f )
        -:  695:{
        -:  696:    MPI_Errhandler eh;
        2:  697:    MPI::Errhandler e1;
        2:  698:    MPI_Comm_create_errhandler( (MPI_Comm_errhandler_function *)f, &eh );
        -:  699:    MPIR_Errhandler_set_cxx( eh, 
        2:  700:			     (mpircallback)MPIR_Call_errhandler_function );
        2:  701:    e1.the_real_errhandler = eh;
    #####:  702:    return e1;
        -:  703:}
        1:  704:Errhandler Win::Create_errhandler( Errhandler_function *f )
        -:  705:{
        -:  706:    MPI_Errhandler eh;
        1:  707:    MPI::Errhandler e1;
        1:  708:    MPI_Win_create_errhandler( (MPI_Win_errhandler_function *)f, &eh );
        -:  709:    MPIR_Errhandler_set_cxx( eh, 
        1:  710:			     (mpircallback)MPIR_Call_errhandler_function );
        1:  711:    e1.the_real_errhandler = eh;
    #####:  712:    return e1;
        -:  713:}
        -:  714:
        -:  715:
        -:  716:// Call_errhandler implementations.  These sadly must contain a bit of logic to
        -:  717:// cover the ERRORS_THROW_EXCEPTIONS case.
    #####:  718:void Comm::Call_errhandler( int errorcode ) const
        -:  719:{
        -:  720:    // we must free the Errhandler object returned from Get_errhandler because
        -:  721:    // Get_errhandler adds a reference (the MPI Standard says as though a new
        -:  722:    // object were created)
    #####:  723:    Errhandler current = Get_errhandler();
    #####:  724:    if (current == ERRORS_THROW_EXCEPTIONS) {
    #####:  725:        current.Free();
    #####:  726:        throw Exception(errorcode); // throw by value, catch by reference
        -:  727:    }
        -:  728:    else {
    #####:  729:        current.Free();
        -:  730:    }
    #####:  731:    MPIX_CALL( MPI_Comm_call_errhandler( (MPI_Comm) the_real_comm, errorcode ));
    #####:  732:}
        -:  733:
    #####:  734:void Win::Call_errhandler( int errorcode ) const
        -:  735:{
        -:  736:    // we must free the Errhandler object returned from Get_errhandler because
        -:  737:    // Get_errhandler adds a reference (the MPI Standard says as though a new
        -:  738:    // object were created)
    #####:  739:    Errhandler current = Get_errhandler();
    #####:  740:    if (current == ERRORS_THROW_EXCEPTIONS) {
    #####:  741:        current.Free();
    #####:  742:        throw Exception(errorcode); // throw by value, catch by reference
        -:  743:    }
        -:  744:    else {
    #####:  745:        current.Free();
        -:  746:    }
    #####:  747:    MPIX_CALL( MPI_Win_call_errhandler( (MPI_Win) the_real_win, errorcode ));
    #####:  748:}
        -:  749:
        -:  750:#ifdef MPI_MODE_RDONLY
        3:  751:void File::Call_errhandler( int errorcode ) const
        -:  752:{
        -:  753:    // we must free the Errhandler object returned from Get_errhandler because
        -:  754:    // Get_errhandler adds a reference (the MPI Standard says as though a new
        -:  755:    // object were created)
        3:  756:    Errhandler current = Get_errhandler();
        3:  757:    if (current == ERRORS_THROW_EXCEPTIONS) {
    #####:  758:        current.Free();
    #####:  759:        throw Exception(errorcode); // throw by value, catch by reference
        -:  760:    }
        -:  761:    else {
        3:  762:        current.Free();
        -:  763:    }
        3:  764:    MPIX_CALL( MPI_File_call_errhandler( (MPI_File) the_real_file, errorcode ));
        3:  765:}
        -:  766:#endif // IO
        -:  767:
        -:  768:
        -:  769:#ifdef MPI_MODE_RDONLY
        -:  770:
        -:  771:extern "C" {
        -:  772://
        -:  773:// Rather than use a registered interposer, instead we interpose, taking 
        -:  774:// advantage of the extra_data field, similar to the handling of Grequest.
        -:  775:typedef struct { 
        -:  776:    Datarep_conversion_function *read_fn;
        -:  777:    Datarep_conversion_function *write_fn;
        -:  778:    Datarep_extent_function *extent_fn;
        -:  779:    void *orig_extra_state;
        -:  780:    } MPIR_Datarep_data;
        -:  781:int MPIR_Call_datarep_read_fn( void *userbuf, MPI_Datatype datatype, 
        -:  782:			       int count, 
        -:  783:			       void *filebuf, MPI_Offset position, 
    #####:  784:			       void *extra_state )
        -:  785:{
    #####:  786:    MPIR_Datarep_data *ldata = (MPIR_Datarep_data *)extra_state;
    #####:  787:    Datatype dtype = (Datatype)datatype;
        -:  788:    return (ldata->read_fn)( userbuf, dtype, count, filebuf,
    #####:  789:			    position, ldata->orig_extra_state);
        -:  790:}
        -:  791:int MPIR_Call_datarep_write_fn( void *userbuf, MPI_Datatype datatype, 
        -:  792:			       int count, 
        -:  793:			       void *filebuf, MPI_Offset position, 
    #####:  794:			       void *extra_state )
        -:  795:{
    #####:  796:    MPIR_Datarep_data *ldata = (MPIR_Datarep_data *)extra_state;
    #####:  797:    Datatype dtype = (Datatype)datatype;
        -:  798:    return (ldata->write_fn)( userbuf, dtype, count, filebuf,
    #####:  799:			     position, ldata->orig_extra_state);
        -:  800:}
        -:  801:int MPIR_Call_datarep_extent_fn( MPI_Datatype datatype, MPI_Aint *extent,
    #####:  802:				 void *extra_state ) {
    #####:  803:    MPIR_Datarep_data *ldata = (MPIR_Datarep_data *)extra_state;
        -:  804:    Aint myextent;
        -:  805:    int err;
        -:  806:    err =  (ldata->extent_fn)( (Datatype)datatype, myextent, 
    #####:  807:			       ldata->orig_extra_state);
    #####:  808:    *extent = myextent;
    #####:  809:    return err;
        -:  810:}
        -:  811:} /* extern C */
        -:  812:void Register_datarep( const char *datarep, 
        -:  813:		       Datarep_conversion_function *read_fn,
        -:  814:		       Datarep_conversion_function *write_fn,
        -:  815:		       Datarep_extent_function *extent_fn,
    #####:  816:		       void *orig_extra_state )
        -:  817:{
    #####:  818:    MPIR_Datarep_data *ldata = new(MPIR_Datarep_data);
    #####:  819:    ldata->read_fn          = read_fn;
    #####:  820:    ldata->write_fn         = write_fn;
    #####:  821:    ldata->extent_fn        = extent_fn;
    #####:  822:    ldata->orig_extra_state = orig_extra_state;
    #####:  823:    MPIX_CALL(MPI_Register_datarep( (char *)datarep, 
        -:  824:				MPIR_Call_datarep_read_fn,
        -:  825:				MPIR_Call_datarep_write_fn, 
        -:  826:				MPIR_Call_datarep_extent_fn, (void *)ldata ));
        -:  827:    /* Because datareps are never freed, the space allocated in this
        -:  828:       routine for ldata will never be freed */
    #####:  829:}
        -:  830:#endif
        -:  831:
        -:  832:void Datatype::Pack( const void *inbuf, int incount, void *outbuf, 
        8:  833:		     int outsize, int &position, const Comm &comm ) const {
        -:  834:
        8:  835:	MPIX_CALL( MPI_Pack( (void *)inbuf, incount, the_real_datatype, outbuf, 
        -:  836:			    outsize, &position, comm.the_real_comm ) );
        -:  837:
        8:  838:    }
        -:  839:
    #####:  840:int Datatype::Pack_size( int count, const Comm &comm ) const {
        -:  841:
        -:  842:        int size;
    #####:  843:	MPIX_CALL( MPI_Pack_size( count, the_real_datatype, comm.the_real_comm, &size ) );
        -:  844:
    #####:  845:	return size;
        -:  846:    }
        -:  847:
        -:  848:void Datatype::Unpack( const void *inbuf, int insize, void *outbuf,
        8:  849:                       int outcount, int &position, const Comm &comm ) const {
        -:  850:
        8:  851:	MPIX_CALL( MPI_Unpack( (void *)inbuf, insize, &position, outbuf, outcount, 
        -:  852:			      the_real_datatype, comm.the_real_comm ) );
        -:  853:
        8:  854:    }
       40:  855:double Wtime(void) { return MPI_Wtime(); }
       80:  856:double Wtick(void) { return MPI_Wtick(); }
        -:  857:
       24:  858:    Cartcomm Intracomm::Create_cart( int v2, const int * v3, const bool v4[], bool v5 ) const
        -:  859:    {
       24:  860:        Cartcomm v6;
       24:  861:        int *l4 = new int[v2];
        -:  862:        int l5;
        -:  863:        { 
        -:  864:            int i4; 
       72:  865:            for (i4=0;i4<v2;i4++) {
       48:  866:                l4[i4] = v4[i4] == true ? 1 : 0;
        -:  867:            }
        -:  868:        }
       24:  869:         l5 = (v5 == true) ? 1 : 0;
        -:  870:
       24:  871:        MPIX_CALL( MPI_Cart_create( (MPI_Comm) the_real_comm, v2, (int *)v3, l4, l5, &(v6.the_real_comm) ));
        -:  872:
       24:  873:            delete[] l4;
    #####:  874:        return v6;
        -:  875:    }
        -:  876:
        4:  877:    Graphcomm Intracomm::Create_graph( int v2, const int * v3, const int * v4, bool v5 ) const
        -:  878:    {
        4:  879:        Graphcomm v6;
        -:  880:        int l5;
        4:  881:         l5 = (v5 == true) ? 1 : 0;
        -:  882:
        4:  883:        MPIX_CALL( MPI_Graph_create( (MPI_Comm) the_real_comm, v2, (int *)v3, (int *)v4, l5, &(v6.the_real_comm) ));
        -:  884:
    #####:  885:        return v6;
        -:  886:    }
        -:  887:
       29:  888:    Intracomm Intercomm::Merge( bool v2 ) const
        -:  889:    {
       29:  890:        Intracomm v3;
        -:  891:        int l2;
       29:  892:         l2 = (v2 == true) ? 1 : 0;
        -:  893:
       29:  894:        MPIX_CALL( MPI_Intercomm_merge( (MPI_Comm) the_real_comm, l2, &(v3.the_real_comm) ));
        -:  895:
    #####:  896:        return v3;
        -:  897:    }
        -:  898:
        2:  899:bool Is_finalized( void )
        -:  900:    {
        -:  901:    int flag;
        2:  902:    MPIX_CALL( MPI_Finalized( &flag ) );
        2:  903:    return (flag != 0);
        -:  904:}
        -:  905:
        1:  906:int Query_thread( void )
        -:  907:    {
        -:  908:    int provided;
        1:  909:    MPIX_CALL( MPI_Query_thread( &provided ) );
        1:  910:    return provided;
        -:  911:}
        -:  912:
        1:  913:bool Is_thread_main( void )
        -:  914:    {
        -:  915:    int flag;
        1:  916:    MPIX_CALL( MPI_Is_thread_main( &flag ) );
        1:  917:    return (flag != 0);
        -:  918:}
        -:  919:
        1:  920:void Get_version( int &v, int&sv )
        -:  921:    {
        -:  922:    
        1:  923:    MPIX_CALL( MPI_Get_version( &v,&sv ) );
        1:  924:}
        -:  925:
        4:  926:int Add_error_class( void )
        -:  927:    {
        -:  928:    int eclass;
        4:  929:    MPIX_CALL( MPI_Add_error_class( &eclass ) );
        4:  930:    return eclass;
        -:  931:}
        -:  932:
        5:  933:int Add_error_code( int eclass )
        -:  934:    {
        -:  935:    int ecode;
        5:  936:    MPIX_CALL( MPI_Add_error_code( eclass, &ecode ) );
        5:  937:    return ecode;
        -:  938:}
        -:  939:
        6:  940:void Add_error_string( int ecode, const char *estring )
        -:  941:    {
        -:  942:    
        6:  943:    MPIX_CALL( MPI_Add_error_string( ecode, (char *)estring ) );
        6:  944:}
        -:  945:
        3:  946:void Lookup_name( const char *sn, const Info &info, char *pn )
        -:  947:    {
        -:  948:    
        3:  949:    MPIX_CALL( MPI_Lookup_name( (char *)sn, (MPI_Info)info, pn ) );
        1:  950:}
        -:  951:
        1:  952:void Publish_name( const char *sn, const Info &info, const char *pn )
        -:  953:    {
        -:  954:    
        1:  955:    MPIX_CALL( MPI_Publish_name( (char *)sn, (MPI_Info)info, (char *)pn ) );
        1:  956:}
        -:  957:
        1:  958:void Unpublish_name( const char *sn, const Info &info, const char *pn )
        -:  959:    {
        -:  960:    
        1:  961:    MPIX_CALL( MPI_Unpublish_name( (char *)sn, (MPI_Info)info, (char *)pn ) );
        1:  962:}
        -:  963:
       10:  964:Intercomm Comm::Get_parent( void )
        -:  965:    {
       10:  966:    MPI::Intercomm v;MPI_Comm vv;
       10:  967:    MPIX_CALL( MPI_Comm_get_parent( &vv ) );
       10:  968:    return (v = (Intercomm)vv, v);
        -:  969:}
        -:  970:
    #####:  971:Intercomm Comm::Join( const int fd )
        -:  972:    {
    #####:  973:    MPI::Intercomm v;MPI_Comm vv;
    #####:  974:    MPIX_CALL( MPI_Comm_join( fd,&vv ) );
    #####:  975:    return (v = (Intercomm)vv,v);
        -:  976:}
        -:  977:
        1:  978:void Close_port( const char *pn )
        -:  979:    {
        -:  980:    
        1:  981:    MPIX_CALL( MPI_Close_port( (char *)pn ) );
        1:  982:}
        -:  983:
        1:  984:void Open_port( const Info &info, char *portname )
        -:  985:    {
        -:  986:    
        1:  987:    MPIX_CALL( MPI_Open_port( (MPI_Info)info, portname ) );
        1:  988:}
        -:  989:
        -:  990://
        -:  991:// Rather than use a registered interposer, instead we interpose taking 
        -:  992:// advantage of the extra_data field
        -:  993:typedef struct { 
        -:  994:    MPI::Grequest::Query_function  *query_fn;
        -:  995:    MPI::Grequest::Free_function   *free_fn;
        -:  996:    MPI::Grequest::Cancel_function *cancel_fn;
        -:  997:    void *orig_extra_data; } MPIR_Grequest_data;
        -:  998:extern "C" int MPIR_Grequest_call_query_fn( void *extra_data, 
    #####:  999:					    MPI_Status *status )
        -: 1000:{
        -: 1001:    int err;
    #####: 1002:    MPI::Status s;
    #####: 1003:    MPIR_Grequest_data *d = (MPIR_Grequest_data *)extra_data;
        -: 1004:    
    #####: 1005:    err = (d->query_fn)( d->orig_extra_data, s );
    #####: 1006:    *status = s;
        -: 1007:
    #####: 1008:    return err;
        -: 1009:}
    #####: 1010:extern "C" int MPIR_Grequest_call_free_fn( void *extra_data )
        -: 1011:{
        -: 1012:    int err;
    #####: 1013:    MPIR_Grequest_data *d = (MPIR_Grequest_data *)extra_data;
        -: 1014:    
    #####: 1015:    err = (d->free_fn)( d->orig_extra_data );
        -: 1016:
        -: 1017:    // Recover the storage that we used for the extra_data item.
    #####: 1018:    delete d;
    #####: 1019:    return err;
        -: 1020:}
    #####: 1021:extern "C" int MPIR_Grequest_call_cancel_fn( void *extra_data, int done )
        -: 1022:{
        -: 1023:    int err;
    #####: 1024:    MPI::Status s;
    #####: 1025:    MPIR_Grequest_data *d = (MPIR_Grequest_data *)extra_data;
        -: 1026:    
        -: 1027:    // Pass a C++ bool to the C++ version of the cancel function
    #####: 1028:    err = (d->cancel_fn)( d->orig_extra_data, done ? true : false );
    #####: 1029:    return err;
        -: 1030:}
        -: 1031:Grequest Grequest::Start( Grequest::Query_function  *query_fn,
        -: 1032:                          Grequest::Free_function   *free_fn,
        -: 1033:                          Grequest::Cancel_function *cancel_fn,
    #####: 1034:                          void *extra_state ) 
        -: 1035:{
    #####: 1036:    MPI::Grequest req;
    #####: 1037:    MPIR_Grequest_data *d = new MPIR_Grequest_data;
    #####: 1038:    d->query_fn        = query_fn;
    #####: 1039:    d->free_fn         = free_fn;
    #####: 1040:    d->cancel_fn       = cancel_fn;
    #####: 1041:    d->orig_extra_data = extra_state;
        -: 1042:    MPI_Grequest_start( MPIR_Grequest_call_query_fn,
        -: 1043:			MPIR_Grequest_call_free_fn,
        -: 1044:			MPIR_Grequest_call_cancel_fn,
    #####: 1045:			(void *)d, &req.the_real_request );
    #####: 1046:    return req;
        -: 1047:}
        -: 1048:
        -: 1049:/* MT FIXME: this is not thread-safe */
       52: 1050:void MPIR_CXX_InitDatatypeNames( void )
        -: 1051:{
        -: 1052:    static int _isInit = 1; 
       52: 1053:    if (_isInit) { 
        2: 1054:	_isInit=0; 
        2: 1055:	PMPI_Type_set_name( MPI::BOOL, (char *)"MPI::BOOL" );
        2: 1056:	PMPI_Type_set_name( MPI::COMPLEX, (char *)"MPI::COMPLEX" );
        2: 1057:	PMPI_Type_set_name( MPI::DOUBLE_COMPLEX, (char *)"MPI::DOUBLE_COMPLEX" );
        -: 1058:#if defined(HAVE_LONG_DOUBLE)
        2: 1059:	PMPI_Type_set_name( MPI::LONG_DOUBLE_COMPLEX, (char *)"MPI::LONG_DOUBLE_COMPLEX" );
        -: 1060:#endif
        -: 1061:    }
       52: 1062:}
     1018: 1063:} // namespace MPI
      509: 1064:/*EOF*/