23 static struct intracomm_info {
 
   26   struct intracomm_info *next;
 
   33 static struct intercomm_info {
 
   38   struct intercomm_info *next;
 
   47 static struct couple_info {
 
   59   struct couple_info *next;
 
   75 static int is_initialized = 0;
 
   80   if (comm == 
NULL) 
return;
 
  109 static void free_intracomm_info(
void) {
 
  110   struct intracomm_info *p, *q;
 
  112   for (p = intracomm_root.next; p; p = q) {
 
  119 static void free_intercomm_info(
void) {
 
  120   struct intercomm_info *p, *q;
 
  122   for (p = intercomm_root.next; p; p = q) {
 
  129 static void free_couple_info(
void) {
 
  130   struct couple_info *p, *q;
 
  132   for (p = couple_root.next; p; p = q) {
 
  141   free_intracomm_info();
 
  142   free_intercomm_info();
 
  148 static struct intracomm_info *get_intracomm_info(
const char *unit_id) {
 
  149   struct intracomm_info *p;
 
  151   for (p = intracomm_root.next; p; p = p->next) {
 
  152     if (strcmp(unit_id, p->unit_id) == 0) 
return p;
 
  158 static struct intercomm_info *get_intercomm_info(
const char *couple_id) {
 
  159   struct intercomm_info *p;
 
  161   for (p = intercomm_root.next; p; p = p->next) {
 
  162     if (strcmp(couple_id, p->couple_id) == 0) 
return p;
 
  168 static struct couple_info *get_couple_info(
const char *boundary_id) {
 
  169   struct couple_info *p;
 
  171   for (p = couple_root.next; p; p = p->next) {
 
  172     if (strcmp(boundary_id, p->boundary_id) == 0) 
return p;
 
  180 static int init_intracomm_info(
void) {
 
  183   struct intracomm_info *p;
 
  185   char *couple_id, *unit1_id, *unit2_id;
 
  198   for (i = 0; i < unit_ids->
n_unit; i++) {
 
  201   for (i = 0; i < boundary_ids->
n_boundary; i++) {
 
  203     if (couple_id == 
NULL) 
goto error;
 
  206     if (unit1_id == 
NULL) 
goto error;
 
  209     if (unit2_id == 
NULL) 
goto error;
 
  211     for (j = 0; j < unit_ids->
n_unit; j++) {
 
  212       if (strcmp(unit1_id, unit_ids->
ids[j]) == 0) {
 
  215       if (strcmp(unit2_id, unit_ids->
ids[j]) == 0) {
 
  223   for (i = 0; i < unit_ids->
n_unit; i++) {
 
  226           (
struct intracomm_info *)
HECMW_malloc(
sizeof(
struct intracomm_info));
 
  227       if (p->next == 
NULL) {
 
  233       strcpy(p->unit_id, unit_ids->
ids[i]);
 
  234       p->comm = alloc_struct_comm();
 
  235       if (p->comm == 
NULL) 
goto error;
 
  246   free_intracomm_info();
 
  250 static int init_intercomm_info(
void) {
 
  253   struct intercomm_info *p;
 
  268   for (i = 0; i < couple_ids->
n_couple; i++) {
 
  271   for (i = 0; i < boundary_ids->
n_boundary; i++) {
 
  273     if (couple_id == 
NULL) 
goto error;
 
  275     for (j = 0; j < couple_ids->
n_couple; j++) {
 
  276       if (strcmp(couple_id, couple_ids->
ids[j]) == 0) {
 
  284   for (i = 0; i < couple_ids->
n_couple; i++) {
 
  287           (
struct intercomm_info *)
HECMW_malloc(
sizeof(
struct intercomm_info));
 
  288       if (p->next == 
NULL) {
 
  301       strcpy(p->couple_id, couple_ids->
ids[i]);
 
  302       strcpy(p->unit1_id, unit1_id);
 
  303       strcpy(p->unit2_id, unit2_id);
 
  304       if ((p->comm = alloc_struct_comm()) == 
NULL) 
goto error;
 
  315   free_intercomm_info();
 
  319 static int init_couple_info(
void) {
 
  321   struct couple_info *p;
 
  322   char *boundary_id, *unit1_id, *unit2_id;
 
  329   for (i = 0; i < boundary_ids->
n_boundary; i++) {
 
  330     boundary_id = boundary_ids->
ids[i];
 
  332     p->next = (
struct couple_info *)
HECMW_malloc(
sizeof(
struct couple_info));
 
  333     if (p->next == 
NULL) {
 
  342     strcpy(p->boundary_id, boundary_id);
 
  369     if (p->unit1_grp == 
NULL) 
goto error;
 
  371     if (p->unit2_grp == 
NULL) 
goto error;
 
  383 static int set_couple_type(
int *couple_type) {
 
  384   struct couple_info *p;
 
  385   int is_specified_mxn    = 0;
 
  386   int is_specified_maxmn  = 0;
 
  387   int is_specified_manual = 0;
 
  389   for (p = couple_root.next; p; p = p->next) {
 
  391       is_specified_mxn = 1;
 
  393       is_specified_maxmn = 1;
 
  395       is_specified_manual = 1;
 
  402   if (is_specified_mxn + is_specified_maxmn + is_specified_manual != 1) {
 
  407   if (is_specified_mxn) {
 
  409   } 
else if (is_specified_maxmn) {
 
  411   } 
else if (is_specified_manual) {
 
  420 static int check_intracomm_psize_mxn(
void) {
 
  422   struct intracomm_info *p;
 
  425   for (p = intracomm_root.next; p; p = p->next) {
 
  429     psize_sum += proc->
n_proc;
 
  443 static int check_intracomm_psize_maxmn(
void) {
 
  445   struct intracomm_info *p;
 
  448   for (p = intracomm_root.next; p; p = p->next) {
 
  466 static int check_intracomm_psize_manual(
void) {
 
  468   struct intracomm_info *p;
 
  470   int psize_sum = 0, psize_max = 0;
 
  473   for (p = intracomm_root.next; p; p = p->next) {
 
  477     psize_sum += proc->
n_proc;
 
  488   for (i = 0; i < psize_sum; i++) {
 
  491   for (p = intracomm_root.next; p; p = p->next) {
 
  495     for (i = 0; i < proc->
n_proc; i++) {
 
  496       rank = proc->
ranks[i];
 
  499                         "specified rank number is too small (%d)", rank);
 
  503       if (rank >= psize_sum) {
 
  505                         "specified rank number is too large (%d)", rank);
 
  514   for (i = 0; i < psize_sum; i++) {
 
  515     if (mask[i]) psize_max = i;
 
  517   for (n = 0, i = 0; i <= psize_max; i++) {
 
  520                       "Process No. %d is not used");
 
  538 static int check_intracomm_psize(
int couple_type) {
 
  552 static int set_intracomm_psize(
void) {
 
  554   struct intracomm_info *p;
 
  556   for (p = intracomm_root.next; p; p = p->next) {
 
  561     p->comm->psize = proc->
n_proc;
 
  569 static int set_intracomm_ranks_mxn(
void) {
 
  570   struct intracomm_info *p;
 
  574   for (p = intracomm_root.next; p; p = p->next) {
 
  575     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  576     if (p->comm->ranks == 
NULL) {
 
  578       free_intracomm_info();
 
  581     for (i = 0; i < p->comm->psize; i++) {
 
  582       p->comm->ranks[i] = n;
 
  590 static int set_intracomm_ranks_maxmn(
void) {
 
  591   struct intracomm_info *p;
 
  594   for (p = intracomm_root.next; p; p = p->next) {
 
  595     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  596     if (p->comm->ranks == 
NULL) {
 
  598       free_intracomm_info();
 
  601     for (i = 0; i < p->comm->psize; i++) {
 
  602       p->comm->ranks[i] = i;
 
  609 static int set_intracomm_ranks_manual(
void) {
 
  611   struct intracomm_info *p;
 
  614   for (p = intracomm_root.next; p; p = p->next) {
 
  618     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  619     if (p->comm->ranks == 
NULL) {
 
  622       free_intracomm_info();
 
  625     for (i = 0; i < p->comm->psize; i++) {
 
  626       p->comm->ranks[i] = proc->
ranks[i];
 
  635 static int set_intracomm_ranks(
int couple_type) {
 
  651 static int set_intercomm_psize_mxn(
void) {
 
  652   struct intercomm_info *p;
 
  653   struct intracomm_info *q1, *q2;
 
  655   for (p = intercomm_root.next; p; p = p->next) {
 
  656     q1 = get_intracomm_info(p->unit1_id);
 
  658     q2 = get_intracomm_info(p->unit2_id);
 
  661     p->comm->psize = q1->comm->psize + q2->comm->psize;
 
  667 static int set_intercomm_psize_maxmn(
void) {
 
  668   struct intercomm_info *p;
 
  669   struct intracomm_info *q1, *q2;
 
  671   for (p = intercomm_root.next; p; p = p->next) {
 
  672     q1 = get_intracomm_info(p->unit1_id);
 
  674     q2 = get_intracomm_info(p->unit2_id);
 
  677     if (q1->comm->psize >= q2->comm->psize) {
 
  678       p->comm->psize = q1->comm->psize;
 
  680       p->comm->psize = q2->comm->psize;
 
  687 static int set_intercomm_psize_manual(
void) {
 
  688   struct intercomm_info *p;
 
  689   struct intracomm_info *q1, *q2;
 
  691   int global_psize, n, i;
 
  701   for (p = intercomm_root.next; p; p = p->next) {
 
  702     q1 = get_intracomm_info(p->unit1_id);
 
  703     if (q1 == 
NULL) 
goto error;
 
  704     q2 = get_intracomm_info(p->unit2_id);
 
  705     if (q2 == 
NULL) 
goto error;
 
  707     for (i = 0; i < global_psize; i++) {
 
  710     for (i = 0; i < q1->comm->psize; i++) {
 
  713     for (i = 0; i < q2->comm->psize; i++) {
 
  716     for (n = 0, i = 0; i < global_psize; i++) {
 
  731 static int set_intercomm_psize(
int couple_type) {
 
  748 static int set_intercomm_ranks_mxn(
void) {
 
  749   struct intercomm_info *p;
 
  750   struct intracomm_info *q1, *q2;
 
  753   for (p = intercomm_root.next; p; p = p->next) {
 
  754     q1 = get_intracomm_info(p->unit1_id);
 
  755     if (q1 == 
NULL) 
goto error;
 
  756     q2 = get_intracomm_info(p->unit2_id);
 
  757     if (q2 == 
NULL) 
goto error;
 
  759     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  760     if (p->comm->ranks == 
NULL) {
 
  764     HECMW_assert(p->comm->psize == q1->comm->psize + q2->comm->psize);
 
  765     for (n = 0, i = 0; i < q1->comm->psize; i++, n++) {
 
  766       p->comm->ranks[n] = q1->comm->ranks[i];
 
  768     for (i = 0; i < q2->comm->psize; i++, n++) {
 
  769       p->comm->ranks[n] = q2->comm->ranks[i];
 
  780 static int set_intercomm_ranks_maxmn(
void) {
 
  781   struct intercomm_info *p;
 
  782   struct intracomm_info *q1, *q2;
 
  785   for (p = intercomm_root.next; p; p = p->next) {
 
  786     q1 = get_intracomm_info(p->unit1_id);
 
  787     if (q1 == 
NULL) 
goto error;
 
  788     q2 = get_intracomm_info(p->unit2_id);
 
  789     if (q2 == 
NULL) 
goto error;
 
  791     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  792     if (p->comm->ranks == 
NULL) {
 
  796     if (q1->comm->psize >= q2->comm->psize) {
 
  798       for (i = 0; i < q1->comm->psize; i++) {
 
  799         p->comm->ranks[i] = q1->comm->ranks[i];
 
  803       for (i = 0; i < q2->comm->psize; i++) {
 
  804         p->comm->ranks[i] = q2->comm->ranks[i];
 
  816 static int set_intercomm_ranks_manual(
void) {
 
  817   struct intercomm_info *p;
 
  818   struct intracomm_info *q1, *q2;
 
  820   int global_psize, n, i;
 
  830   for (p = intercomm_root.next; p; p = p->next) {
 
  831     q1 = get_intracomm_info(p->unit1_id);
 
  832     if (q1 == 
NULL) 
goto error;
 
  833     q2 = get_intracomm_info(p->unit2_id);
 
  834     if (q2 == 
NULL) 
goto error;
 
  836     p->comm->ranks = (
int *)
HECMW_calloc(p->comm->psize, 
sizeof(
int));
 
  837     if (p->comm->ranks == 
NULL) {
 
  842     for (i = 0; i < global_psize; i++) {
 
  845     for (i = 0; i < q1->comm->psize; i++) {
 
  848     for (i = 0; i < q2->comm->psize; i++) {
 
  851     for (n = 0, i = 0; i < global_psize; i++) {
 
  854         p->comm->ranks[n] = i;
 
  869 static int set_intercomm_ranks(
int couple_type) {
 
  893   for (i = 0; i < comm->
psize; i++) {
 
  894     if (comm->
ranks[i] == global_rank) {
 
  903 static int allgather_root(
int *root) {
 
  904   int *send_buf = 
NULL, *recv_buf = 
NULL;
 
  911   if (send_buf == 
NULL) {
 
  916   if (recv_buf == 
NULL) {
 
  928     if (recv_buf[i] >= 0) {
 
  945     if (comm->
rank == 0) {
 
  982   struct intracomm_info *p;
 
  983   struct intercomm_info *q;
 
  992   if (set_couple_type(&couple_type) != 
HECMW_SUCCESS) 
goto error;
 
  993   if (check_intracomm_psize(couple_type) != 
HECMW_SUCCESS) 
goto error;
 
  997   if (set_intracomm_ranks(couple_type) != 
HECMW_SUCCESS) 
goto error;
 
  999   for (p = intracomm_root.next; p; p = p->next) {
 
 1004   if (set_intercomm_psize(couple_type) != 
HECMW_SUCCESS) 
goto error;
 
 1005   if (set_intercomm_ranks(couple_type) != 
HECMW_SUCCESS) 
goto error;
 
 1007   for (q = intercomm_root.next; q; q = q->next) {
 
 1021                                       int unit_specifier, 
char *buf,
 
 1023   struct couple_info *couple;
 
 1025   char *unit_id, *ret_buf;
 
 1028   if (boundary_id == 
NULL) {
 
 1030                     "Invalid NULL pointer is found (boundary_id)");
 
 1034   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return NULL;
 
 1037     unit_id = couple->unit1_id;
 
 1039     unit_id = couple->unit2_id;
 
 1047     if (ret_buf == 
NULL) {
 
 1052     len = strlen(unit_id);
 
 1053     if (bufsize <= len) {
 
 1056     strncpy(buf, unit_id, len);
 
 1065   struct couple_info *couple;
 
 1066   struct intercomm_info *intercomm;
 
 1068   if (boundary_id == 
NULL) {
 
 1070                     "Invalid NULL pointer is found (boundary_id)");
 
 1074   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1075   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1077   if (intercomm->comm->is_member) 
return 1;
 
 1082                                        int unit_specifier) {
 
 1083   struct couple_info *couple;
 
 1084   struct intracomm_info *intracomm;
 
 1086   if (boundary_id == 
NULL) {
 
 1088                     "Invalid NULL pointer is found (boundary_id)");
 
 1092   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1095     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1097     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1103   if (intracomm->comm->is_member) 
return 1;
 
 1108   struct intracomm_info *intracomm;
 
 1110   if (unit_id == 
NULL) {
 
 1112                     "Invalid NULL pointer is found (unit_id)");
 
 1116   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1118   if (intracomm->comm->is_member) 
return 1;
 
 1123   struct couple_info *couple;
 
 1124   struct intercomm_info *intercomm;
 
 1126   if (boundary_id == 
NULL) {
 
 1128                     "Invalid NULL pointer is found (boundary_id)");
 
 1132   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1133   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1135   if (intercomm->comm->is_root) 
return 1;
 
 1140                                      int unit_specifier) {
 
 1141   struct couple_info *couple;
 
 1142   struct intracomm_info *intracomm;
 
 1144   if (boundary_id == 
NULL) {
 
 1146                     "Invalid NULL pointer is found (boundary_id)");
 
 1150   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1153     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1155     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1161   if (intracomm->comm->is_root) 
return 1;
 
 1166   struct intracomm_info *intracomm;
 
 1168   if (unit_id == 
NULL) {
 
 1170                     "Invalid NULL pointer is found (unit_id)");
 
 1174   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1176   if (intracomm->comm->is_root) 
return 1;
 
 1181   struct couple_info *couple;
 
 1182   struct intercomm_info *intercomm;
 
 1184   if (boundary_id == 
NULL) {
 
 1186                     "Invalid NULL pointer is found (boundary_id)");
 
 1190   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1191   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1193   return intercomm->comm->psize;
 
 1197                                     int unit_specifier) {
 
 1198   struct couple_info *couple;
 
 1199   struct intracomm_info *intracomm;
 
 1201   if (boundary_id == 
NULL) {
 
 1203                     "Invalid NULL pointer is found (boundary_id)");
 
 1207   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1210     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1212     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1218   return intracomm->comm->psize;
 
 1222   struct intracomm_info *intracomm;
 
 1224   if (unit_id == 
NULL) {
 
 1226                     "Invalid NULL pointer is found (unit_id)");
 
 1230   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1232   return intracomm->comm->psize;
 
 1236   struct couple_info *couple;
 
 1237   struct intercomm_info *intercomm;
 
 1239   if (boundary_id == 
NULL) {
 
 1241                     "Invalid NULL pointer is found (boundary_id)");
 
 1245   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1246   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1248   return intercomm->comm->rank;
 
 1252                                     int unit_specifier) {
 
 1253   struct couple_info *couple;
 
 1254   struct intracomm_info *intracomm;
 
 1256   if (boundary_id == 
NULL) {
 
 1258                     "Invalid NULL pointer is found (boundary_id)");
 
 1262   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1265     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1267     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1273   return intracomm->comm->rank;
 
 1277   struct intracomm_info *intracomm;
 
 1279   if (unit_id == 
NULL) {
 
 1281                     "Invalid NULL pointer is found (unit_id)");
 
 1285   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1287   return intracomm->comm->rank;
 
 1291   struct couple_info *couple;
 
 1292   struct intercomm_info *intercomm;
 
 1294   if (boundary_id == 
NULL) {
 
 1296                     "Invalid NULL pointer is found (boundary_id)");
 
 1300   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1301   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1303   return intercomm->comm->comm;
 
 1307                                            int unit_specifier) {
 
 1308   struct couple_info *couple;
 
 1309   struct intracomm_info *intracomm;
 
 1311   if (boundary_id == 
NULL) {
 
 1313                     "Invalid NULL pointer is found (boundary_id)");
 
 1317   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1320     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1322     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1328   return intracomm->comm->comm;
 
 1332   struct intracomm_info *intracomm;
 
 1334   if (unit_id == 
NULL) {
 
 1336                     "Invalid NULL pointer is found (unit_id)");
 
 1340   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1342   return intracomm->comm->comm;
 
 1346   struct couple_info *couple;
 
 1347   struct intercomm_info *intercomm;
 
 1349   if (boundary_id == 
NULL) {
 
 1351                     "Invalid NULL pointer is found (boundary_id)");
 
 1355   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1356   if ((intercomm = get_intercomm_info(couple->couple_id)) == 
NULL) 
return -1;
 
 1358   return intercomm->comm->group;
 
 1362                                              int unit_specifier) {
 
 1363   struct couple_info *couple;
 
 1364   struct intracomm_info *intracomm;
 
 1366   if (boundary_id == 
NULL) {
 
 1368                     "Invalid NULL pointer is found (boundary_id)");
 
 1372   if ((couple = get_couple_info(boundary_id)) == 
NULL) 
return -1;
 
 1375     if ((intracomm = get_intracomm_info(couple->unit1_id)) == 
NULL) 
return -1;
 
 1377     if ((intracomm = get_intracomm_info(couple->unit2_id)) == 
NULL) 
return -1;
 
 1383   return intracomm->comm->group;
 
 1387   struct intracomm_info *intracomm;
 
 1389   if (unit_id == 
NULL) {
 
 1391                     "Invalid NULL pointer is found (unit_id)");
 
 1395   if ((intracomm = get_intracomm_info(unit_id)) == 
NULL) 
return -1;
 
 1397   return intracomm->comm->group;
 
 1401     const char *boundary_id, 
int unit_specifier) {
 
 1402   struct couple_info *couple       = 
NULL;
 
 1403   struct intracomm_info *intracomm = 
NULL;
 
 1408   if (boundary_id == 
NULL) {
 
 1410                     "Invalid NULL pointer is found (boundary_id)");
 
 1414   couple = get_couple_info(boundary_id);
 
 1418     unit_id = couple->unit1_id;
 
 1420     unit_id = couple->unit2_id;
 
 1426   intracomm = get_intracomm_info(unit_id);
 
 1427   if (intracomm == 
NULL) 
return NULL;
 
 1429   comm = alloc_struct_comm();
 
 1432   comm->psize = intracomm->comm->psize;
 
 1433   comm->rank  = intracomm->comm->rank;
 
 1440   for (i = 0; i < 
comm->psize; i++) {
 
 1441     comm->ranks[i] = intracomm->comm->ranks[i];
 
 1443   comm->comm      = intracomm->comm->comm;
 
 1444   comm->group     = intracomm->comm->group;
 
 1445   comm->root      = intracomm->comm->root;
 
 1446   comm->is_member = intracomm->comm->is_member;
 
 1447   comm->is_root   = intracomm->comm->is_root;
 
 1453     const char *unit_id) {
 
 1454   struct intracomm_info *intracomm = 
NULL;
 
 1458   if (unit_id == 
NULL) {
 
 1460                     "Invalid NULL pointer is found (boundary_id)");
 
 1464   intracomm = get_intracomm_info(unit_id);
 
 1465   if (intracomm == 
NULL) 
return NULL;
 
 1467   comm = alloc_struct_comm();
 
 1470   comm->psize = intracomm->comm->psize;
 
 1471   comm->rank  = intracomm->comm->rank;
 
 1478   for (i = 0; i < 
comm->psize; i++) {
 
 1479     comm->ranks[i] = intracomm->comm->ranks[i];
 
 1481   comm->comm      = intracomm->comm->comm;
 
 1482   comm->group     = intracomm->comm->group;
 
 1483   comm->root      = intracomm->comm->root;
 
 1484   comm->is_member = intracomm->comm->is_member;
 
 1485   comm->is_root   = intracomm->comm->is_root;
 
 1491     const char *boundary_id) {
 
 1492   struct couple_info *couple;
 
 1493   struct intercomm_info *intercomm;
 
 1497   if (boundary_id == 
NULL) {
 
 1499                     "Invalid NULL pointer is found (boundary_id)");
 
 1503   couple = get_couple_info(boundary_id);
 
 1506   intercomm = get_intercomm_info(couple->couple_id);
 
 1507   if (intercomm == 
NULL) 
return NULL;
 
 1509   comm = alloc_struct_comm();
 
 1512   comm->psize = intercomm->comm->psize;
 
 1513   comm->rank  = intercomm->comm->rank;
 
 1520   for (i = 0; i < 
comm->psize; i++) {
 
 1521     comm->ranks[i] = intercomm->comm->ranks[i];
 
 1523   comm->comm      = intercomm->comm->comm;
 
 1524   comm->group     = intercomm->comm->group;
 
 1525   comm->root      = intercomm->comm->root;
 
 1526   comm->is_member = intercomm->comm->is_member;
 
 1527   comm->is_root   = intercomm->comm->is_root;
 
int HECMW_Comm_create(HECMW_Comm comm, HECMW_Group group, HECMW_Comm *comm_out)
 
HECMW_Comm HECMW_comm_get_comm(void)
 
int HECMW_Group_size(HECMW_Group group, int *size)
 
int HECMW_comm_get_rank(void)
 
int HECMW_comm_get_size(void)
 
HECMW_Group HECMW_comm_get_group(void)
 
int HECMW_Group_rank(HECMW_Group group, int *rank)
 
int HECMW_Group_incl(HECMW_Group group, int n, int *ranks, HECMW_Group *newgroup)
 
int HECMW_Allgather(void *sendbuf, int sendcount, HECMW_Datatype sendtype, void *recvbuf, int recvcount, HECMW_Datatype recvtype, HECMW_Comm comm)
 
int HECMW_couple_ctrl_get_type(const char *couple_id, int *couple_type)
 
void HECMW_couple_ctrl_free_proc(struct hecmw_couple_ctrl_proc *proc_info)
 
int HECMW_couple_ctrl_get_direction(const char *boundary_id, int *direction)
 
int HECMW_couple_ctrl_get_tolerance(const char *boundary_id, double *tolerance)
 
struct hecmw_couple_group * HECMW_couple_ctrl_get_group(const char *boundary_id, int unit_specifier)
 
int HECMW_couple_ctrl_get_bgcoef(const char *boundary_id, double *bgcoef)
 
char * HECMW_couple_ctrl_get_couple_id(const char *boundary_id, char *buf, int bufsize)
 
char * HECMW_couple_ctrl_get_unit_id(const char *couple_id, int unit_specifier, char *buf, int bufsize)
 
void HECMW_couple_ctrl_free_group(struct hecmw_couple_group *grp_info)
 
struct hecmw_couple_ctrl_boundary_ids * HECMW_couple_get_boundary_ids(void)
 
struct hecmw_couple_ctrl_unit_ids * HECMW_couple_get_unit_ids(void)
 
struct hecmw_couple_ctrl_proc * HECMW_couple_ctrl_get_proc(const char *unit_id)
 
int HECMW_couple_ctrl_get_bbcoef(const char *boundary_id, double *bbcoef)
 
int HECMW_couple_ctrl_get_n_boundary(void)
 
struct hecmw_couple_ctrl_couple_ids * HECMW_couple_get_couple_ids(void)
 
#define HECMWCPL_E_INVALID_UNITTYPE
 
#define HECMW_COUPLE_TRUE
 
#define HECMW_COUPLE_TYPE_UNDEF
 
#define HECMW_COUPLE_UNIT1
 
#define HECMWCPL_E_INVALID_CPLTYPE
 
#define HECMWCPL_E_MULTIPLE_CPLTYPE
 
#define HECMW_COUPLE_DIRECTION_UNDEF
 
#define HECMWCPL_E_INVALID_RANKS
 
#define HECMW_COUPLE_FALSE
 
#define HECMWCPL_E_DISCONTINUOUS_RANKS
 
#define HECMW_COUPLE_TYPE_MAXMN
 
#define HECMWCPL_E_INVALID_ARG
 
#define HECMW_COUPLE_TYPE_MXN
 
#define HECMWCPL_E_UNMATCH_PSIZE
 
#define HECMW_COUPLE_UNIT2
 
#define HECMW_COUPLE_TYPE_MANUAL
 
struct hecmw_couple_comm * HECMW_couple_get_intracomm_u(const char *unit_id)
 
int HECMW_couple_is_member(const char *boundary_id)
 
void HECMW_couple_free_couple_info(void)
 
int HECMW_intracomm_get_size(const char *boundary_id, int unit_specifier)
 
int HECMW_couple_is_unit_member(const char *boundary_id, int unit_specifier)
 
HECMW_Group HECMW_intercomm_get_group(const char *boundary_id)
 
int HECMW_intracomm_get_size_u(const char *unit_id)
 
int HECMW_couple_is_unit_root_u(const char *unit_id)
 
int HECMW_couple_is_unit_root(const char *boundary_id, int unit_specifier)
 
HECMW_Group HECMW_intracomm_get_group_u(const char *unit_id)
 
HECMW_Comm HECMW_intercomm_get_comm(const char *boundary_id)
 
HECMW_Comm HECMW_intracomm_get_comm_u(const char *unit_id)
 
char * HECMW_couple_get_unit_id(const char *boundary_id, int unit_specifier, char *buf, int bufsize)
 
int HECMW_intracomm_get_rank_u(const char *unit_id)
 
int HECMW_couple_is_root(const char *boundary_id)
 
int HECMW_couple_comm_init(void)
 
int HECMW_intercomm_get_size(const char *boundary_id)
 
int HECMW_intracomm_get_rank(const char *boundary_id, int unit_specifier)
 
int HECMW_intercomm_get_rank(const char *boundary_id)
 
HECMW_Group HECMW_intracomm_get_group(const char *boundary_id, int unit_specifier)
 
void HECMW_couple_free_comm(struct hecmw_couple_comm *comm)
 
int HECMW_couple_is_unit_member_u(const char *unit_id)
 
struct hecmw_couple_comm * HECMW_couple_get_intracomm(const char *boundary_id, int unit_specifier)
 
HECMW_Comm HECMW_intracomm_get_comm(const char *boundary_id, int unit_specifier)
 
struct hecmw_couple_comm * HECMW_couple_get_intercomm(const char *boundary_id)
 
int HECMW_set_error(int errorno, const char *fmt,...)
 
#define HECMW_calloc(nmemb, size)
 
#define HECMW_malloc(size)
 
#define HECMW_assert(cond)