[19102] | 1 | Index: ../trunk-jpl/src/m/contrib/gravity/vfsa_mpi.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/contrib/gravity/vfsa_mpi.cpp (revision 18478)
|
---|
| 4 | +++ ../trunk-jpl/src/m/contrib/gravity/vfsa_mpi.cpp (revision 18479)
|
---|
| 5 | @@ -146,7 +146,7 @@
|
---|
| 6 | MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);
|
---|
| 7 |
|
---|
| 8 | /* Seed the random number generator {{{*/
|
---|
| 9 | - srand (time(NULL)); /*}}}*/
|
---|
| 10 | + srand (time(NULL)); /*}}}*/
|
---|
| 11 | /* Define the variables {{{*/
|
---|
| 12 |
|
---|
| 13 | int dx = 500; /* prism dimension in x-direction */
|
---|
| 14 | @@ -443,7 +443,6 @@
|
---|
| 15 | /*GSL Matrices and vectors: */
|
---|
| 16 | int M,N;
|
---|
| 17 | double chisq;
|
---|
| 18 | -
|
---|
| 19 | /*Get system size*/
|
---|
| 20 | A->GetSize(&M,&N);
|
---|
| 21 |
|
---|
| 22 | @@ -532,7 +531,6 @@
|
---|
| 23 | bool test=true;
|
---|
| 24 |
|
---|
| 25 | double *glocal=new double[n]();
|
---|
| 26 | - double *gcalc=new double[n]();
|
---|
| 27 |
|
---|
| 28 | for(int c=my_rank;c<n;c+=num_procs){
|
---|
| 29 | glocal[c]=0;
|
---|
| 30 | @@ -566,7 +564,7 @@
|
---|
| 31 | for(int i=0;i<2;i++){
|
---|
| 32 | si*=-1;
|
---|
| 33 | for(int j=0;j<2;j++){
|
---|
| 34 | - si*=-1;
|
---|
| 35 | + sj*=-1;
|
---|
| 36 | s=si*sj;
|
---|
| 37 | for(int k=0;k<l;k++){
|
---|
| 38 | 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));
|
---|
| 39 | @@ -587,11 +585,7 @@
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | - MPI_Allreduce(glocal,gcalc,n,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
|
---|
| 44 | - if(!my_rank){for(int c=0;c<n;c++){
|
---|
| 45 | - g->SetValue(c,0,gcalc[c]);
|
---|
| 46 | - }
|
---|
| 47 | - }
|
---|
| 48 | + MPI_Allreduce(glocal,g->GetPointer(),n,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
|
---|
| 49 |
|
---|
| 50 | delete xp;
|
---|
| 51 | delete yp;
|
---|
| 52 | @@ -602,7 +596,6 @@
|
---|
| 53 | delete U1;
|
---|
| 54 | delete U2;
|
---|
| 55 | delete []glocal;
|
---|
| 56 | - delete []gcalc;
|
---|
| 57 | }/*}}}*/
|
---|
| 58 | void vec2gridsimple(Matrix *V,Matrix *V1,int nx, int ny){/*{{{*/
|
---|
| 59 | for(int i=0;i<ny;i++){
|
---|