/********************************************************************************* * FUNCTION: file2Mcollvec -- load a collvec for master processor from a file * *********************************************************************************/ void file2Mcollvec(M, filename, nproc, bpp, xm, ym, num, loc) struct collvec *M; char filename[80]; int nproc, bpp, xm, ym, num, loc; { int i, j, k, l, p, stp, jump; double temp; FILE *fp; jump = 14; fp = fopen(filename, "r"); for (l = 0; l < loc; l++) for (i = 0; i < 2; i++) { /*** FIRST ***/ fscanf(fp, "%lf", &M->F[0].el[l].el[i]); /*** MIDDLE ***/ for (j = 0; j <= bpp-2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->M[j].el[l].el[i].el[k]); fseek(fp, jump*2*bpp*(nproc-1), SEEK_CUR); /*** LAST ***/ fscanf(fp, "%lf", &M->L[0].el[l].el[i]); } fclose(fp); } /* end of function file2Mcollvec */ /********************************************************************************** * FUNCTION: file2Scollvec -- load a collvec for a slave processor from a file * **********************************************************************************/ void file2Scollvec(M, filename, nproc, bpp, xm, ym, num, loc, pe) struct mat_kvec4 *M; char filename[80]; int nproc, bpp, xm, ym, num, loc, pe; { double temp; int i, j, k, l, p, stp, jump; FILE *fp; jump = 14; fp = fopen(filename, "r"); for (l = 0; l < loc; l++) for (i = 0; i < 2; i++) { /*** FIRST ***/ fseek(fp, jump, SEEK_CUR); /*** MIDDLE ***/ for (p = 0; p < nproc; p++) { if (p == 0) stp = bpp-2; else stp = bpp-1; if (p == pe) for (j = 0; j <= stp; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->el[j].el[l].el[i].el[k]); else fseek(fp, jump*2*(stp+1), SEEK_CUR); } /*** LAST ***/ fseek(fp, jump, SEEK_CUR); } fclose(fp); } /* end of function file2Scollvec */ /******************************************************************* * FUNCTION: file2SWel_M -- load the SW element of a collmat * * from a file to the master processor * *******************************************************************/ void file2SWel_M(M, fp, num) struct first_proc_collmat *M; FILE *fp; int num; { int i, j, k, n, m; if (num == 0) /* xl_yg */ { /* SW equation */ fscanf(fp, "%lf", &M->AF[0].a[0].el[0][0]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->BF[0].a[0].el[0].el[0][i]); fscanf(fp, "%lf", &M->AF[0].a[0].el[0][1]); fscanf(fp, "%lf", &M->AF[0].b[0].el[0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->BF[0].b[0] .el[0][i]); } /* NW equation */ fscanf(fp, "%lf", &M->CF[0].a[0].el[0][0]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[0].a[0].A.el[0][i]); fscanf(fp, "%lf", &M->CF[0].a[0].el[0][1]); fscanf(fp, "%lf", &M->CF[0].b[0].el[0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].a[0].B .el[0][i]); fscanf(fp, "%lf", &M->A[0].b[0].el[0].el[0][i]); } /* SE equation */ fscanf(fp, "%lf", &M->AF[0].a[0].el[1][0]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->BF[0].a[0].el[0].el[1][i]); fscanf(fp, "%lf", &M->AF[0].a[0].el[1][1]); fscanf(fp, "%lf", &M->AF[0].b[0].el[1]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->BF[0].b[0] .el[1][i]); } /* NE equation */ fscanf(fp, "%lf", &M->CF[0].a[0].el[1][0]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[0].a[0].C.el[0][i]); fscanf(fp, "%lf", &M->CF[0].a[0].el[1][1]); fscanf(fp, "%lf", &M->CF[0].b[0].el[1]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].a[0].D .el[0][i]); fscanf(fp, "%lf", &M->A[0].b[0].el[1].el[0][i]); } } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AF[0].a[0].el[i][j]); fscanf(fp, "%lf", &M->AF[0].b[0].el[i]); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->BF[0].a[0].el[j].el[i][k]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BF[0].b[0].el[i][j]); } /* SE equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[0].el[1][j]); fscanf(fp, "%lf", &M->CF[0].b[0].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[0].C.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[0].D.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].b[0].el[1].el[0][j]); /* NE equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[0].el[1][j]); fscanf(fp, "%lf", &M->CF[0].b[0].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[0].C.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[0].D.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].b[0].el[1].el[0][j]); } } /* end of function file2SWel_M */ /******************************************************************* * FUNCTION: file2Wel_M -- load the W elements of a collmat * * from a file to the master processor * *******************************************************************/ void file2Wel_M(M, fp, num, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, n, bpp; { int i, j, k, bppm2, np1, nm1, ix, ixp1, jump; double temp; bppm2 = bpp - 2; np1 = n + 1; nm1 = n-1; jump = 14; if (num == 0) /* xl_yg */ { ix = (np1) / bpp; ixp1 = (n+2) / bpp; /* SW equation */ if (ix == 0) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[n].a[0].A.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[n].a[0].el[0].el[0][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].a[0].B.el[1][i]); fscanf(fp, "%lf", &M->A[n].b[0].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[n].b[0].el[0][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (ix == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[n].a[0].el[0].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[np1].a[0].A.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[n].b[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].a[0].B.el[0][i]); fscanf(fp, "%lf", &M->A[np1].b[0].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (ix == 0) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[n].a[0].C.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[n].a[0].el[0].el[1][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].a[0].D.el[1][i]); fscanf(fp, "%lf", &M->A[n].b[0].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[n].b[0].el[1][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (ix == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[n].a[0].el[0].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[np1].a[0].C.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[n].b[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].a[0].D.el[0][i]); fscanf(fp, "%lf", &M->A[np1].b[0].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &M->AF[0].c[nm1].el[i]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AF[0].a[n].el[i][j]); fscanf(fp, "%lf", &M->AF[0].b[n].el[i]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BF[0].c[nm1].el[i][j]); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->BF[0].a[n].el[j].el[i][k]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BF[0].b[n].el[i][j]); } /* SE equation */ fscanf(fp, "%lf", &M->CF[0].c[nm1].el[0]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[n].el[0][j]); fscanf(fp, "%lf", &M->CF[0].b[n].el[0]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].c[nm1].el[0].el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].A.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].B.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].b[n].el[0].el[0][j]); /* NE equation */ fscanf(fp, "%lf", &M->CF[0].c[nm1].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[n].el[1][j]); fscanf(fp, "%lf", &M->CF[0].b[n].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].c[nm1].el[1].el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].C.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].D.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].b[n].el[1].el[0][j]); } } /* end of function file2Wel_M */ /******************************************************************* * FUNCTION: file2NWel_M -- load the NW element of a collmat * * from a file to the master processor * *******************************************************************/ void file2NWel_M(M, fp, num, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, n, bpp; { int i, j, k, nx, nm1, jump; double temp; jump = 14; nm1 = n - 1; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; /* SW equation */ fseek(fp, jump*9, SEEK_CUR); /* NW equation */ fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[0].el[0][0]); fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[0].el[0][1]); fscanf(fp, "%lf", &M->AL[0].b[0].el[0]); /* SE equation */ fseek(fp, jump*9, SEEK_CUR); /* NE equation */ fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[0].el[1][0]); fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[0].el[1][1]); fscanf(fp, "%lf", &M->AL[0].b[0].el[1]); } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &M->AF[0].c[nm1].el[i]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AF[0].a[n].el[i][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BF[0].c[nm1].el[i][j]); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->BF[0].a[n].el[j].el[i][k]); } /* SE equation */ fscanf(fp, "%lf", &M->CF[0].c[nm1].el[0]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[n].el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].c[nm1].el[0].el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].A.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].B.el[0][j]); /* NE equation */ fscanf(fp, "%lf", &M->CF[0].c[nm1].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CF[0].a[n].el[1][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].c[nm1].el[1].el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].C.el[0][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->A[0].a[n].D.el[0][j]); } } /* end of function file2NWel_M */ /******************************************************************* * FUNCTION: file2Sel_M -- load the S elements of a collmat * * from a file to the master processor * *******************************************************************/ void file2Sel_M(M, fp, num, m, bpp) struct first_proc_collmat *M; FILE *fp; int num, m, bpp; { int mm1, mp1, i, j, ix, ixp1, bppm2; double temp; mm1 = m - 1; mp1 = m + 1; bppm2 = bpp - 2; if (num == 0) /* xl_yg */ { /* SW equation */ fscanf(fp, "%lf", &M->AF[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->AF[0].a[m].el[0][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->BF[0].a[m].el[0].el[0][i]); } fscanf(fp, "%lf", &M->AF[0].a[m].el[0][1]); fscanf(fp, "%lf", &M->AF[0].b[m].el[0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->BF[0].b[m].el[0][i]); } /* NW equation */ fscanf(fp, "%lf", &M->CF[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->CF[0].a[m].el[0][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[0].a[m].A.el[0][i]); } fscanf(fp, "%lf", &M->CF[0].a[m].el[0][1]); fscanf(fp, "%lf", &M->CF[0].b[m].el[0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].a[m].B.el[0][i]); fscanf(fp, "%lf", &M->A[0].b[m].el[0].el[0][i]); } /* SE equation */ fscanf(fp, "%lf", &M->AF[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->AF[0].a[m].el[1][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->BF[0].a[m].el[0].el[1][i]); } fscanf(fp, "%lf", &M->AF[0].a[m].el[1][1]); fscanf(fp, "%lf", &M->AF[0].b[m].el[1]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->BF[0].b[m].el[1][i]); } /* NE equation */ fscanf(fp, "%lf", &M->CF[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->CF[0].a[m].el[1][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[0].a[m].C.el[0][i]); } fscanf(fp, "%lf", &M->CF[0].a[m].el[1][1]); fscanf(fp, "%lf", &M->CF[0].b[m].el[1]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].a[m].D.el[0][i]); fscanf(fp, "%lf", &M->A[0].b[m].el[1].el[0][i]); } } else /* num == 1, yl_xg */ { ix = (m+1) / bpp; ixp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].a[0].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].a[0].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].b[0].el[0].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->B[m].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->B[m].b[0].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].a[0].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].a[0].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->A[m].b[0].el[1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->B[m].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->B[m].b[0].el[1][j] = temp; } /* SE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->C[m].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->C[m].b[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].a[0].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].a[0].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].b[0].el[0].el[0][j] = temp; } /* NE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->C[m].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == 0) M->C[m].b[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].a[0].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].a[0].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (ixp1 == 0)) M->A[mp1].b[0].el[1].el[0][j] = temp; } } } /* end of function file2Sel_M */ /************************************************************************ * FUNCTION: file2intel_M -- load the interior elements of a collmat * * from a file to the master processor * ************************************************************************/ void file2intel_M(M, fp, num, m, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, m, n, bpp; { int i, j, nx, nxp1, mx, mxp1, mm1, mp1, np1, nm1, bppm2, jump; double temp; mm1 = m - 1; mp1 = m - 1; np1 = n + 1; nm1 = n - 1; bppm2 = bpp - 2; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == 0) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[n].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[n].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].a[m].B.el[1][i]); fscanf(fp, "%lf", &M->A[n].b[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[n].b[m].el[0][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NW equation */ if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[n].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[np1].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[n].b[m].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].a[m].B.el[0][i]); fscanf(fp, "%lf", &M->A[np1].b[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (nx == 0) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[n].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[n].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].a[m].D.el[1][i]); fscanf(fp, "%lf", &M->A[n].b[m].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[n].b[m].el[1][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NE equation */ if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[n].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[np1].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[n].b[m].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].a[m].D.el[0][i]); fscanf(fp, "%lf", &M->A[np1].b[m].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].b[n].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].b[n].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].b[n].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].b[n].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].b[n].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].b[n].el[0].el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].b[n].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].b[n].el[1].el[0][j] = temp; } } } /* end of function file2intel_M */ /******************************************************************* * FUNCTION: file2Nel_M -- load the N elements of a collmat * * from a file to the master processor * *******************************************************************/ void file2Nel_M(M, fp, num, m, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, m, n, bpp; { int i, j, nm1, mm1, mp1, mx, mxp1, bppm2, jump; double temp; mm1 = m - 1; mp1 = m + 1; nm1 = n - 1; bppm2 = bpp - 2; jump = 14; if (num == 0) /* xl_yg */ { /* SW equation */ fseek(fp, jump*12, SEEK_CUR); /* NW equation */ fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->AL[0].a[m].el[0][0]); fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[m].el[0][1]); fscanf(fp, "%lf", &M->AL[0].b[m].el[0]); /* SE equation */ fseek(fp, jump*12, SEEK_CUR); /* NE equation */ fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->AL[0].a[m].el[1][0]); fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[m].el[1][1]); fscanf(fp, "%lf", &M->AL[0].b[m].el[1]); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].a[n].el[i].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->A[m].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->B[m].a[n].el[i].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].B.el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == 0) M->C[m].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if ((m < bppm2) && (mxp1 == 0)) M->A[mp1].a[n].D.el[0][j] = temp; } } } /* end of function file2Nel_M */ /******************************************************************** * FUNCTION: file2SEel_M -- load the SE element of a collmat * * from a file to the master processor * ********************************************************************/ void file2SEel_M(M, fp, num, m) struct first_proc_collmat *M; FILE *fp; int num, m; { int i, j, k, mm1; double temp; mm1 = m - 1; if (num == 0) /* xl_yg */ { /* SW equation */ fscanf(fp, "%lf", &M->AF[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->AF[0].a[m].el[0][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->BF[0].a[m].el[0].el[0][i]); } fscanf(fp, "%lf", &M->AF[0].a[m].el[0][1]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->BF[0].a[m].el[1].el[0][i]); /* NW equation */ fscanf(fp, "%lf", &M->CF[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->CF[0].a[m].el[0][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[0].a[m].A.el[0][i]); } fscanf(fp, "%lf", &M->CF[0].a[m].el[0][1]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[0].a[m].B.el[0][i]); /* SE equation */ fscanf(fp, "%lf", &M->AF[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->AF[0].a[m].el[1][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->BF[0].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->BF[0].a[m].el[0].el[1][i]); } fscanf(fp, "%lf", &M->AF[0].a[m].el[1][1]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->BF[0].a[m].el[1].el[1][i]); /* NE equation */ fscanf(fp, "%lf", &M->CF[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->CF[0].a[m].el[1][0]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[0].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[0].a[m].C.el[0][i]); } fscanf(fp, "%lf", &M->CF[0].a[m].el[1][1]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[0].a[m].D.el[0][i]); } else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AL[0].a[0].el[i][j]); fscanf(fp, "%lf", &M->AL[0].b[0].el[i]); } } } /* end of function file2SEel_M */ /******************************************************************* * FUNCTION: file2Eel_M -- load the E elements of a collmat * * from a file to the master processor * *******************************************************************/ void file2Eel_M(M, fp, num, m, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, m, n, bpp; { int i, j, k, bppm2, nx, nxp1, mm1, np1, nm1, jump; double temp; bppm2 = bpp - 2; mm1 = m - 1; np1 = n + 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == 0) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[n].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[n].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[n].a[m].B.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[n].a[m].el[1].el[0][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[n].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[np1].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[n].a[m].el[1].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[np1].a[m].B.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); /* SE equation */ if (nx == 0) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[n].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[n].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[n].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[n].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[n].a[m].D.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[n].a[m].el[1].el[1][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (nx == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[n].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[n].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[np1].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[np1].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[n].a[m].el[1].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == 0) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[np1].a[m].D.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); } else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &M->AL[0].c[nm1].el[i]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AL[0].a[n].el[i][j]); fscanf(fp, "%lf", &M->AL[0].b[n].el[i]); } } } /* end of function file2Eel_M */ /******************************************************************** * FUNCTION: file2NEel_M -- load the NE element of a collmat * * from a file to the master processor * ********************************************************************/ void file2NEel_M(M, fp, num, m, n, bpp) struct first_proc_collmat *M; FILE *fp; int num, m, n, bpp; { int i, j, k, mm1, nm1, jump; double temp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { /* SW equation */ fseek(fp, jump*9, SEEK_CUR); /* NW equation */ fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->AL[0].a[m].el[0][0]); fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[m].el[0][1]); /* SE equation */ fseek(fp, jump*9, SEEK_CUR); /* NE equation */ fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->AL[0].a[m].el[1][0]); fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->AL[0].a[m].el[1][1]); } else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &M->AL[0].c[nm1].el[i]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->AL[0].a[n].el[i][j]); } } } /* end of function file2NEel_M */ /********************************************************************************* * FUNCTION: file2Mcollmat -- load a collmat for master processor from a file * *********************************************************************************/ void file2Mcollmat(M, filename, nproc, bpp, xm, ym, num, loc, glob) struct first_proc_collmat *M; char filename[80]; int nproc, bpp, xm, ym, num, loc, glob; { int locm1, locm2, globm2, globm3, bppm2, m, n; FILE *fp; locm2 = loc-2; locm1 = loc-1; globm3 = glob-3; globm2 = glob-2; bppm2 = bpp - 2; fp = fopen(filename, "r"); file2SWel_M(M, fp, num); for (n = 0; n <= globm3; n++) file2Wel_M(M, fp, num, n, bpp); file2NWel_M(M, fp, num, globm2, bpp); for (m = 1; m <= locm2; m++) { file2Sel_M(M, fp, num, m, bpp); for (n = 0; n <= globm3; n++) file2intel_M(M, fp, num, m, n, bpp); file2Nel_M(M, fp, num, m, globm2, bpp); } m = locm1; file2SEel_M(M, fp, num, m); for (n = 0; n <= globm3; n++) file2Eel_M(M, fp, num, m, n, bpp); file2NEel_M(M, fp, num, m, globm2, bpp); fclose(fp); } /* end of function file2Mcollmat */ /***************************************************************** * FUNCTION: file2SWel_S -- load the SW element of a collmat * * from a file to a slave processor * *****************************************************************/ void file2SWel_S(fp, num) FILE *fp; int num; { int i, j, k, jump; double temp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*36, SEEK_CUR); else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } /* SE equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NE equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } /* end of function file2SWel_S */ /**************************************************************** * FUNCTION: file2Wel_S -- load the W element of a collmat * * from a file to a slave processor * ****************************************************************/ void file2Wel_S(M, fp, num, n, bpp, pe) struct proc_collmat *M; FILE *fp; int num, n, bpp, pe; { int i, j, k, ix, ixp1, nn, jump; double temp; nn = (n+1) % bpp; jump = 14; if (num == 0) /* xl_yg */ { ix = (n+1) / bpp; ixp1 = (n+2) / bpp; /* SW equation */ if (ix == pe) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].A.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[0].el[0].el[0][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].b[0].el[0][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[0].el[0].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].A.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].b[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].B.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (ix == pe) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].C.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[0].el[0].el[1][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].b[0].el[1][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[0].el[0].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].C.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].b[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].D.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } /* SE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } /* end of function file2Wel_S */ /***************************************************************** * FUNCTION: file2NWel_S -- load the NW element of a collmat * * from a file to a slave processor * *****************************************************************/ void file2NWel_S(fp, num) FILE *fp; int num; { int i, j, k, jump; double temp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*36, SEEK_CUR); else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); } /* SE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } /* end of function file2NWel_S */ /**************************************************************** * FUNCTION: file2Sel_S -- load the S element of a collmat * * from a file to a slave processor * ****************************************************************/ void file2Sel_S(M, fp, num, m, bpp, pe) struct proc_collmat *M; FILE *fp; int num, m, bpp, pe; { int i, j, ix, ixp1, mm, jump; double temp; jump = 14; mm = (m+1) % bpp; if (num == 0) /* xl_yg */ fseek(fp, jump*48, SEEK_CUR); else /* num == 1, yl_xg */ { ix = (m+1) / bpp; ixp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[0].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].b[0].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].b[0].el[1][j] = temp; } /* SE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].b[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].b[0].el[0].el[0][j] = temp; } /* NE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].b[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].b[0].el[1].el[0][j] = temp; } } } /* end of function file2Sel_S */ /*********************************************************************** * FUNCTION: file2intel_S -- load the iterior element of a collmat * * from a file to a slave processor * ***********************************************************************/ void file2intel_S(M, fp, num, m, n, bpp, pe) struct proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, nx, nxp1, mx, mxp1, nn, mm, mm1, nm1, jump; double temp; nn = (n+1) % bpp; mm = (m+1) % bpp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].b[m].el[0][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NW equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].b[m].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].B.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].b[m].el[1][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NE equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].b[m].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].D.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].b[n].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].b[n].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].b[n].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].b[n].el[0].el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].b[n].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].b[n].el[1].el[0][j] = temp; } } } /* end of function file2intel_S */ /**************************************************************** * FUNCTION: file2Nel_S -- load the N element of a collmat * * from a file to a slave processor * ****************************************************************/ void file2Nel_S(M, fp, num, m, n, bpp, pe) struct proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, mm, mx, mxp1, nm1, jump; double temp; mm = (m+1) % bpp; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*48, SEEK_CUR); else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].B.el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].D.el[0][j] = temp; } } } /* end of function file2Nel_S */ /***************************************************************** * FUNCTION: file2SEel_S -- load the SE element of a collmat * * from a file to a slave processor * *****************************************************************/ void file2SEel_S(fp, num) FILE *fp; int num; { int i, j, k, jump; double temp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*36, SEEK_CUR); else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); } } } /* end of function file2SEel_S */ /**************************************************************** * FUNCTION: file2Eel_S -- load the E element of a collmat * * from a file to a slave processor * ****************************************************************/ void file2Eel_S(M, fp, num, m, n, bpp, pe) struct proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, k, nn, nx, nxp1, mm1, jump; double temp; nn = (n+1) % bpp; mm1 = m - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[0][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].B.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); /* SE equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[1][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].D.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); } else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); } } } /* end of function file2Eel_S */ /***************************************************************** * FUNCTION: file2NEel_S -- load the NE element of a collmat * * from a file to a slave processor * *****************************************************************/ void file2NEel_S(fp, num) FILE *fp; int num; { int i, j, k, jump; double temp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*36, SEEK_CUR); else /* num == 1, yl_xg */ { /* SW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NW equation */ for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } } /* end of function file2NEel_S */ /******************************************************************************** * FUNCTION: file2Scollmat -- load a collmat for slave processor from a file * ********************************************************************************/ void file2Scollmat(M, filename, bpp, xm, ym, num, loc, glob, pe) struct proc_collmat *M; char filename[80]; int bpp, xm, ym, num, loc, glob, pe; { int n, m, locm1, locm2, globm3, globm2, bppm2, bppm1; FILE *fp; locm1 = loc - 1; locm2 = loc - 2; globm3 = glob - 3; globm2 = glob - 2; bppm2 = bpp - 2; bppm1 = bpp - 1; fp = fopen(filename, "r"); file2SWel_S(fp, num); for (n = 0; n <= globm3; n++) file2Wel_S(M, fp, num, n, bpp, pe); file2NWel_S(fp, num); for (m = 1; m <= locm2; m++) { file2Sel_S(M, fp, num, m, bpp, pe); for (n = 0; n <= globm3; n++) file2intel_S(M, fp, num, m, n, bpp, pe); file2Nel_S(M, fp, num, m, globm2, bpp, pe); } m = locm1; file2SEel_S(fp, num); for (n = 0; n <= globm3; n++) file2Eel_S(M, fp, num, m, n, bpp, pe); file2NEel_S(fp, num); fclose(fp); } /* end of function file2Scollmat */ /**************************************************************** * FUNCTION: file2Wel_L -- load the W element of a collmat * * from a file to lslave processor * ****************************************************************/ void file2Wel_L(M, fp, num, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, n, bpp, pe; { int i, j, k, ix, ixp1, nn, jump; double temp; nn = (n+1) % bpp; jump = 14; if (num == 0) /* xl_yg */ { ix = (n+1) / bpp; ixp1 = (n+2) / bpp; /* SW equation */ if (ix == pe) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].A.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[0].el[0].el[0][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].b[0].el[0][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[0].el[0].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].A.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].b[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].B.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (ix == pe) { for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].C.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[0].el[0].el[1][i]); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].b[0].el[1][i]); } } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[0].el[0].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].C.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].b[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (ixp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].D.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } /* SE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } /* end of function file2Wel_L */ /***************************************************************** * FUNCTION: file2NWel_L -- load the NW element of a collmat * * from a file to lslave processor * *****************************************************************/ void file2NWel_L(M, fp, num, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, n, bpp, pe; { int i, j, k, nn, nx, jump; double temp; nn = (n+1) % bpp; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; /* SW equation */ if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].A.el[1][i]); else fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[0].el[0][0]); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[0].el[0][1]); fscanf(fp, "%lf", &M->BL[0].b[0].el[0]); /* NW equation */ for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->CL[0].a[0].el[0].el[0][i]); fseek(fp, jump, SEEK_CUR); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].a[0].el[1].el[0][i]); fscanf(fp, "%lf", &M->CL[0].b[0].el[0][i]); } fseek(fp, jump*2, SEEK_CUR); /* SE equation */ if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[0].C.el[1][i]); else fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[0].el[1][0]); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[0].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[0].el[1].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[0].el[1][1]); fscanf(fp, "%lf", &M->BL[0].b[0].el[1]); /* NE equation */ for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->CL[0].a[0].el[0].el[1][i]); fseek(fp, jump, SEEK_CUR); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].a[0].el[1].el[1][i]); fscanf(fp, "%lf", &M->CL[0].b[0].el[1][i]); } fseek(fp, jump*2, SEEK_CUR); } else /* num == 1, yl_xg */ { /* W equations */ for (i = 0; i < 2; i++) { fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &temp); } /* SE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); /* NE equation */ fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } /* end of function file2NWel_L */ /**************************************************************** * FUNCTION: file2Sel_L -- load the S element of a collmat * * from a file to a slave processor * ****************************************************************/ void file2Sel_L(M, fp, num, m, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, m, bpp, pe; { int i, j, ix, ixp1, mm, jump; double temp; mm = (m+1) % bpp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*48, SEEK_CUR); else /* num == 1, yl_xg */ { ix = (m+1) / bpp; ixp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[0].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].b[0].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->B[mm].b[0].el[1][j] = temp; } /* SE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].a[0].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].b[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].b[0].el[0].el[0][j] = temp; } /* NE equation */ for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].a[0].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->C[mm].b[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].a[0].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ixp1 == pe) M->A[mm].b[0].el[1].el[0][j] = temp; } } } /* end of function file2Sel_L */ /*********************************************************************** * FUNCTION: file2intel_L -- load the iterior element of a collmat * * from a file to a slave processor * ***********************************************************************/ void file2intel_L(M, fp, num, m, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, nx, nxp1, mx, mxp1, nn, mm, mm1, nm1, jump; double temp; nn = (n+1) % bpp; mm = (m+1) % bpp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].b[m].el[0][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NW equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].b[m].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].B.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); /* SE equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[1].el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].b[m].el[1][i]); } } else fseek(fp, jump*16, SEEK_CUR); /* NE equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].b[m].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].D.el[0][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[1].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].b[n].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].b[n].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].b[n].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].B.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].b[n].el[0].el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].b[n].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].D.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].b[n].el[1].el[0][j] = temp; } } } /* end of function file2intel_L */ /***************************************************************** * FUNCTION: file2Nel_L -- load the N element of a collmat * * from a file to lslave processor * *****************************************************************/ void file2Nel_L(M, fp, num, m, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, nn, mm, nx, mx, mxp1, mm1, nm1, jump; double temp; nn = (n+1) % bpp; mm = (m+1) % bpp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; /* SW equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->BL[0].a[m].el[0][0]); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[m].el[0][1]); fscanf(fp, "%lf", &M->BL[0].b[m].el[0]); /* NW equation */ for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->CL[0].a[m].el[0].el[0][i]); } fseek(fp, jump*2, SEEK_CUR); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].a[m].el[1].el[0][i]); fscanf(fp, "%lf", &M->CL[0].b[m].el[0][i]); } fseek(fp, jump*2, SEEK_CUR); /* SE equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->BL[0].a[m].el[1][0]); if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); fscanf(fp, "%lf", &M->A[nn].b[m].el[1].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[m].el[1][1]); fscanf(fp, "%lf", &M->BL[0].b[m].el[1]); /* NE equation */ for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->CL[0].a[m].el[0].el[1][i]); } fseek(fp, jump*2, SEEK_CUR); for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].a[m].el[1].el[1][i]); fscanf(fp, "%lf", &M->CL[0].b[m].el[1][i]); } fseek(fp, jump*2, SEEK_CUR); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; mxp1 = (m+2) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[0][j] = temp; } /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->B[mm].a[n].el[i].el[1][j] = temp; } /* SE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[0][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[0].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].A.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].B.el[0][j] = temp; } /* NE equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].c[nm1].el[1][j] = temp; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->C[mm].a[n].el[i].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].c[nm1].el[1].el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].C.el[0][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mxp1 == pe) M->A[mm].a[n].D.el[0][j] = temp; } } } /* end of function file2Nel_L */ /***************************************************************** * FUNCTION: file2SEel_L -- load the SE element of a collmat * * from a file to lslave processor * *****************************************************************/ void file2SEel_L(M, fp, num, m, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, m, bpp, pe; { int i, j, k, mm, ix, jump; double temp; mm = (m+1) % bpp; jump = 14; if (num == 0) /* xl_yg */ fseek(fp, jump*36, SEEK_CUR); else /* num == 1, yl_xg */ { ix = (m+1) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[0].el[0][j]); fscanf(fp, "%lf", &M->BL[0].b[0].el[0]); /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[0].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].b[0].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[0].el[1][j]); fscanf(fp, "%lf", &M->BL[0].b[0].el[1]); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->CL[0].a[0].el[j].el[i][k]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CL[0].b[0].el[i][j]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); } } } /* end of function file2SEel_L */ /***************************************************************** * FUNCTION: file2Eel_L -- load the E element of a collmat * * from a file to lslave processor * *****************************************************************/ void file2Eel_L(M, fp, num, m, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num; { int i, j, k, nn, mm, nm1, mm1, mx, nx, nxp1, jump; double temp; nn = (n+1) % bpp; mm = (m+1) % bpp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { nx = (n+1) / bpp; nxp1 = (n+2) / bpp; /* SW equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[0][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[0][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NW equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[0][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].B.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); /* SE equation */ if (nx == pe) { for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->B[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->B[nn].a[m].el[0].el[1][i]); } for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->B[nn].a[m].el[1].el[1][i]); } else fseek(fp, jump*12, SEEK_CUR); /* NE equation */ if (nx == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->C[nn].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->C[nn].a[m].el[0].el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[0][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[0][i]); } else fseek(fp, jump*4, SEEK_CUR); if (nx == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->C[nn].a[m].el[1].el[1][i]); else fseek(fp, jump*2, SEEK_CUR); if (nxp1 == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].D.el[0][i]); else fseek(fp, jump*2, SEEK_CUR); } else /* num == 1, yl_xg */ { mx = (m+1) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].B.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[0].el[1][j] = temp; } fscanf(fp, "%lf", &M->BL[0].c[nm1].el[0]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[n].el[0][j]); fscanf(fp, "%lf", &M->BL[0].b[n].el[0]); /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].a[n].D.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (mx == pe) M->A[mm].b[n].el[1].el[1][j] = temp; } fscanf(fp, "%lf", &M->BL[0].c[nm1].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[n].el[1][j]); fscanf(fp, "%lf", &M->BL[0].b[n].el[1]); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CL[0].c[nm1].el[i][j]); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->CL[0].a[n].el[j].el[i][k]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CL[0].b[n].el[i][j]); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); fscanf(fp, "%lf", &temp); } } } /* end of function file2Eel_L */ /***************************************************************** * FUNCTION: file2NEel_L -- load the NE element of a collmat * * from a file to lslave processor * *****************************************************************/ void file2NEel_L(M, fp, num, m, n, bpp, pe) struct last_proc_collmat *M; FILE *fp; int num, m, n, bpp, pe; { int i, j, k, ix, nn, mm, mm1, nm1, jump; double temp; nn = (n+1) % bpp; mm = (m+1) % bpp; mm1 = m - 1; nm1 = n - 1; jump = 14; if (num == 0) /* xl_yg */ { ix = (n+1) / bpp; /* SW equation */ if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[0].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].A.el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].c[mm1].el[0]); fscanf(fp, "%lf", &M->BL[0].a[m].el[0][0]); if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].B.el[1][i]); else fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[m].el[0][1]); /* NW equation */ for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].c[mm1].el[0][i]); fscanf(fp, "%lf", &M->CL[0].a[m] .el[0].el[0][i]); } fseek(fp, jump*2, SEEK_CUR); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->CL[0].a[m].el[1].el[0][i]); fseek(fp, jump, SEEK_CUR); /* SE equation */ if (ix == pe) for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->A[nn].c[mm1].el[1].el[1][i]); fscanf(fp, "%lf", &M->A[nn].a[m].C.el[1][i]); } else fseek(fp, jump*4, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].c[mm1].el[1]); fscanf(fp, "%lf", &M->BL[0].a[m].el[1][0]); if (ix == pe) for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->A[nn].a[m].D.el[1][i]); else fseek(fp, jump*2, SEEK_CUR); fscanf(fp, "%lf", &M->BL[0].a[m].el[1][1]); /* NE equation */ for (i = 0; i <= 1; i++) { fscanf(fp, "%lf", &M->CL[0].c[mm1].el[1][i]); fscanf(fp, "%lf", &M->CL[0].a[m].el[0].el[1][i]); } fseek(fp, jump*2, SEEK_CUR); for (i = 0; i <= 1; i++) fscanf(fp, "%lf", &M->CL[0].a[m].el[1].el[1][i]); fseek(fp, jump*1, SEEK_CUR); } else /* num == 1, yl_xg */ { ix = (m+1) / bpp; /* SW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].c[nm1].el[0].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[n].A.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[n].B.el[1][j] = temp; } fscanf(fp, "%lf", &M->BL[0].c[nm1].el[0]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[n].el[0][j]); /* NW equation */ for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].c[nm1].el[1].el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[n].C.el[1][j] = temp; } for (j = 0; j < 2; j++) { fscanf(fp, "%lf", &temp); if (ix == pe) M->A[mm].a[n].D.el[1][j] = temp; } fscanf(fp, "%lf", &M->BL[0].c[nm1].el[1]); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->BL[0].a[n].el[1][j]); /* E equations */ for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) fscanf(fp, "%lf", &M->CL[0].c[nm1].el[i][j]); for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) fscanf(fp, "%lf", &M->CL[0].a[n].el[j].el[i][k]); fscanf(fp, "%lf", &temp); for (j = 0; j < 2; j++) fscanf(fp, "%lf", &temp); } } } /* end of function file2NEel_L */ /******************************************************************************** * FUNCTION: file2Lcollmat -- load a collmat for slave processor from a file * ********************************************************************************/ void file2Lcollmat(M, filename, bpp, xm, ym, num, loc, glob, pe) struct last_proc_collmat *M; char filename[80]; int bpp, xm, ym, num, loc, glob, pe; { int n, m, locm1, locm2, globm3, globm2, bppm2, bppm1; FILE *fp; locm1 = loc - 1; locm2 = loc - 2; globm3 = glob - 3; globm2 = glob - 2; bppm2 = bpp - 2; bppm1 = bpp - 1; fp = fopen(filename, "r"); file2SWel_S(fp, num); for (n = 0; n <= globm3; n++) file2Wel_L(M, fp, num, n, bpp, pe); file2NWel_L(M, fp, num, globm2, bpp, pe); for (m = 1; m <= locm2; m++) { file2Sel_L(M, fp, num, m, bpp, pe); for (n = 0; n <= globm3; n++) file2intel_L(M, fp, num, m, n, bpp, pe); file2Nel_L(M, fp, num, m, globm2, bpp, pe); } m = locm1; file2SEel_L(M, fp, num, m, bpp, pe); for (n = 0; n <= globm3; n++) file2Eel_L(M, fp, num, m, n, bpp, pe); file2NEel_L(M, fp, num, m, globm2, bpp, pe); fclose(fp); } /* end of function file2Lcollmat */