@@ -133,42 +133,46 @@ int
133133ompi_datatype_get_value_index (const  ompi_datatype_t  * value_type , const  ompi_datatype_t  * index_type , ompi_datatype_t  * * pair_type )
134134{
135135    * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_datatype_null ;
136- 
137-     /* C predefined data types */ 
138-     if  (index_type -> id  ==  OMPI_DATATYPE_MPI_INT ) {
139-         if  (value_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT ) {
140-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_float_int ;
141-         } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE ) {
142-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_double_int ;
143-         } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_LONG ) {
144-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_long_int ;
145-         } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_SHORT ) {
146-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_short_int ;
147-         } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_INT ) {
148-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2int ;
149-         } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_LONG_DOUBLE ) {
150-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_longdbl_int ;
136+     bool  is_fortran  =  ((index_type -> super .flags  &  OMPI_DATATYPE_FLAG_DATA_FORTRAN ) ==  OMPI_DATATYPE_FLAG_DATA_FORTRAN ) ? true : false;
137+ 
138+     if  (false ==  is_fortran ) {
139+         if  (index_type -> id  ==  OMPI_DATATYPE_MPI_INT ) {
140+             if  (value_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT ) {
141+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_float_int ;
142+             } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE ) {
143+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_double_int ;
144+             } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_LONG ) {
145+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_long_int ;
146+             } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_SHORT ) {
147+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_short_int ;
148+             } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_INT ) {
149+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2int ;
150+             } else  if  (value_type -> id  ==  OMPI_DATATYPE_MPI_LONG_DOUBLE ) {
151+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_longdbl_int ;
152+             }
151153        }
152154    /* Fortran predefined data types */ 
153-     } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_INTEGER ) && 
154-         (value_type -> id  ==  OMPI_DATATYPE_MPI_INTEGER )) {
155-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2integer ;
156-     } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT ) && 
157-         (value_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT )) {
158-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2real ;
159-     } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE ) && 
160-         (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE )) {
161-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2dblprec ;
155+     } else  {
156+         if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_INTEGER ) && 
157+             (value_type -> id  ==  OMPI_DATATYPE_MPI_INTEGER )) {
158+                * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2integer ;
159+         } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT ) && 
160+             (value_type -> id  ==  OMPI_DATATYPE_MPI_FLOAT )) {
161+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2real ;
162+         } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE ) && 
163+             (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE )) {
164+                 * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2dblprec ;
162165#if  OMPI_HAVE_FORTRAN_COMPLEX 
163- else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_COMPLEX ) && 
164-         (value_type -> id  ==  OMPI_DATATYPE_MPI_COMPLEX )) {
165-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2cplex ;
166+      } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_COMPLEX ) && 
167+              (value_type -> id  ==  OMPI_DATATYPE_MPI_COMPLEX )) {
168+                  * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2cplex ;
166169#endif 
167170#if  OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX 
168- else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE_COMPLEX ) && 
169-         (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE_COMPLEX )) {
170-             * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2dblcplex ;
171+      } else  if  ((index_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE_COMPLEX ) && 
172+              (value_type -> id  ==  OMPI_DATATYPE_MPI_DOUBLE_COMPLEX )) {
173+                  * pair_type  =  (ompi_datatype_t  * )& ompi_mpi_2dblcplex ;
171174#endif 
175+         }
172176    }
173177
174178    return  OMPI_SUCCESS ;
0 commit comments