/[escript]/trunk-mpi-branch/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk-mpi-branch/escript/src/Data.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1222 by ksteube, Fri Jun 15 03:45:48 2007 UTC revision 1223 by gross, Fri Aug 3 02:40:39 2007 UTC
# Line 13  Line 13 
13  */  */
14  #include "Data.h"  #include "Data.h"
15    
 #include "paso/Common.h"  
16  #include "DataExpanded.h"  #include "DataExpanded.h"
17  #include "DataConstant.h"  #include "DataConstant.h"
18  #include "DataTagged.h"  #include "DataTagged.h"
# Line 808  Data::integrate() const Line 807  Data::integrate() const
807  #ifdef PASO_MPI  #ifdef PASO_MPI
808    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals_local,*this);    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals_local,*this);
809    // Global sum: use an array instead of a vector because elements of array are guaranteed to be contiguous in memory    // Global sum: use an array instead of a vector because elements of array are guaranteed to be contiguous in memory
810    double *tmp, *tmp_local;    double *tmp = new double[dataPointSize];
811    tmp       = MEMALLOC(dataPointSize,double);    double *tmp_local = new double[dataPointSize];
   tmp_local = MEMALLOC(dataPointSize,double);  
812    for (int i=0; i<dataPointSize; i++) { tmp_local[i] = integrals_local[i]; }    for (int i=0; i<dataPointSize; i++) { tmp_local[i] = integrals_local[i]; }
813    MPI_Allreduce( &tmp_local[0], &tmp[0], dataPointSize, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );    MPI_Allreduce( &tmp_local[0], &tmp[0], dataPointSize, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
814    for (int i=0; i<dataPointSize; i++) { integrals[i] = tmp[i]; }    for (int i=0; i<dataPointSize; i++) { integrals[i] = tmp[i]; }
815    MEMFREE(tmp);    delete[] tmp;
816    MEMFREE(tmp_local);    delete[] tmp_local;
817  #else  #else
818    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals,*this);    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals,*this);
819  #endif  #endif

Legend:
Removed from v.1222  
changed lines
  Added in v.1223

  ViewVC Help
Powered by ViewVC 1.1.26