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

« back to all changes in this revision

Viewing changes to ompi/mpi/f77/type_match_size_f.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/f77/bindings.h"
 
22
#include "ompi/mpi/f77/constants.h"
 
23
#include "ompi/datatype/datatype.h"
 
24
#include "ompi/errhandler/errhandler.h"
 
25
#include "ompi/communicator/communicator.h"
 
26
#include "ompi/runtime/params.h"
 
27
 
 
28
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
 
29
#pragma weak PMPI_TYPE_MATCH_SIZE = mpi_type_match_size_f
 
30
#pragma weak pmpi_type_match_size = mpi_type_match_size_f
 
31
#pragma weak pmpi_type_match_size_ = mpi_type_match_size_f
 
32
#pragma weak pmpi_type_match_size__ = mpi_type_match_size_f
 
33
#elif OMPI_PROFILE_LAYER
 
34
OMPI_GENERATE_F77_BINDINGS (PMPI_TYPE_MATCH_SIZE,
 
35
                           pmpi_type_match_size,
 
36
                           pmpi_type_match_size_,
 
37
                           pmpi_type_match_size__,
 
38
                           pmpi_type_match_size_f,
 
39
                           (MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, MPI_Fint *ierr),
 
40
                           (typeclass, size, type, ierr) )
 
41
#endif
 
42
 
 
43
#if OMPI_HAVE_WEAK_SYMBOLS
 
44
#pragma weak MPI_TYPE_MATCH_SIZE = mpi_type_match_size_f
 
45
#pragma weak mpi_type_match_size = mpi_type_match_size_f
 
46
#pragma weak mpi_type_match_size_ = mpi_type_match_size_f
 
47
#pragma weak mpi_type_match_size__ = mpi_type_match_size_f
 
48
#endif
 
49
 
 
50
#if ! OMPI_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
 
51
OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_MATCH_SIZE,
 
52
                           mpi_type_match_size,
 
53
                           mpi_type_match_size_,
 
54
                           mpi_type_match_size__,
 
55
                           mpi_type_match_size_f,
 
56
                           (MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, MPI_Fint *ierr),
 
57
                           (typeclass, size, type, ierr) )
 
58
#endif
 
59
 
 
60
 
 
61
#if OMPI_PROFILE_LAYER && ! OMPI_HAVE_WEAK_SYMBOLS
 
62
#include "ompi/mpi/f77/profile/defines.h"
 
63
#endif
 
64
 
 
65
static const char FUNC_NAME[] = "MPI_Type_match_size_f";
 
66
 
 
67
/*  We cannot use the C function as from Fortran we should check for Fortran types. The only
 
68
 * difference is the type of predefined datatypes we are looking for.
 
69
 */
 
70
void mpi_type_match_size_f(MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, MPI_Fint *ierr)
 
71
{
 
72
    MPI_Datatype c_type;
 
73
    int c_size = OMPI_FINT_2_INT( *size );
 
74
 
 
75
    if (MPI_PARAM_CHECK) {
 
76
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
 
77
    }
 
78
 
 
79
    switch( OMPI_FINT_2_INT(*typeclass) ) {
 
80
    case MPI_TYPECLASS_REAL:
 
81
        c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_FLOAT, DT_FLAG_DATA_FORTRAN );
 
82
        break;
 
83
    case MPI_TYPECLASS_INTEGER:
 
84
        c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_INT, DT_FLAG_DATA_FORTRAN );
 
85
        break;
 
86
    case MPI_TYPECLASS_COMPLEX:
 
87
        c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_COMPLEX, DT_FLAG_DATA_FORTRAN );
 
88
        break;
 
89
    default:
 
90
        c_type = &ompi_mpi_datatype_null;
 
91
    }
 
92
    *type = MPI_Type_c2f( c_type );
 
93
    if( c_type != &ompi_mpi_datatype_null )
 
94
        *ierr = OMPI_INT_2_FINT( MPI_SUCCESS );
 
95
    else 
 
96
        *ierr = OMPI_INT_2_FINT( MPI_ERR_ARG );
 
97
    (void)OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
 
98
}