-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpid/common/datatype/mpir_type_flatten.c
-: 0:Graph:mpir_type_flatten.gcno
-: 0:Data:-
-: 0:Runs:0
-: 0:Programs:0
-: 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 <mpiimpl.h>
-: 9:#include <mpid_dataloop.h>
-: 10:#include <stdlib.h>
-: 11:
-: 12:/*@
-: 13: MPIR_Type_flatten
-: 14:
-: 15: Input Parameters:
-: 16:. type - MPI Datatype (must have been committed)
-: 17:
-: 18: Output Parameters:
-: 19:. nr_blocks_p - pointer to int in which to store the number of contiguous blocks in the type
-: 20:
-: 21:
-: 22: Return Value:
-: 23: 0 on success, -1 on failure.
-: 24:@*/
-: 25:
-: 26:int MPIR_Type_flatten(MPI_Datatype type,
-: 27: MPI_Aint *off_array,
-: 28: int *size_array,
-: 29: MPI_Aint *array_len_p)
|
#####: 30:{
-: 31: MPI_Aint first, last;
-: 32: MPID_Datatype *datatype_ptr;
-: 33: MPID_Segment *segp;
-: 34:
#####: 35: if (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN) {
#####: 36: off_array[0] = 0;
#####: 37: MPID_Datatype_get_size_macro(type, size_array[0]);
#####: 38: *array_len_p = 1;
#####: 39: return 0;
-: 40: }
-: 41:
#####: 42: MPID_Datatype_get_ptr(type, datatype_ptr);
#####: 43: MPIU_Assert(datatype_ptr->is_committed);
#####: 44: MPIU_Assert(*array_len_p >= datatype_ptr->max_contig_blocks);
-: 45:
#####: 46: segp = MPID_Segment_alloc();
#####: 47: MPID_Segment_init(0, 1, type, segp, 0); /* first 0 is bufptr,
-: 48: * 1 is count
-: 49: * last 0 is homogeneous
-: 50: */
-: 51:
#####: 52: first = 0;
#####: 53: last = SEGMENT_IGNORE_LAST;
-: 54:
#####: 55: MPID_Segment_flatten(segp,
-: 56: first,
-: 57: &last,
-: 58: off_array,
-: 59: size_array,
-: 60: array_len_p);
-: 61:
#####: 62: MPID_Segment_free(segp);
-: 63:
#####: 64: return 0;
-: 65:}
|