00001 #include "paral.h"
00002
00003 paral::paral(int np,int mr,int nd)
00004 {
00005 nproc=np; myrank=mr; ndom=nd;
00006 domproc=NULL;
00007
00008 ltg = NULL;
00009 gcn=NULL;
00010 lcngcn=NULL;
00011 inc=NULL;
00012 nodnum=NULL;
00013
00014 nbndom=NULL;
00015 nrdofdom=NULL;
00016 masgcn=NULL;
00017 nrbmdom=NULL;
00018 rbmadr=NULL;
00019 }
00020
00021 paral::~paral()
00022 {
00023 delete [] domproc;
00024
00025 delete [] ltg;
00026 delete [] gcn;
00027 delete [] lcngcn;
00028 delete [] inc;
00029 delete [] nodnum;
00030
00031 delete [] nbndom;
00032 delete [] nrdofdom;
00033 delete [] masgcn;
00034 delete [] nrbmdom;
00035 delete [] rbmadr;
00036 }
00037
00038
00039
00040
00041
00042
00043 void paral::read (FILE *in,gtopology *top)
00044 {
00045 long i;
00046
00047 ltg = new long [top->nn];
00048
00049 for (i=0;i<top->nn;i++){
00050 fscanf (in,"%ld",ltg+i);
00051 ltg[i]--;
00052 }
00053 }
00054
00055
00056
00057
00058
00059
00060 void paral::procdomcorr ()
00061 {
00062 long i,j;
00063 MPI_Status stat;
00064
00065 if (myrank==0){
00066 domproc = new long [nproc];
00067 domproc[0]=ndom;
00068 for (i=1;i<nproc;i++){
00069 MPI_Recv (&j,1,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00070 domproc[j]=stat.MPI_TAG;
00071 }
00072 }
00073 else{
00074 MPI_Send (&ndom,1,MPI_LONG,0,myrank,MPI_COMM_WORLD);
00075 }
00076 MPI_Barrier (MPI_COMM_WORLD);
00077
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 void paral::schurordering (gtopology *top)
00090 {
00091 long i,j,k,ndofn;
00092
00093
00094 ndof=1;
00095 for (i=0;i<top->nn;i++){
00096 if (ltg[i]==-1){
00097
00098 ndofn=top->give_ndofn (i);
00099 for (j=0;j<ndofn;j++){
00100 k=top->give_dof(i,j);
00101 if (k<0) continue;
00102 if (k==0) continue;
00103 if (k>0){
00104 top->save_dof (i,j,ndof); ndof++;
00105 }
00106 }
00107 }
00108 }
00109 indof=ndof-1;
00110
00111 for (i=0;i<top->nn;i++){
00112 if (ltg[i]!=-1){
00113
00114 ndofn=top->give_ndofn (i);
00115 for (j=0;j<ndofn;j++){
00116 k=top->give_dof (i,j);
00117 if (k<0) continue;
00118 if (k==0) continue;
00119 if (k>0){
00120 top->save_dof (i,j,ndof); ndof++;
00121 }
00122 }
00123 }
00124 }
00125 ndof--;
00126
00127
00128 for (i=0;i<top->ne;i++){
00129 if (top->give_cne (i)==1){
00130 for (j=0;j<top->give_ndofe(i);j++){
00131 if (top->give_dof (i,j)>ndof) ndof=top->give_dof (i,j);
00132 }
00133 }
00134 }
00135
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 void paral::globcnnum_pdd (gtopology *top,FILE *out)
00148 {
00149 long i,j,k,l,gnn,maxndofn,maxnbn,maxgnn;
00150 long *buff,**gncn;
00151 MPI_Status stat;
00152
00153
00154
00155
00156
00157 maxndofn=0;
00158
00159 nbn=0;
00160
00161 gnn=0;
00162 for (i=0;i<top->nn;i++){
00163 if (ltg[i]!=-1){
00164 if (maxndofn<top->give_ndofn (i)) maxndofn = top->give_ndofn (i);
00165 nbn++;
00166 if (gnn<ltg[i]) gnn=ltg[i];
00167 }
00168 }
00169
00170 buff = new long [4];
00171 buff[0]=maxndofn;
00172 buff[1]=nbn;
00173 buff[2]=gnn;
00174 buff[3]=ndof-indof;
00175
00176 if (myrank==0){
00177 nbndom = new long [nproc];
00178 nrdofdom = new long [nproc];
00179
00180
00181 nbndom[ndom]=nbn;
00182 nrdofdom[ndom]=ndof-indof;
00183
00184
00185 totmaxndofn=maxndofn;
00186
00187 maxnbn=nbn;
00188
00189 maxgnn=gnn;
00190
00191 maxnrdof=0;
00192
00193
00194 for (i=1;i<nproc;i++){
00195 MPI_Recv (buff,4,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00196 nbndom[stat.MPI_TAG]=buff[1];
00197 nrdofdom[stat.MPI_TAG]=buff[3];
00198 if (buff[0]>totmaxndofn) totmaxndofn=buff[0];
00199 if (buff[1]>maxnbn) maxnbn=buff[1];
00200 if (buff[2]>maxgnn) maxgnn=buff[2];
00201 if (buff[3]>maxnrdof) maxnrdof=buff[3];
00202 }
00203 maxgnn++;
00204
00205 fprintf (out,"\n\n\n Global data information \n");
00206 fprintf (out,"\n maxnbn %ld",maxnbn);
00207 fprintf (out,"\n totmaxndofn %ld",totmaxndofn);
00208 fprintf (out,"\n maxgnn %ld",maxgnn);
00209 fprintf (out,"\n maxnrdof %ld",maxnrdof);
00210 fprintf (out,"\n\n pocty velicin na podoblastech");
00211 for (i=0;i<nproc;i++){
00212 fprintf (out,"\n nbn %4ld nrdof %4ld",nbndom[i],nrdofdom[i]);
00213 }
00214
00215 buff[0]=totmaxndofn;
00216 buff[1]=maxnbn;
00217 buff[2]=maxnrdof;
00218 for (i=1;i<nproc;i++){
00219 MPI_Send (buff,4,MPI_LONG,i,ndom,MPI_COMM_WORLD);
00220 }
00221 }
00222 else{
00223 MPI_Send (buff,4,MPI_LONG,0,ndom,MPI_COMM_WORLD);
00224 MPI_Recv (buff,4,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00225 totmaxndofn=buff[0];
00226 maxnbn=buff[1];
00227 maxnrdof=buff[2];
00228 }
00229 MPI_Barrier (MPI_COMM_WORLD);
00230 delete [] buff;
00231
00232
00233
00234
00235
00236
00237
00238 buff = new long [maxnbn*(totmaxndofn+1)];
00239 for (i=0;i<maxnbn*(totmaxndofn+1);i++){
00240 buff[i]=0;
00241 }
00242
00243
00244 k=0;
00245 for (i=0;i<top->nn;i++){
00246 if (ltg[i]!=-1){
00247 buff[k*(totmaxndofn+1)+totmaxndofn]=ltg[i];
00248 for (j=0;j<top->give_ndofn (i);j++){
00249 buff[k*(totmaxndofn+1)+j]=top->give_dof (i,j);
00250 }
00251 k++;
00252 }
00253 }
00254
00255
00256 if (myrank==0){
00257
00258
00259 gncn = new long* [maxgnn];
00260 for (i=0;i<maxgnn;i++){
00261 gncn[i] = new long [totmaxndofn];
00262 for (j=0;j<totmaxndofn;j++){
00263 gncn[i][j]=0;
00264 }
00265 }
00266
00267
00268 for (j=0;j<nbndom[ndom];j++){
00269 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00270 for (k=0;k<totmaxndofn;k++){
00271 gncn[l][k]=buff[j*(totmaxndofn+1)+k];
00272 }
00273 }
00274
00275
00276 for (i=1;i<nproc;i++){
00277 MPI_Recv (buff,maxnbn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00278 for (j=0;j<nbndom[stat.MPI_TAG];j++){
00279 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00280 for (k=0;k<totmaxndofn;k++){
00281 gncn[l][k]=buff[j*(totmaxndofn+1)+k];
00282 }
00283 }
00284 }
00285
00286
00287 ngdof=1;
00288 for (i=0;i<maxgnn;i++){
00289 for (j=0;j<totmaxndofn;j++){
00290 if (gncn[i][j]>0){
00291 gncn[i][j]=ngdof; ngdof++;
00292 }
00293 }
00294 }
00295 ngdof--;
00296
00297 }
00298 else{
00299 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
00300 }
00301 MPI_Barrier (MPI_COMM_WORLD);
00302
00303
00304
00305
00306
00307 if (myrank==0){
00308 for (i=1;i<nproc;i++){
00309 MPI_Recv (buff,maxnbn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00310 for (j=0;j<nbndom[stat.MPI_TAG];j++){
00311 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00312 for (k=0;k<totmaxndofn;k++){
00313 buff[j*(totmaxndofn+1)+k]=gncn[l][k];
00314 }
00315 }
00316 l=stat.MPI_TAG;
00317 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,l,ndom,MPI_COMM_WORLD);
00318 }
00319
00320 k=0;
00321 for (i=0;i<top->nn;i++){
00322 if (ltg[i]!=-1){
00323 buff[k*(totmaxndofn+1)+totmaxndofn]=ltg[i];
00324 for (j=0;j<top->give_ndofn (i);j++){
00325 buff[k*(totmaxndofn+1)+j]=top->give_dof(i,j);
00326 }
00327 k++;
00328 }
00329 }
00330
00331 for (j=0;j<nbndom[ndom];j++){
00332 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00333 for (k=0;k<totmaxndofn;k++){
00334 buff[j*(totmaxndofn+1)+k]=gncn[l][k];
00335 }
00336 }
00337
00338
00339 for (i=0;i<maxgnn;i++){
00340 delete [] gncn[i];
00341 }
00342 delete [] gncn;
00343
00344 }
00345 else{
00346 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
00347 MPI_Recv (buff,maxnbn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00348 }
00349 MPI_Barrier (MPI_COMM_WORLD);
00350
00351
00352
00353
00354
00355
00356
00357 gcn = new long [ndof];
00358 for (i=0;i<ndof;i++){
00359 gcn[i]=0;
00360 }
00361
00362
00363 k=0;
00364 for (i=0;i<top->nn;i++){
00365 if (ltg[i]!=-1){
00366 for (j=0;j<top->give_ndofn (i);j++){
00367 l=top->give_dof (i,j)-1;
00368 if (l>-1) gcn[l]=buff[k*(totmaxndofn+1)+j];
00369 }
00370 k++;
00371 }
00372 }
00373
00374 delete [] buff;
00375
00376
00377
00378
00379
00380 buff = new long [maxnrdof];
00381 j=indof;
00382 for (i=0;i<ndof-indof;i++){
00383 buff[i]=gcn[j]; j++;
00384 }
00385
00386 if (myrank==0){
00387
00388 masgcn = new long* [nproc];
00389 for (i=0;i<nproc;i++){
00390 masgcn[i] = new long [nrdofdom[i]];
00391 for (j=0;j<nrdofdom[i];j++){
00392 masgcn[i][j]=0;
00393 }
00394 }
00395
00396
00397 for (j=0;j<nrdofdom[ndom];j++){
00398 masgcn[ndom][j]=buff[j];
00399 }
00400
00401
00402 for (i=1;i<nproc;i++){
00403 MPI_Recv (buff,maxnrdof,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00404
00405 for (j=0;j<nrdofdom[stat.MPI_TAG];j++){
00406 masgcn[stat.MPI_TAG][j]=buff[j];
00407 }
00408
00409 }
00410 }
00411 else{
00412 MPI_Send (buff,maxnrdof,MPI_LONG,0,ndom,MPI_COMM_WORLD);
00413 }
00414 MPI_Barrier (MPI_COMM_WORLD);
00415
00416 delete [] buff;
00417 }
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468 void paral::globcnnum_feti (gtopology *top,FILE *out)
00469 {
00470 long i,j,k,l,m,ii,jj,kk,ll,maxndofn,gnn,maxnbn,maxgnn,maxinc;
00471 long *buff,**noddom,*nodinc,**gncn;
00472 MPI_Status stat;
00473
00474
00475
00476
00477
00478 maxndofn=0;
00479
00480 nbn=0;
00481
00482 gnn=0;
00483 for (i=0;i<top->nn;i++){
00484 if (ltg[i]!=-1){
00485 if (maxndofn<top->give_ndofn (i)) maxndofn = top->give_ndofn (i);
00486 nbn++;
00487 if (gnn<ltg[i]) gnn=ltg[i];
00488 }
00489 }
00490
00491
00492 buff = new long [3];
00493 buff[0]=maxndofn;
00494 buff[1]=nbn;
00495 buff[2]=gnn;
00496
00497 if (myrank==0){
00498
00499 nbndom = new long [nproc];
00500 nbndom[ndom]=nbn;
00501
00502
00503 totmaxndofn=maxndofn;
00504
00505 maxnbn=nbn;
00506
00507 maxgnn=gnn;
00508 for (i=1;i<nproc;i++){
00509 MPI_Recv (buff,3,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00510 nbndom[stat.MPI_TAG]=buff[1];
00511 if (buff[0]>totmaxndofn) totmaxndofn=buff[0];
00512 if (buff[1]>maxnbn) maxnbn=buff[1];
00513 if (buff[2]>maxgnn) maxgnn=buff[2];
00514
00515 }
00516 maxgnn++;
00517
00518 fprintf (out,"\n\n\n Global data information \n");
00519 fprintf (out,"\n maxnbn %ld",maxnbn);
00520 fprintf (out,"\n totmaxndofn %ld",totmaxndofn);
00521 fprintf (out,"\n maxgnn %ld",maxgnn);
00522 fprintf (out,"\n\n pocty velicin na podoblastech");
00523 for (i=0;i<nproc;i++){
00524 fprintf (out,"\n nbn %4ld",nbndom[i]);
00525 }
00526
00527 buff[0]=totmaxndofn;
00528 buff[1]=maxnbn;
00529 for (i=1;i<nproc;i++){
00530 MPI_Send (buff,3,MPI_LONG,i,ndom,MPI_COMM_WORLD);
00531 }
00532 }
00533 else{
00534 MPI_Send (buff,3,MPI_LONG,0,ndom,MPI_COMM_WORLD);
00535
00536
00537 MPI_Recv (buff,3,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00538 totmaxndofn=buff[0];
00539 maxnbn=buff[1];
00540 }
00541 MPI_Barrier (MPI_COMM_WORLD);
00542 delete [] buff;
00543
00544
00545
00546
00547
00548 buff = new long [maxnbn];
00549 j=0;
00550 for (i=0;i<top->nn;i++){
00551 if (ltg[i]!=-1){
00552 buff[j]=ltg[i]; j++;
00553 }
00554 }
00555
00556 if (myrank==0){
00557
00558 noddom = new long* [maxgnn];
00559 for (i=0;i<maxgnn;i++){
00560 noddom[i] = new long [nproc];
00561 for (j=0;j<nproc;j++){
00562 noddom[i][j]=-1;
00563 }
00564 }
00565
00566 k=ndom;
00567 for (j=0;j<nbndom[k];j++){
00568 noddom[buff[j]][k]=1;
00569 }
00570
00571 for (i=1;i<nproc;i++){
00572 MPI_Recv (buff,maxnbn,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00573 k=stat.MPI_TAG;
00574 for (j=0;j<nbndom[k];j++){
00575 noddom[buff[j]][k]=1;
00576 }
00577 }
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589 }
00590 else{
00591 MPI_Send (buff,maxnbn,MPI_LONG,0,ndom,MPI_COMM_WORLD);
00592 }
00593 MPI_Barrier (MPI_COMM_WORLD);
00594 delete [] buff;
00595
00596
00597
00598
00599
00600 if (myrank==0){
00601
00602 nodinc = new long [maxgnn];
00603
00604 maxinc=0;
00605 for (i=0;i<maxgnn;i++){
00606 k=0;
00607 for (j=0;j<nproc;j++){
00608 if (noddom[i][j]==1) k++;
00609 }
00610 if (maxinc<k) maxinc=k;
00611 nodinc[i]=k;
00612 }
00613
00614 for (i=1;i<nproc;i++){
00615 MPI_Send (&maxinc,1,MPI_LONG,i,ndom,MPI_COMM_WORLD);
00616 }
00617
00618
00619
00620
00621
00622
00623
00624
00625 }
00626 else{
00627 MPI_Recv (&maxinc,1,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00628 }
00629 MPI_Barrier (MPI_COMM_WORLD);
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641 buff = new long [maxnbn*(totmaxndofn+1)];
00642 for (i=0;i<maxnbn*(totmaxndofn+1);i++){
00643 buff[i]=0;
00644 }
00645
00646 k=0;
00647 for (i=0;i<top->nn;i++){
00648 if (ltg[i]!=-1){
00649 buff[k*(totmaxndofn+1)+totmaxndofn]=ltg[i];
00650 for (j=0;j<top->give_ndofn (i);j++){
00651 buff[k*(totmaxndofn+1)+j]=top->give_dof (i,j);
00652 }
00653 k++;
00654 }
00655 }
00656
00657
00658 if (myrank==0){
00659 gncn = new long* [maxgnn];
00660 for (i=0;i<maxgnn;i++){
00661 gncn[i] = new long [nodinc[i]*totmaxndofn];
00662 for (j=0;j<nodinc[i]*totmaxndofn;j++){
00663 gncn[i][j]=0;
00664 }
00665 }
00666
00667
00668 for (i=0;i<maxgnn;i++){
00669 nodinc[i]=0;
00670 }
00671 for (j=0;j<nbndom[ndom];j++){
00672 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00673 m=nodinc[l]*totmaxndofn;
00674 for (k=0;k<totmaxndofn;k++){
00675 gncn[l][m]=buff[j*(totmaxndofn+1)+k]; m++;
00676 }
00677 nodinc[l]++;
00678 }
00679
00680
00681
00682 for (i=1;i<nproc;i++){
00683 MPI_Recv (buff,maxnbn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00684 for (j=0;j<nbndom[stat.MPI_TAG];j++){
00685 l=buff[j*(totmaxndofn+1)+totmaxndofn];
00686 m=nodinc[l]*totmaxndofn;
00687 for (k=0;k<totmaxndofn;k++){
00688 gncn[l][m]=buff[j*(totmaxndofn+1)+k]; m++;
00689 }
00690 nodinc[l]++;
00691 }
00692 }
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713 ngdof=1;
00714 for (i=0;i<maxgnn;i++){
00715 for (j=totmaxndofn;j<nodinc[i]*totmaxndofn;j++){
00716 if (gncn[i][j]>0){
00717 gncn[i][j]=ngdof; ngdof++;
00718 }
00719 }
00720 }
00721 ngdof--;
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735 }
00736 else{
00737 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
00738 }
00739 MPI_Barrier (MPI_COMM_WORLD);
00740 delete [] buff;
00741
00742
00743
00744
00745
00746
00747
00748 buff = new long [maxnbn*(maxinc*totmaxndofn+1)];
00749
00750 j=0;
00751 for (i=0;i<top->nn;i++){
00752 if (ltg[i]!=-1){
00753 buff[j*(maxinc*totmaxndofn+1)]=ltg[i]; j++;
00754 }
00755 }
00756
00757
00758 nodnum = new long [nbn];
00759 j=0;
00760 for (i=0;i<top->nn;i++){
00761 if (ltg[i]!=-1){
00762 nodnum[j]=i;
00763 j++;
00764 }
00765 }
00766
00767
00768 if (myrank==0){
00769
00770 ii=ndom;
00771
00772
00773 for (j=0;j<nbndom[ii];j++){
00774 jj=buff[j*(maxinc*totmaxndofn+1)];
00775 for (k=0;k<nproc;k++){
00776 if (noddom[jj][k]==1) break;
00777 }
00778 if (k==ii){
00779 kk=0;
00780 for (k=totmaxndofn;k<nodinc[jj]*totmaxndofn;k++){
00781 buff[j*(maxinc*totmaxndofn+1)+kk]=0-gncn[jj][k]; kk++;
00782 }
00783 }
00784 else{
00785 kk=0;
00786 for (k=0;k<ii;k++){
00787 if (noddom[jj][k]==1) kk++;
00788 }
00789 ll=0;
00790 for (k=kk*totmaxndofn;k<(kk+1)*totmaxndofn;k++){
00791 buff[j*(maxinc*totmaxndofn+1)+ll]=gncn[jj][k]; ll++;
00792 }
00793 }
00794 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=nodinc[jj]-1;
00795 }
00796
00797
00798
00799 inc = new long [nbn];
00800
00801 lcngcn = new long* [nbn];
00802 for (i=0;i<nbn;i++){
00803 inc[i]=buff[i*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn];
00804 lcngcn[i] = new long [inc[i]*totmaxndofn];
00805 for (j=0;j<inc[i]*totmaxndofn;j++){
00806 lcngcn[i][j]=buff[i*(maxinc*totmaxndofn+1)+j];
00807 }
00808 }
00809
00810 for (i=1;i<nproc;i++){
00811 MPI_Recv (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00812 ii=stat.MPI_TAG;
00813
00814
00815 for (j=0;j<nbndom[ii];j++){
00816 jj=buff[j*(maxinc*totmaxndofn+1)];
00817 for (k=0;k<nproc;k++){
00818 if (noddom[jj][k]==1) break;
00819 }
00820 if (k==ii){
00821 kk=0;
00822 for (k=totmaxndofn;k<nodinc[jj]*totmaxndofn;k++){
00823 buff[j*(maxinc*totmaxndofn+1)+kk]=0-gncn[jj][k]; kk++;
00824 }
00825 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=nodinc[jj]-1;
00826 }
00827 else{
00828 kk=0;
00829 for (k=0;k<ii;k++){
00830 if (noddom[jj][k]==1) kk++;
00831 }
00832 ll=0;
00833 for (k=kk*totmaxndofn;k<(kk+1)*totmaxndofn;k++){
00834 buff[j*(maxinc*totmaxndofn+1)+ll]=gncn[jj][k]; ll++;
00835 }
00836 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=1;
00837 }
00838 }
00839
00840
00841 MPI_Send (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,domproc[ii],ndom,MPI_COMM_WORLD);
00842
00843
00844 }
00845 }
00846 else{
00847 MPI_Send (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
00848 MPI_Recv (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
00849
00850
00851
00852 inc = new long [nbn];
00853
00854 lcngcn = new long* [nbn];
00855 for (i=0;i<nbn;i++){
00856 inc[i]=buff[i*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn];
00857 lcngcn[i] = new long [inc[i]*totmaxndofn];
00858 for (j=0;j<inc[i]*totmaxndofn;j++){
00859 lcngcn[i][j]=buff[i*(maxinc*totmaxndofn+1)+j];
00860 }
00861 }
00862 }
00863 MPI_Barrier (MPI_COMM_WORLD);
00864
00865
00866 delete [] buff;
00867
00868 if (myrank==0){
00869 delete [] nodinc;
00870
00871 for (i=0;i<maxgnn;i++){
00872 delete [] gncn[i];
00873 }
00874 delete [] gncn;
00875
00876 for (i=0;i<maxgnn;i++){
00877 delete [] noddom[i];
00878 }
00879 delete [] noddom;
00880 }
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894 }
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909 void paral::locglobfeti (gtopology *top,double *gv,double *lv)
00910 {
00911 long i,j,k,l,ln,lcn,llgcn;
00912
00913
00914
00915
00916
00917
00918 for (i=0;i<nbn;i++){
00919
00920 l=0;
00921 ln=nodnum[i];
00922
00923
00924
00925
00926 for (j=0;j<inc[i];j++){
00927 for (k=0;k<totmaxndofn;k++){
00928 lcn=top->give_dof (ln,k)-1;
00929 llgcn=lcngcn[i][l];
00930
00931
00932
00933 if (llgcn<0) gv[0-llgcn-1]-=lv[lcn];
00934 if (llgcn>0) gv[llgcn-1]+=lv[lcn];
00935 l++;
00936 }
00937 }
00938
00939
00940
00941 }
00942
00943
00944
00945 }
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957 void paral::globlocfeti (gtopology *top,double *gv,double *lv)
00958 {
00959 long i,j,k,l,ln,lcn,llgcn;
00960
00961
00962 for (i=0;i<nbn;i++){
00963 l=0; ln=nodnum[i];
00964 for (j=0;j<inc[i];j++){
00965 for (k=0;k<totmaxndofn;k++){
00966 lcn=top->give_dof (ln,k)-1;
00967 llgcn=lcngcn[i][l];
00968 if (llgcn<0) lv[lcn]-=gv[0-llgcn-1];
00969 if (llgcn>0) lv[lcn]+=gv[llgcn-1];
00970 l++;
00971 }
00972 }
00973 }
00974
00975 }
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030 void paral::dpfetiordering (gtopology *top)
01031 {
01032 long i,j,k,ndofn;
01033
01034
01035 ndof=1;
01036 for (i=0;i<top->nn;i++){
01037 if (ltg[i]>=-1){
01038
01039 ndofn=top->give_ndofn (i);
01040 for (j=0;j<ndofn;j++){
01041 k=top->give_dof(i,j);
01042 if (k<0) continue;
01043 if (k==0) continue;
01044 if (k>0){
01045 top->save_dof (i,j,ndof); ndof++;
01046 }
01047 }
01048 }
01049 }
01050 indof=ndof-1;
01051
01052 for (i=0;i<top->nn;i++){
01053 if (ltg[i]<-1){
01054
01055 ndofn=top->give_ndofn (i);
01056 for (j=0;j<ndofn;j++){
01057 k=top->give_dof (i,j);
01058 if (k<0) continue;
01059 if (k==0) continue;
01060 if (k>0){
01061 top->save_dof (i,j,ndof); ndof++;
01062 }
01063 }
01064 }
01065 }
01066 ndof--;
01067
01068
01069 for (i=0;i<top->ne;i++){
01070 if (top->give_cne (i)==1){
01071 for (j=0;j<top->give_ndofe(i);j++){
01072 if (top->give_dof (i,j)>ndof) ndof=top->give_dof (i,j);
01073 }
01074 }
01075 }
01076
01077 }
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087 void paral::globcnnum_dpfeti (gtopology *top,FILE *out)
01088 {
01089 long i,j;
01090 long *buff,**noddom,*nodinc,**gncn;
01091 MPI_Status stat;
01092
01093
01094
01095
01096
01097 maxndofn=0;
01098
01099 nbn=0;
01100
01101 gnbn=0;
01102
01103 ncn=0;
01104
01105 gncn=0;
01106 for (i=0;i<top->nn;i++){
01107 if (maxndofn<top->give_ndofn (i)) maxndofn = top->give_ndofn (i);
01108
01109 if (ltg[i]>-1){
01110 nbn++;
01111 if (gnbn<ltg[i]) gnbn=ltg[i];
01112 }
01113
01114 if (ltg[i]<-1){
01115 ncn++;
01116 if (gncn<0-ltg[i]-1) gncn=0-ltg[i]-1;
01117 }
01118 }
01119
01120
01121 buff = new long [3];
01122 buff[0]=maxndofn;
01123 buff[1]=nbn;
01124 buff[2]=gnbn;
01125 buff[3]=ncn;
01126 buff[4]=gncn;
01127 buff[5]=ndof-indof;
01128
01129 if (myrank==0){
01130
01131 nbndom = new long [nproc];
01132 nbndom[ndom]=nbn;
01133
01134
01135 ncndom = new long [nproc];
01136 ncndom[ndom]=ncn;
01137
01138
01139 ncdofdom = new long [nproc];
01140 ncdofdom[ndom]=ndof-indof;
01141
01142
01143 totmaxndofn=maxndofn;
01144
01145 maxnbn=nbn;
01146
01147 maxgnbn=gnbn;
01148
01149 maxncn=ncn;
01150
01151 maxgncn=gncn;
01152
01153 maxncdof=ndof-indof;
01154 for (i=1;i<nproc;i++){
01155 MPI_Recv (buff,5,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01156
01157 nbndom[stat.MPI_TAG]=buff[1];
01158 ncndom[stat.MPI_TAG]=buff[3];
01159 ncdofdom[stat.MPI_TAG]=buff[5];
01160
01161 if (buff[0]>totmaxndofn) totmaxndofn=buff[0];
01162 if (buff[1]>maxnbn) maxnbn=buff[1];
01163 if (buff[2]>maxgnbn) maxgnbn=buff[2];
01164 if (buff[3]>maxncn) maxncn=buff[3];
01165 if (buff[4]>maxgncn) maxgncn=buff[4];
01166 if (buff[5]>maxncdof) maxncdof=buff[5];
01167 }
01168 maxgnbn++; maxgncn++;
01169
01170
01171 fprintf (out,"\n\n\n Global data information \n");
01172 fprintf (out,"\n totmaxndofn %ld",totmaxndofn);
01173 fprintf (out,"\n maxnbn %ld",maxnbn);
01174 fprintf (out,"\n maxgnbn %ld",maxgnbn);
01175 fprintf (out,"\n maxncn %ld",maxncn);
01176 fprintf (out,"\n maxgncn %ld",maxgncn);
01177 fprintf (out,"\n maxncdof %ld",maxcndof);
01178 fprintf (out,"\n\n pocty velicin na podoblastech");
01179 for (i=0;i<nproc;i++){
01180 fprintf (out,"\n nbn %4ld ncn %4ld ncdof",nbndom[i],ncndom[i],ncdofdom[i]);
01181 }
01182
01183
01184 buff[0]=totmaxndofn;
01185 buff[1]=maxncn;
01186 buff[2]=maxncdof;
01187 buff[3]=maxnbn;
01188 for (i=1;i<nproc;i++){
01189 MPI_Send (buff,5,MPI_LONG,i,ndom,MPI_COMM_WORLD);
01190 }
01191 }
01192 else{
01193 MPI_Send (buff,5,MPI_LONG,0,ndom,MPI_COMM_WORLD);
01194 MPI_Recv (buff,5,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01195 totmaxndofn=buff[0];
01196 maxncn=buff[1];
01197 maxncdof=buff[2];
01198 maxnbn=buff[3];
01199 }
01200 MPI_Barrier (MPI_COMM_WORLD);
01201 delete [] buff;
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213 buff = new long [maxncn*(totmaxndofn+1)];
01214 for (i=0;i<maxncn*(totmaxndofn+1);i++){
01215 buff[i]=0;
01216 }
01217
01218
01219 k=0;
01220 for (i=0;i<top->nn;i++){
01221 if (ltg[i]<-1){
01222 buff[k*(totmaxndofn+1)+totmaxndofn]=0-ltg[i]-1;
01223 for (j=0;j<top->give_ndofn (i);j++){
01224 buff[k*(totmaxndofn+1)+j]=top->give_dof (i,j);
01225 }
01226 k++;
01227 }
01228 }
01229
01230
01231 if (myrank==0){
01232
01233
01234 gncn = new long* [maxgncn];
01235 for (i=0;i<maxgncn;i++){
01236 gncn[i] = new long [totmaxndofn];
01237 for (j=0;j<totmaxndofn;j++){
01238 gncn[i][j]=0;
01239 }
01240 }
01241
01242
01243 for (j=0;j<ncndom[ndom];j++){
01244 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01245 for (k=0;k<totmaxndofn;k++){
01246 gncn[l][k]=buff[j*(totmaxndofn+1)+k];
01247 }
01248 }
01249
01250
01251 for (i=1;i<nproc;i++){
01252 MPI_Recv (buff,maxncn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01253 for (j=0;j<ncndom[stat.MPI_TAG];j++){
01254 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01255 for (k=0;k<totmaxndofn;k++){
01256 gncn[l][k]=buff[j*(totmaxndofn+1)+k];
01257 }
01258 }
01259 }
01260
01261
01262 ncdof=1;
01263 for (i=0;i<maxgncn;i++){
01264 for (j=0;j<totmaxndofn;j++){
01265 if (gncn[i][j]>0){
01266 gncn[i][j]=ncdof; ncdof++;
01267 }
01268 }
01269 }
01270 ncdof--;
01271
01272 }
01273 else{
01274 MPI_Send (buff,maxncn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
01275 }
01276 MPI_Barrier (MPI_COMM_WORLD);
01277
01278
01279
01280
01281
01282 if (myrank==0){
01283 for (i=1;i<nproc;i++){
01284 MPI_Recv (buff,maxncn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01285 for (j=0;j<ncndom[stat.MPI_TAG];j++){
01286 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01287 for (k=0;k<totmaxndofn;k++){
01288 buff[j*(totmaxndofn+1)+k]=gncn[l][k];
01289 }
01290 }
01291 l=stat.MPI_TAG;
01292 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,l,ndom,MPI_COMM_WORLD);
01293 }
01294
01295 k=0;
01296 for (i=0;i<top->nn;i++){
01297 if (ltg[i]<-1){
01298 buff[k*(totmaxndofn+1)+totmaxndofn]=0-ltg[i]-1;
01299 for (j=0;j<top->give_ndofn (i);j++){
01300 buff[k*(totmaxndofn+1)+j]=top->give_dof(i,j);
01301 }
01302 k++;
01303 }
01304 }
01305
01306 for (j=0;j<ncndom[ndom];j++){
01307 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01308 for (k=0;k<totmaxndofn;k++){
01309 buff[j*(totmaxndofn+1)+k]=gncn[l][k];
01310 }
01311 }
01312
01313
01314 for (i=0;i<maxgncn;i++){
01315 delete [] gncn[i];
01316 }
01317 delete [] gncn;
01318
01319 }
01320 else{
01321 MPI_Send (buff,maxncn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
01322 MPI_Recv (buff,maxncn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01323 }
01324 MPI_Barrier (MPI_COMM_WORLD);
01325
01326
01327
01328
01329
01330
01331
01332 gcn = new long [ndof];
01333 for (i=0;i<ndof;i++){
01334 gcn[i]=0;
01335 }
01336
01337
01338 k=0;
01339 for (i=0;i<top->nn;i++){
01340 if (ltg[i]<-1){
01341 for (j=0;j<top->give_ndofn (i);j++){
01342 l=top->give_dof (i,j)-1;
01343 if (l>-1) gcn[l]=buff[k*(totmaxndofn+1)+j];
01344 }
01345 k++;
01346 }
01347 }
01348
01349 delete [] buff;
01350
01351
01352
01353
01354
01355 buff = new long [maxncdof];
01356 j=indof;
01357 for (i=0;i<ndof-indof;i++){
01358 buff[i]=gcn[j]; j++;
01359 }
01360
01361 if (myrank==0){
01362
01363 masgcn = new long* [nproc];
01364 for (i=0;i<nproc;i++){
01365 masgcn[i] = new long [ncdofdom[i]];
01366 for (j=0;j<ncdofdom[i];j++){
01367 masgcn[i][j]=0;
01368 }
01369 }
01370
01371
01372 for (j=0;j<ncdofdom[ndom];j++){
01373 masgcn[ndom][j]=buff[j];
01374 }
01375
01376
01377 for (i=1;i<nproc;i++){
01378 MPI_Recv (buff,maxncdof,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01379
01380 for (j=0;j<ncdofdom[stat.MPI_TAG];j++){
01381 masgcn[stat.MPI_TAG][j]=buff[j];
01382 }
01383
01384 }
01385 }
01386 else{
01387 MPI_Send (buff,maxncdof,MPI_LONG,0,ndom,MPI_COMM_WORLD);
01388 }
01389 MPI_Barrier (MPI_COMM_WORLD);
01390
01391 delete [] buff;
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413 buff = new long [maxnbn];
01414 j=0;
01415 for (i=0;i<top->nn;i++){
01416 if (ltg[i]>-1){
01417 buff[j]=ltg[i]; j++;
01418 }
01419 }
01420
01421 if (myrank==0){
01422
01423 noddom = new long* [maxgnbn];
01424 for (i=0;i<maxgnbn;i++){
01425 noddom[i] = new long [nproc];
01426 for (j=0;j<nproc;j++){
01427 noddom[i][j]=-1;
01428 }
01429 }
01430
01431 k=ndom;
01432 for (j=0;j<nbndom[k];j++){
01433 noddom[buff[j]][k]=1;
01434 }
01435
01436 for (i=1;i<nproc;i++){
01437 MPI_Recv (buff,maxnbn,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01438 k=stat.MPI_TAG;
01439 for (j=0;j<nbndom[k];j++){
01440 noddom[buff[j]][k]=1;
01441 }
01442 }
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454 }
01455 else{
01456 MPI_Send (buff,maxnbn,MPI_LONG,0,ndom,MPI_COMM_WORLD);
01457 }
01458 MPI_Barrier (MPI_COMM_WORLD);
01459 delete [] buff;
01460
01461
01462
01463
01464
01465 if (myrank==0){
01466
01467 nodinc = new long [maxgnbn];
01468
01469 maxinc=0;
01470 for (i=0;i<maxgnbn;i++){
01471 k=0;
01472 for (j=0;j<nproc;j++){
01473 if (noddom[i][j]==1) k++;
01474 }
01475 if (maxinc<k) maxinc=k;
01476 nodinc[i]=k;
01477 }
01478
01479 for (i=1;i<nproc;i++){
01480 MPI_Send (&maxinc,1,MPI_LONG,i,ndom,MPI_COMM_WORLD);
01481 }
01482
01483
01484
01485
01486
01487
01488
01489
01490 }
01491 else{
01492 MPI_Recv (&maxinc,1,MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01493 }
01494 MPI_Barrier (MPI_COMM_WORLD);
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506 buff = new long [maxnbn*(totmaxndofn+1)];
01507 for (i=0;i<maxnbn*(totmaxndofn+1);i++){
01508 buff[i]=0;
01509 }
01510
01511 k=0;
01512 for (i=0;i<top->nn;i++){
01513 if (ltg[i]>=-1){
01514 buff[k*(totmaxndofn+1)+totmaxndofn]=ltg[i];
01515 for (j=0;j<top->give_ndofn (i);j++){
01516 buff[k*(totmaxndofn+1)+j]=top->give_dof (i,j);
01517 }
01518 k++;
01519 }
01520 }
01521
01522
01523 if (myrank==0){
01524 gncn = new long* [maxgnbn];
01525 for (i=0;i<maxgnbn;i++){
01526 gncn[i] = new long [nodinc[i]*totmaxndofn];
01527 for (j=0;j<nodinc[i]*totmaxndofn;j++){
01528 gncn[i][j]=0;
01529 }
01530 }
01531
01532
01533 for (i=0;i<maxgnbn;i++){
01534 nodinc[i]=0;
01535 }
01536 for (j=0;j<nbndom[ndom];j++){
01537 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01538 m=nodinc[l]*totmaxndofn;
01539 for (k=0;k<totmaxndofn;k++){
01540 gncn[l][m]=buff[j*(totmaxndofn+1)+k]; m++;
01541 }
01542 nodinc[l]++;
01543 }
01544
01545
01546
01547 for (i=1;i<nproc;i++){
01548 MPI_Recv (buff,maxnbn*(totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01549 for (j=0;j<nbndom[stat.MPI_TAG];j++){
01550 l=buff[j*(totmaxndofn+1)+totmaxndofn];
01551 m=nodinc[l]*totmaxndofn;
01552 for (k=0;k<totmaxndofn;k++){
01553 gncn[l][m]=buff[j*(totmaxndofn+1)+k]; m++;
01554 }
01555 nodinc[l]++;
01556 }
01557 }
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578 nmdof=1;
01579 for (i=0;i<maxgnbn;i++){
01580 for (j=totmaxndofn;j<nodinc[i]*totmaxndofn;j++){
01581 if (gncn[i][j]>0){
01582 gncn[i][j]=nmdof; nmdof++;
01583 }
01584 }
01585 }
01586 nmdof--;
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600 }
01601 else{
01602 MPI_Send (buff,maxnbn*(totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
01603 }
01604 MPI_Barrier (MPI_COMM_WORLD);
01605 delete [] buff;
01606
01607
01608
01609
01610
01611
01612
01613 buff = new long [maxnbn*(maxinc*totmaxndofn+1)];
01614
01615 j=0;
01616 for (i=0;i<top->nn;i++){
01617 if (ltg[i]>-1){
01618 buff[j*(maxinc*totmaxndofn+1)]=ltg[i]; j++;
01619 }
01620 }
01621
01622
01623 nodnum = new long [nbn];
01624 j=0;
01625 for (i=0;i<top->nn;i++){
01626 if (ltg[i]>-1){
01627 nodnum[j]=i;
01628 j++;
01629 }
01630 }
01631
01632
01633 if (myrank==0){
01634
01635 ii=ndom;
01636
01637
01638 for (j=0;j<nbndom[ii];j++){
01639 jj=buff[j*(maxinc*totmaxndofn+1)];
01640 for (k=0;k<nproc;k++){
01641 if (noddom[jj][k]==1) break;
01642 }
01643 if (k==ii){
01644 kk=0;
01645 for (k=totmaxndofn;k<nodinc[jj]*totmaxndofn;k++){
01646 buff[j*(maxinc*totmaxndofn+1)+kk]=0-gncn[jj][k]; kk++;
01647 }
01648 }
01649 else{
01650 kk=0;
01651 for (k=0;k<ii;k++){
01652 if (noddom[jj][k]==1) kk++;
01653 }
01654 ll=0;
01655 for (k=kk*totmaxndofn;k<(kk+1)*totmaxndofn;k++){
01656 buff[j*(maxinc*totmaxndofn+1)+ll]=gncn[jj][k]; ll++;
01657 }
01658 }
01659 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=nodinc[jj]-1;
01660 }
01661
01662
01663
01664 inc = new long [nbn];
01665
01666 lcngcn = new long* [nbn];
01667 for (i=0;i<nbn;i++){
01668 inc[i]=buff[i*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn];
01669 lcngcn[i] = new long [inc[i]*totmaxndofn];
01670 for (j=0;j<inc[i]*totmaxndofn;j++){
01671 lcngcn[i][j]=buff[i*(maxinc*totmaxndofn+1)+j];
01672 }
01673 }
01674
01675 for (i=1;i<nproc;i++){
01676 MPI_Recv (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01677 ii=stat.MPI_TAG;
01678
01679
01680 for (j=0;j<nbndom[ii];j++){
01681 jj=buff[j*(maxinc*totmaxndofn+1)];
01682 for (k=0;k<nproc;k++){
01683 if (noddom[jj][k]==1) break;
01684 }
01685 if (k==ii){
01686 kk=0;
01687 for (k=totmaxndofn;k<nodinc[jj]*totmaxndofn;k++){
01688 buff[j*(maxinc*totmaxndofn+1)+kk]=0-gncn[jj][k]; kk++;
01689 }
01690 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=nodinc[jj]-1;
01691 }
01692 else{
01693 kk=0;
01694 for (k=0;k<ii;k++){
01695 if (noddom[jj][k]==1) kk++;
01696 }
01697 ll=0;
01698 for (k=kk*totmaxndofn;k<(kk+1)*totmaxndofn;k++){
01699 buff[j*(maxinc*totmaxndofn+1)+ll]=gncn[jj][k]; ll++;
01700 }
01701 buff[j*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn]=1;
01702 }
01703 }
01704
01705
01706 MPI_Send (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,domproc[ii],ndom,MPI_COMM_WORLD);
01707
01708
01709 }
01710 }
01711 else{
01712 MPI_Send (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,0,ndom,MPI_COMM_WORLD);
01713 MPI_Recv (buff,maxnbn*(maxinc*totmaxndofn+1),MPI_LONG,MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&stat);
01714
01715
01716
01717 inc = new long [nbn];
01718
01719 lcngcn = new long* [nbn];
01720 for (i=0;i<nbn;i++){
01721 inc[i]=buff[i*(maxinc*totmaxndofn+1)+maxinc*totmaxndofn];
01722 lcngcn[i] = new long [inc[i]*totmaxndofn];
01723 for (j=0;j<inc[i]*totmaxndofn;j++){
01724 lcngcn[i][j]=buff[i*(maxinc*totmaxndofn+1)+j];
01725 }
01726 }
01727 }
01728 MPI_Barrier (MPI_COMM_WORLD);
01729
01730
01731 delete [] buff;
01732
01733 if (myrank==0){
01734 delete [] nodinc;
01735
01736 for (i=0;i<maxgnn;i++){
01737 delete [] gncn[i];
01738 }
01739 delete [] gncn;
01740
01741 for (i=0;i<maxgnn;i++){
01742 delete [] noddom[i];
01743 }
01744 delete [] noddom;
01745 }
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759 }
01760
01761