-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpid/common/datatype/dataloop/dataloop_create_pairtype.c
        -:    0:Graph:dataloop_create_pairtype.gcno
        -:    0:Data:dataloop_create_pairtype.gcda
        -:    0:Runs:3459
        -:    0:Programs:899
        -:    1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
        -:    2:
        -:    3:/*
        -:    4: *  (C) 2001 by Argonne National Laboratory.
        -:    5: *      See COPYRIGHT in top-level directory.
        -:    6: */
        -:    7:
        -:    8:#include "dataloop.h"
        -:    9:
        -:   10:#define PAIRTYPE_CONTENTS(mt1_,ut1_,mt2_,ut2_)				\
        -:   11:    {									\
        -:   12:	struct { ut1_ a; ut2_ b; } foo;					\
        -:   13:	disps[0] = 0;							\
        -:   14:	disps[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) &foo.b - (char *) &foo.a);	\
        -:   15:	types[0] = mt1_;						\
        -:   16:	types[1] = mt2_;						\
        -:   17:    }
        -:   18:
        -:   19:/*@
        -:   20:   Dataloop_create_pairtype - create dataloop for a pairtype
        -:   21:
        -:   22:   Arguments:
        -:   23:+  MPI_Datatype type - the pairtype
        -:   24:.  DLOOP_Dataloop **output_dataloop_ptr
        -:   25:.  int output_dataloop_size
        -:   26:.  int output_dataloop_depth
        -:   27:-  int flag
        -:   28:
        -:   29:.N Errors
        -:   30:.N Returns 0 on success, -1 on failure.
        -:   31:
        -:   32:   Note:
        -:   33:   This function simply creates the appropriate input parameters for
        -:   34:   use with Dataloop_create_struct and then calls that function.
        -:   35:
        -:   36:   This same function could be used to create dataloops for any type
        -:   37:   that actually consists of two distinct elements.
        -:   38:@*/
        -:   39:int PREPEND_PREFIX(Dataloop_create_pairtype)(MPI_Datatype type,
        -:   40:					     DLOOP_Dataloop **dlp_p,
        -:   41:					     int *dlsz_p,
        -:   42:					     int *dldepth_p,
        -:   43:					     int flag)
    34590:   44:{
    34590:   45:    int blocks[2] = { 1, 1 };
        -:   46:    MPI_Aint disps[2];
        -:   47:    MPI_Datatype types[2];
        -:   48:
    34590:   49:    DLOOP_Assert(type == MPI_FLOAT_INT || type == MPI_DOUBLE_INT ||
        -:   50:		 type == MPI_LONG_INT || type == MPI_SHORT_INT ||
        -:   51:		 type == MPI_LONG_DOUBLE_INT || type == MPI_2INT);
        -:   52:
    34590:   53:    switch(type) {
        -:   54:	case MPI_FLOAT_INT:
     6918:   55:	    PAIRTYPE_CONTENTS(MPI_FLOAT, float, MPI_INT, int);
     6918:   56:	    break;
        -:   57:	case MPI_DOUBLE_INT:
     6918:   58:	    PAIRTYPE_CONTENTS(MPI_DOUBLE, double, MPI_INT, int);
     6918:   59:	    break;
        -:   60:	case MPI_LONG_INT:
     6918:   61:	    PAIRTYPE_CONTENTS(MPI_LONG, long, MPI_INT, int);
     6918:   62:	    break;
        -:   63:	case MPI_SHORT_INT:
     6918:   64:	    PAIRTYPE_CONTENTS(MPI_SHORT, short, MPI_INT, int);
     6918:   65:	    break;
        -:   66:	case MPI_LONG_DOUBLE_INT:
     6918:   67:	    PAIRTYPE_CONTENTS(MPI_LONG_DOUBLE, long double, MPI_INT, int);
     6918:   68:	    break;
        -:   69:	case MPI_2INT:
    #####:   70:	    PAIRTYPE_CONTENTS(MPI_INT, int, MPI_INT, int);
        -:   71:	    break;
        -:   72:    }
        -:   73:
    34590:   74:    return PREPEND_PREFIX(Dataloop_create_struct)(2,
        -:   75:						  blocks,
        -:   76:						  disps,
        -:   77:						  types,
        -:   78:						  dlp_p,
        -:   79:						  dlsz_p,
        -:   80:						  dldepth_p,
        -:   81:						  flag);
        -:   82:}