123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- #include "mpiP.h"
- /*********/
- FC_FUNC( mpi_group_incl, MPI_GROUP_INCL )
- (int *group, int *n, int *ranks, int *newgroup, int *ierror)
- {
- *ierror= MPI_Group_incl(*group, *n, ranks, newgroup);
- }
- int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup)
- {
- if (group==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_incl: null group passed in\n");
- abort();
- }
- if (group==MPI_GROUP_EMPTY || n==0)
- *newgroup=MPI_GROUP_EMPTY;
- else
- if (n==1 && ranks[0]==0)
- *newgroup=MPI_GROUP_ONE;
- else
- {
- fprintf(stderr,"MPI_Group_incl: more than 1 proc in group\n");
- abort();
- }
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_range_incl, MPI_GROUP_RANGE_INCL )
- (int *group, int *n, int ranges[][3], int *newgroup, int *ierror)
- {
- *ierror= MPI_Group_range_incl(*group, *n, ranges, newgroup);
- }
-
- int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
- MPI_Group *newgroup)
- {
- if (group==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_range_incl: null group passed in\n");
- abort();
- }
- if (group==MPI_GROUP_EMPTY || n==0)
- *newgroup=MPI_GROUP_EMPTY;
- else
- if (n==1 && ranges[0][0]==0 && ranges[0][1]==0)
- *newgroup=MPI_GROUP_ONE;
- else
- {
- fprintf(stderr,"MPI_Group_range_incl: more than 1 proc in group\n");
- abort();
- }
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_union, MPI_GROUP_UNION )
- (int *group1, int *group2, int *newgroup, int *ierror)
- {
- *ierror= MPI_Group_union(*group1,*group2,newgroup);
- }
- int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup)
- {
- if (group1==MPI_GROUP_NULL || group2==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_union: null group passed in\n");
- abort();
- }
-
- if (group1==MPI_GROUP_ONE || group2==MPI_GROUP_ONE)
- *newgroup=MPI_GROUP_ONE;
- else
- *newgroup=MPI_GROUP_EMPTY;
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_intersection, MPI_GROUP_INTERSECTION )
- (int *group1, int *group2, int *newgroup, int *ierror)
- {
- *ierror= MPI_Group_intersection(*group1,*group2,newgroup);
- }
- int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
- MPI_Group *newgroup)
- {
- if (group1==MPI_GROUP_NULL || group2==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_intersection: null group passed in\n");
- abort();
- }
-
- if (group1==MPI_GROUP_ONE && group2==MPI_GROUP_ONE)
- *newgroup=MPI_GROUP_ONE;
- else
- *newgroup=MPI_GROUP_EMPTY;
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_difference, MPI_GROUP_DIFFERENCE )
- (int *group1, int *group2, int *newgroup, int *ierror)
- {
- *ierror= MPI_Group_difference(*group1,*group2,newgroup);
- }
- int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
- MPI_Group *newgroup)
- {
- if (group1==MPI_GROUP_NULL || group2==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_intersection: null group passed in\n");
- abort();
- }
-
- if (group1==MPI_GROUP_EMPTY || group2==MPI_GROUP_ONE)
- *newgroup=MPI_GROUP_EMPTY;
- else
- *newgroup=MPI_GROUP_ONE;
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_free, MPI_GROUP_FREE )(int *group, int *ierror)
- {
- *ierror= MPI_Group_free(group);
- }
- int MPI_Group_free(MPI_Group *group)
- {
- *group= MPI_GROUP_NULL;
- return(MPI_SUCCESS);
- }
- /*********/
- FC_FUNC( mpi_group_translate_ranks, MPI_GROUP_TRANSLATE_RANKS )
- ( int *group1, int *n, int *ranks1,
- int *group2, int *ranks2, int *ierror)
- {
- *ierror= MPI_Group_translate_ranks(*group1,*n,ranks1,*group2,ranks2);
- }
- int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
- MPI_Group group2, int *ranks2)
- {
- int i;
- if (group1==MPI_GROUP_NULL || group2==MPI_GROUP_NULL)
- {
- fprintf(stderr,"MPI_Group_translate_ranks: null group passed in\n");
- abort();
- }
- if (n==0)
- return(MPI_SUCCESS);
- if (group1==MPI_GROUP_EMPTY)
- {
- fprintf(stderr,"MPI_Group_translate_ranks: empty input group\n");
- abort();
- }
- for (i=0; i<n; i++)
- {
- if (ranks1[i]!=0)
- {
- fprintf(stderr,"MPI_Group_translate_ranks: bad input rank: %d\n",
- ranks1[i]);
- abort();
- }
- if (group2!=MPI_GROUP_EMPTY)
- ranks2[i]=ranks1[i];
- else
- ranks2[i]=MPI_UNDEFINED;
- }
-
- return(MPI_SUCCESS);
- }
- /*********/
- MPI_Group MPI_Group_f2c(MPI_Fint group)
- {
- return(group);
- }
- /*********/
- MPI_Fint MPI_Group_c2f(MPI_Group group)
- {
- return(group);
- }
|