-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/romio/mpi-io/get_view.c
        -:    0:Graph:get_view.gcno
        -:    0:Data:get_view.gcda
        -:    0:Runs:521
        -:    0:Programs:139
        -:    1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
        -:    2:/* 
        -:    3: *
        -:    4: *   Copyright (C) 1997 University of Chicago. 
        -:    5: *   See COPYRIGHT notice in top-level directory.
        -:    6: */
        -:    7:
        -:    8:#include "mpioimpl.h"
        -:    9:
        -:   10:#ifdef HAVE_WEAK_SYMBOLS
        -:   11:
        -:   12:#if defined(HAVE_PRAGMA_WEAK)
        -:   13:#pragma weak MPI_File_get_view = PMPI_File_get_view
        -:   14:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
        -:   15:#pragma _HP_SECONDARY_DEF PMPI_File_get_view MPI_File_get_view
        -:   16:#elif defined(HAVE_PRAGMA_CRI_DUP)
        -:   17:#pragma _CRI duplicate MPI_File_get_view as PMPI_File_get_view
        -:   18:/* end of weak pragmas */
        -:   19:#endif
        -:   20:
        -:   21:/* Include mapping from MPI->PMPI */
        -:   22:#define MPIO_BUILD_PROFILING
        -:   23:#include "mpioprof.h"
        -:   24:#endif
        -:   25:#ifdef MPISGI
        -:   26:#include "mpisgi2.h"
        -:   27:#endif
        -:   28:
        -:   29:/*@
        -:   30:    MPI_File_get_view - Returns the file view
        -:   31:
        -:   32:Input Parameters:
        -:   33:. fh - file handle (handle)
        -:   34:
        -:   35:Output Parameters:
        -:   36:. disp - displacement (nonnegative integer)
        -:   37:. etype - elementary datatype (handle)
        -:   38:. filetype - filetype (handle)
        -:   39:. datarep - data representation (string)
        -:   40:
        -:   41:.N fortran
        -:   42:@*/
        -:   43:int MPI_File_get_view(MPI_File mpi_fh,
        -:   44:		      MPI_Offset *disp,
        -:   45:		      MPI_Datatype *etype,
        -:   46:		      MPI_Datatype *filetype,
        -:   47:		      char *datarep)
       28:   48:{
        -:   49:    int error_code;
        -:   50:    ADIO_File fh;
        -:   51:    static char myname[] = "MPI_FILE_GET_VIEW";
        -:   52:    int i, j, k, combiner;
        -:   53:    MPI_Datatype copy_etype, copy_filetype;
       28:   54:    MPIU_THREADPRIV_DECL;
        -:   55:
       28:   56:    MPIU_THREAD_CS_ENTER(ALLFUNC,);
       28:   57:    MPIR_Nest_incr();
        -:   58:
       28:   59:    fh = MPIO_File_resolve(mpi_fh);
        -:   60:
        -:   61:    /* --BEGIN ERROR HANDLING-- */
       28:   62:    MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
        -:   63:
       28:   64:    if (datarep <= (char *) 0)
        -:   65:    {
    #####:   66:	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
        -:   67:					  myname, __LINE__, MPI_ERR_ARG, 
        -:   68:					  "**iodatarepnomem", 0);
    #####:   69:	error_code = MPIO_Err_return_file(fh, error_code);
    #####:   70:	goto fn_exit;
        -:   71:    }
        -:   72:    /* --END ERROR HANDLING-- */
        -:   73:
       28:   74:    *disp = fh->disp;
       28:   75:    ADIOI_Strncpy(datarep, "native", MPI_MAX_DATAREP_STRING);
        -:   76:
       28:   77:    MPI_Type_get_envelope(fh->etype, &i, &j, &k, &combiner);
       28:   78:    if (combiner == MPI_COMBINER_NAMED) *etype = fh->etype;
        -:   79:    else {
        -:   80:	/* FIXME: It is wrong to use MPI_Type_contiguous; the user could choose to
        -:   81:	   re-implement MPI_Type_contiguous in an unexpected way.  Either use 
        -:   82:	   NMPI_Barrier as in MPICH2 or PMPI_Type_contiguous */
    #####:   83:        MPI_Type_contiguous(1, fh->etype, &copy_etype);
        -:   84:
        -:   85:	/* FIXME: Ditto for MPI_Type_commit - use NMPI or PMPI */
    #####:   86:        MPI_Type_commit(&copy_etype);
    #####:   87:        *etype = copy_etype;
        -:   88:    }
        -:   89:    /* FIXME: Ditto for MPI_Type_xxx - use NMPI or PMPI */
       28:   90:    MPI_Type_get_envelope(fh->filetype, &i, &j, &k, &combiner);
       28:   91:    if (combiner == MPI_COMBINER_NAMED) *filetype = fh->filetype;
        -:   92:    else {
       24:   93:        MPI_Type_contiguous(1, fh->filetype, &copy_filetype);
        -:   94:
       24:   95:        MPI_Type_commit(&copy_filetype);
       24:   96:        *filetype = copy_filetype;
        -:   97:    }
        -:   98:
       28:   99:fn_exit:
       28:  100:    MPIR_Nest_decr();
       28:  101:    MPIU_THREAD_CS_EXIT(ALLFUNC,);
        -:  102:
       28:  103:    return MPI_SUCCESS;
        -:  104:}