~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to ompi/mpi/c/type_vector.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 
3
 *                         University Research and Technology
 
4
 *                         Corporation.  All rights reserved.
 
5
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 
6
 *                         of Tennessee Research Foundation.  All rights
 
7
 *                         reserved.
 
8
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
 
9
 *                         University of Stuttgart.  All rights reserved.
 
10
 * Copyright (c) 2004-2005 The Regents of the University of California.
 
11
 *                         All rights reserved.
 
12
 * $COPYRIGHT$
 
13
 * 
 
14
 * Additional copyrights may follow
 
15
 * 
 
16
 * $HEADER$
 
17
 */
 
18
 
 
19
#include "ompi_config.h"
 
20
 
 
21
#include "ompi/mpi/c/bindings.h"
 
22
#include "ompi/datatype/datatype.h"
 
23
 
 
24
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
 
25
#pragma weak MPI_Type_vector = PMPI_Type_vector
 
26
#endif
 
27
 
 
28
#if OMPI_PROFILING_DEFINES
 
29
#include "ompi/mpi/c/profile/defines.h"
 
30
#endif
 
31
 
 
32
static const char FUNC_NAME[] = "MPI_Type_vector";
 
33
 
 
34
int MPI_Type_vector(int count,
 
35
                    int blocklength,
 
36
                    int stride,
 
37
                    MPI_Datatype oldtype,
 
38
                    MPI_Datatype *newtype)
 
39
{
 
40
   int rc;
 
41
 
 
42
   if( MPI_PARAM_CHECK ) {
 
43
      OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
 
44
      if (NULL == oldtype || MPI_DATATYPE_NULL == oldtype ||
 
45
          NULL == newtype) {
 
46
        return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE,
 
47
                                      FUNC_NAME );
 
48
      } else  if( count < 0 ) {
 
49
         OMPI_ERRHANDLER_RETURN( MPI_ERR_COUNT, MPI_COMM_WORLD,
 
50
                                MPI_ERR_COUNT, FUNC_NAME );
 
51
      } else if( blocklength < 0) {
 
52
         OMPI_ERRHANDLER_RETURN( MPI_ERR_ARG, MPI_COMM_WORLD,
 
53
                                MPI_ERR_ARG, FUNC_NAME );
 
54
      }
 
55
   }
 
56
 
 
57
   rc = ompi_ddt_create_vector ( count, blocklength, stride, oldtype, newtype );
 
58
   OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME );
 
59
 
 
60
   {
 
61
      int* a_i[3];
 
62
      a_i[0] = &count;
 
63
      a_i[1] = &blocklength;
 
64
      a_i[2] = &stride;
 
65
 
 
66
      ompi_ddt_set_args( *newtype, 3, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_VECTOR );
 
67
   }
 
68
   return MPI_SUCCESS;
 
69
}