source:
issm/oecreview/Archive/18296-19100/ISSM-18478-18479.diff
Last change on this file was 19102, checked in by , 10 years ago | |
---|---|
File size: 1.6 KB |
-
../trunk-jpl/src/m/contrib/gravity/vfsa_mpi.cpp
146 146 MPI_Comm_rank(MPI_COMM_WORLD,&my_rank); 147 147 148 148 /* Seed the random number generator {{{*/ 149 srand (time(NULL));/*}}}*/149 srand (time(NULL)); /*}}}*/ 150 150 /* Define the variables {{{*/ 151 151 152 152 int dx = 500; /* prism dimension in x-direction */ … … 443 443 /*GSL Matrices and vectors: */ 444 444 int M,N; 445 445 double chisq; 446 447 446 /*Get system size*/ 448 447 A->GetSize(&M,&N); 449 448 … … 532 531 bool test=true; 533 532 534 533 double *glocal=new double[n](); 535 double *gcalc=new double[n]();536 534 537 535 for(int c=my_rank;c<n;c+=num_procs){ 538 536 glocal[c]=0; … … 566 564 for(int i=0;i<2;i++){ 567 565 si*=-1; 568 566 for(int j=0;j<2;j++){ 569 s i*=-1;567 sj*=-1; 570 568 s=si*sj; 571 569 for(int k=0;k<l;k++){ 572 570 R=sqrt(xp->GetValue(0,i)*xp->GetValue(0,i)+yp->GetValue(0,j)*yp->GetValue(0,j)+mesh->GetValue(a,k)*mesh->GetValue(a,k)); … … 587 585 } 588 586 } 589 587 590 MPI_Allreduce(glocal,gcalc,n,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); 591 if(!my_rank){for(int c=0;c<n;c++){ 592 g->SetValue(c,0,gcalc[c]); 593 } 594 } 588 MPI_Allreduce(glocal,g->GetPointer(),n,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); 595 589 596 590 delete xp; 597 591 delete yp; … … 602 596 delete U1; 603 597 delete U2; 604 598 delete []glocal; 605 delete []gcalc;606 599 }/*}}}*/ 607 600 void vec2gridsimple(Matrix *V,Matrix *V1,int nx, int ny){/*{{{*/ 608 601 for(int i=0;i<ny;i++){
Note:
See TracBrowser
for help on using the repository browser.